473,383 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

how can i reslove [Microsoft][ODBC SQL Server Driver]Timeout expired

syedshaffee
I have web page while redirecting to the web page I receive this error Microsoft OLE DB Provider for ODBC Drivers (0x80040E31)
[Microsoft][ODBC SQL Server Driver]Timeout expired
I have a primary key in my table and when hit refresh the page is displayed here is the below code
can some please help me on this
Expand|Select|Wrap|Line Numbers
  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <!--#INCLUDE FILE="../include/Constants.asp"   -->
  3. <!--#INCLUDE FILE="../include/commoninc_restrict.asp"-->
  4.  
  5. <%varLocale = SetLocale(3081)%>
  6. <%strRootFolder = session("strRootFolder")%>
  7. <%
  8.     TotalContracts = 0
  9.     rentalQuarterlytotal = 0
  10.     Quarterlycount = 0
  11.     Monthlycount = 0 
  12.     Yearlycount = 0   
  13.     HalfYearlycount = 0
  14.             sql = "SELECT distinct Staff.Staff_Name," & _
  15.                 " Staff.Staff_phone," & _
  16.                 " Staff.Staff_fax," & _
  17.                 " Staff.Staff_cell," & _
  18.                 " Staff.Staff_email" & _
  19.                 " from Staff inner join " & _
  20.                 " Customer_Detail on Staff.Staff_id = Customer_Detail.Customer_Staff_id " & _
  21.                 " where Customer_Detail.Customer_id = " & Session(CUSTOMER_ID)
  22.  
  23.         Set objRIMSConn = Server.CreateObject("ADODB.Connection")
  24.         objRIMSConn.Open RIMS_CONNECT
  25.  
  26.         Set rstStaffContact = Server.CreateObject("ADODB.Recordset")
  27.         rstStaffContact.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  28.  
  29.         Set Session("rstStaffContact") = rstStaffContact        ' Store for fast retrieval later on.
  30.  
  31.     ' get funder details
  32.     ' if Session("rstStaffContact") is nothing then
  33.         sql = "SELECT Customer_Funder.Customer_Funder_AdjActual_date," & _
  34.                 " Customer_Funder.Customer_Funder_AdjActual," & _
  35.                 " Customer_Funder.Customer_Funder_Expiry " & _
  36.                 " from Customer_Funder " & _
  37.                 " where Customer_Funder.Customer_id = " & Session(CUSTOMER_ID) & _
  38.                 " and Customer_Funder.Customer_Funder_Expiry = " & _
  39.                 " (select min(Customer_Funder.Customer_Funder_Expiry)" & _
  40.                 " from Customer_Funder " & _
  41.                 " where Customer_Funder.Customer_id = " & Session(CUSTOMER_ID) & ")"
  42.  
  43.         'Set objRIMSConn = Server.CreateObject("ADODB.Connection")
  44.         'objRIMSConn.Open RIMS_CONNECT
  45.  
  46.         Set rstCustFunder = Server.CreateObject("ADODB.Recordset")
  47.         rstCustFunder.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  48.  
  49.         Set Session("rstCustFunder") = rstCustFunder        ' Store for fast retrieval later on.
  50.  
  51. ' check if already have CustomerNotice
  52. ' if Session("CustomerNotice") is nothing then
  53.             sql = "SELECT Customer_Detail.CustomerNotice" & _
  54.                 " from Customer_Detail " & _
  55.                 " where Customer_Detail.Customer_id = " & Session(CUSTOMER_ID)
  56.  
  57.         Set objRIMSConn = Server.CreateObject("ADODB.Connection")
  58.         objRIMSConn.Open RIMS_CONNECT
  59.  
  60.         Set rstCustomerNotice = Server.CreateObject("ADODB.Recordset")
  61.         rstCustomerNotice.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  62.  
  63.         Set Session("CustomerNotice") = rstCustomerNotice("CustomerNotice")        ' Store for fast retrieval later on.
  64. '    end if
  65.  
  66.     ' check if already have Customer Contact details
  67.     ' if Session("rstCustContact") is nothing then
  68.             sql = "SELECT distinct Customer_Contact.Contact_Name," & _
  69.                 " Customer_Contact.Contact_DDI," & _
  70.                 " Customer_Contact.Contact_fax," & _
  71.                 " Customer_Contact.Contact_mobile," & _
  72.                 " Customer_Contact.Contact_email," & _
  73.                 " Customer_Contact.Contact_address," & _
  74.                 " Customer_Contact.Contact_suburb," & _
  75.                 " Customer_Contact.Contact_city," & _
  76.                 " Customer_Contact.Contact_stateid," & _
  77.                 " Customer_Contact.Contact_postcode" & _
  78.                 " from Customer_Contact " &_
  79.                 " where Customer_Contact.Contact_Customer_id = " & Session(CUSTOMER_ID) &_
  80.                 " AND Customer_contact.Contact_Primary = 1 "
  81.  
  82.  
  83.         Set objRIMSConn = Server.CreateObject("ADODB.Connection")
  84.         objRIMSConn.Open RIMS_CONNECT
  85.  
  86.         Set rstCustContact = Server.CreateObject("ADODB.Recordset")
  87.         rstCustContact.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  88.  
  89.         Set Session("rstCustContact") = rstCustContact        ' Store for fast retrieval later on.
  90. '    else
  91.         ' Contact information already exists, retrieve it from the session object.
  92. '        Set rstCustContact = Session("rstCustContact")
  93. '    end if
  94.  
  95. ' Process any sort requests.
  96.     If not(IsEmpty(Request("ContListSortItem"))) AND (Request("ContListSortItem") <> Session("ContListSortItem")) then
  97.         set Session("rstContract") = nothing
  98.         Session("ContListSortItem") = Request("ContListSortItem")
  99.     end if
  100.  
  101.  
  102. sql = "SELECT  " & _ 
  103.             " Contract_detail.Contract_no, Contract_detail.ContractStatusID, " & _ 
  104.             " Contract_detail.Contract_commence_date, " & _ 
  105.             " Contract_detail.Contract_expiry_date, " & _ 
  106.             " Contract_detail.Contract_rental, " & _ 
  107.             " Contract_detail.Contract_assetmgmt, " & _ 
  108.             " Contract_detail.Contract_term, " & _ 
  109.             " Contract_detail.Contract_frequency, " & _ 
  110.             " Contract_detail.Contract_disc_date, " & _ 
  111.             " Contract_detail.Contract_disc_rec, " & _ 
  112.             " Contract_detail.Contract_bank_settlement, " & _ 
  113.             " SUM(isnull(Asset_Detail.Asset_purchase_price,0)) " & _ 
  114.             " AS Contract_asset_value " & _
  115.         " FROM Contract_detail LEFT OUTER JOIN " & _
  116.             " Asset_Detail ON " & _ 
  117.             " Contract_detail.Contract_no = Asset_Detail.Asset_contract_no LEFT " & _
  118.              " OUTER JOIN " & _
  119.             " ContractRewriteHistory ON " & _ 
  120.             " Contract_detail.Contract_no = ContractRewriteHistory.ContractNo " & _
  121.              " LEFT OUTER JOIN " & _
  122.             " Contract_detail New_Contract_Detail ON " & _ 
  123.             " ContractRewriteHistory.ContractNewNo = New_Contract_Detail.Contract_no " & _
  124.         " WHERE Contract_detail.Contract_customer_id = " & Session(CUSTOMER_ID) & " " & _
  125.             " AND isnull(Contract_detail.Contract_Expired,0) = 0 AND " & _ 
  126.             " isnull(Contract_detail.ContractStatusID,0) <> 5 AND " & _
  127.             " ((isnull(Contract_detail.Contract_Rewritten, 0) = 0 OR isnull(New_Contract_Detail.Contract_bank_settlement, 0) = 0)) "
  128.  
  129.                if session("presettlement") = 0 then 
  130.                 sql = sql & " AND Contract_detail.Contract_bank_settlement > 0 "  
  131.             end if
  132.  
  133. sql = sql &_
  134.         " GROUP BY Contract_detail.Contract_no, " & _
  135.             " Contract_detail.ContractStatusID, " & _ 
  136.             " Contract_detail.Contract_commence_date, " & _ 
  137.             " Contract_detail.Contract_expiry_date, " & _ 
  138.             " Contract_detail.Contract_rental, " & _ 
  139.             " Contract_detail.Contract_assetmgmt, " & _ 
  140.             " Contract_detail.Contract_term, " & _ 
  141.             " Contract_detail.Contract_frequency, " & _ 
  142.             " Contract_detail.Contract_disc_date, " & _ 
  143.             " Contract_detail.Contract_disc_rec, " & _ 
  144.             " Contract_detail.Contract_bank_settlement " & _
  145.         " HAVING " & _
  146.             " (Contract_Detail.ContractStatusID IS NULL) OR " & _
  147.             " (Contract_detail.ContractStatusID = 1) OR " & _
  148.             " (Contract_detail.ContractStatusID = 2) OR " & _
  149.              " (Contract_detail.ContractStatusID = 3 AND SUM(isnull(Asset_Detail.Asset_purchase_price,0)) <> 0) OR " & _
  150.             " (Contract_detail.ContractStatusID = 4 AND Contract_detail.Contract_expiry_date > GETDATE()) OR " & _
  151.             " (Contract_detail.ContractStatusID = 6) OR " & _
  152.             " (Contract_detail.ContractStatusID = 7 AND " & _
  153.             "    (SUM(isnull(Asset_Detail.Asset_purchase_price,0)) <> 0 OR Contract_detail.Contract_expiry_date > GETDATE()))"
  154.  
  155.         if IsEmpty(Session("ContListSortItem")) OR (Session("ContListSortItem") = "") then
  156.             Session("ContListSortItem") = " right(Contract_Detail.Contract_no,4) asc"
  157.         end if
  158.  
  159.         sql = sql & " ORDER BY " & Session("ContListSortItem")
  160.  
  161.         Set rstContract = Server.CreateObject("ADODB.Recordset")
  162.         rstContract.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  163.         rstContract.PageSize = CONTRACTLIST_LIST_PAGE_SIZE        ' Number of records to display per page.
  164.         Set Session("rstContract") = rstContract        ' Store for fast retrieval later on.
  165.         Session("ContPage") = 1                                                    ' Start on the first page.
  166.     'else
  167.         ' Contract information already exists, retrieve it from the session object.
  168.         Set rstContract = Session("rstContract")
  169.     'end if
  170.  
  171.     ' Determine whether there is no data in the recordset at this stage. Must check for BOF
  172.     ' as well as we could be on the last page of the data, and in this case EOF would be true.
  173.     bolNoData = rstContract.EOF and rstContract.BOF
  174.  
  175.     ' Process any paging move requests.
  176.     Select Case Trim(Request("PagingMove"))
  177.         Case "Requery"
  178.             rstContract.Requery
  179.         Case "<"
  180.             If Session("ContPage") > 1 Then
  181.                 Session("ContPage") = Session("ContPage") - 1
  182.             End If
  183.         Case "<<"
  184.             Session("ContPage") = 1
  185.         Case ">"
  186.             if Session("ContPage") < rstContract.PageCount then
  187.                 Session("ContPage") = Session("ContPage") + 1
  188.             end if
  189.         Case ">>"
  190.             Session("ContPage") = rstContract.PageCount
  191.     End Select
  192.  
  193.     on Error resume next
  194.     rstContract.AbsolutePage = Session("ContPage")
  195.     Contract_asset_value=rstcontract("Contract_asset_value")
  196.     on error goto 0
  197. %>
  198. <%
  199. sql = "SELECT ControlValue " & _
  200. " from ControlData where argument = 'GST'"
  201. Set rstVat = Server.CreateObject("ADODB.Recordset")
  202. rstVat.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  203.  
  204. sql = "SELECT ControlValue " & _
  205. " from ControlData where argument = 'Country'"
  206. Set rstVatt = Server.CreateObject("ADODB.Recordset")
  207. rstVatt.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
  208.  
  209.  
  210.  
  211.  
  212. Ccountry = rstVatt("ControlValue")
  213. if Ccountry = "SA" then
  214. CountryCurrency = "R"
  215. session("CountryCurrency") = "R"
  216. end if
  217. if Ccountry = "NZ" then
  218. CountryCurrency = "$"
  219. session("CountryCurrency") = "$"
  220. end if
  221. if Ccountry = "AU" then
  222. CountryCurrency = "$"
  223. session("CountryCurrency") = "$"
  224. end if
  225. if Ccountry = "IN" then
  226. CountryCurrency = "Rs."
  227. session("CountryCurrency") = "Rs."
  228. end if
  229.  
  230.  
  231.  
  232.  
  233.     TotalClientRentalValue=0
  234.     PaymentFrequency=0
  235.     TotalContracts=0
  236.     Do While Not rstContract.EOF
  237.         TotalContracts = TotalContracts + 1
  238.         TotalClientAssetValue = TotalClientAssetValue + NZ(rstContract("Contract_Asset_Value"),0)
  239.         if rstContract("Contract_frequency") = 90 then
  240.             Quarterlycount = Quarterlycount + 1
  241.             PaymentFrequency = "Quarterly"
  242.             ContractMonths = 3
  243.         elseif rstContract("Contract_frequency") = 30 then
  244.             Monthlycount = Monthlycount + 1
  245.             PaymentFrequency = "Monthly"
  246.             ContractMonths = 1
  247.         elseif rstContract("Contract_frequency") = 180 then
  248.             HalfYearlycount = HalfYearlycount + 1
  249.             PaymentFrequency = "Half Yearly"
  250.             ContractMonths = 6
  251.         elseif rstContract("Contract_frequency") = 360 then
  252.             Yearlycount = Yearlycount + 1
  253.             PaymentFrequency = "Yearly"
  254.             ContractMonths = 12
  255.         else
  256.             PaymentFrequency = (rstContract("Contract_frequency")) & "days"
  257.             ContractMonths = 360 / rstContract("Contract_frequency")
  258.         end if
  259.  
  260.         rstContract.MoveNext
  261.     Loop
  262.  
  263.  
  264. on Error resume next
  265.     rstContract.AbsolutePage = 1
  266.     on error goto 0
  267.  
  268. %>
  269. <SCRIPT LANGUAGE='JavaScript'>
  270. <!-- hide from old browsers
  271.  
  272.     function order_by(column_order)
  273.         {
  274.         document.sortform.ContListSortItem.value=column_order;
  275.         document.sortform.submit()
  276.         }
  277.  
  278.     function first_page()
  279.         {
  280.         document.paging.PagingMove.value="first";
  281.         document.paging.submit()
  282.         }
  283.     function prev_page()
  284.         {
  285.         document.paging.PagingMove.value="prev";
  286.         document.paging.submit()
  287.         }
  288.     function next_page()
  289.         {
  290.         document.paging.PagingMove.value="next";
  291.         document.paging.submit()
  292.         }
  293.     function last_page()
  294.         {
  295.         document.paging.PagingMove.value="last";
  296.         document.paging.submit()
  297.         }
  298.     function refresh_page()
  299.         {
  300.         document.paging.PagingMove.value="requery";
  301.         document.paging.submit()
  302.  
  303.         }
  304.  
  305. // end of javascript -->
  306. </SCRIPT>
  307. <!--#INCLUDE FILE="..\Include\header.asp"-->
  308. <% If Session(ALLOW_LIFECYCLE) then %>
  309. <title>Lifecycle Management Contracts</title>
  310. <% Else %>
  311. <title>Contract Management Contracts</title>
  312. <% End if %>
  313. <% Session("active_nav")="Contracts" %>
  314. <link rel="stylesheet" href="../Contract/stylemain.css">
  315. </head>
  316. <BODY marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" BGCOLOR="#FFFFFF">
  317. <TABLE border="0" cellPadding="0" cellSpacing="0" width="100%" height="135">
  318. <TBODY>
  319. <TR>
  320. <TD align="center" vAlign="top" width="166" height="130">
  321. <img src="http://bytes.com/images/nav/logo_b.gif" width="166" border="0" height="135"></TD>
  322. <TD bgcolor="white" width="100%" align="center" valign="top" height="130">
  323. <table border="0" cellpadding="0" cellspacing="0" align="center">
  324. <tbody>
  325. <tr>
  326. <td bgcolor="silver" width="2%" height="111">
  327. &nbsp;
  328. </td>
  329. <td bgcolor="silver" width="51%" valign="top" height="111" align="center">
  330. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  331. <tr>
  332. <td colspan="3" align="center">
  333. &nbsp;
  334. </td>
  335. </tr>
  336. <tr>
  337. <td width="10" valign="top" align="right">
  338. </td>
  339. <td width="646" bgcolor="silver" valign="top" align=center>
  340.     <table border="0" cellpadding="0" cellspacing="0" class="clsArchiveTD">
  341.         <tr>
  342.             <td colspan=3 align=center>
  343.                 <font face="Verdana, Arial, Helvetica, sans-serif"><b><font color="#ffffff">
  344.                     Contract Summary
  345.                     <%'=session("privileges")%>
  346.                 </font></b></font>
  347.             </td>
  348.         </tr>
  349.         <tr>
  350.             <td width=160>
  351.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  352.                     Total asset value:
  353.                 </font>
  354.             </td>
  355.             <td width=15>
  356.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  357.                     <%=CountryCurrency%> 
  358.                 </font>
  359.             </td>
  360.             <td align=right>
  361.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  362.                     <%= Formatnumber(TotalClientAssetValue)%>
  363.                 </font>
  364.             </td>
  365.         </tr>
  366.         <tr>
  367.             <td>
  368.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  369.                     <%'-----get the heading from the java at the bottom%>
  370.                     Total rental
  371.                 </font>
  372.             </td>
  373.             <td>
  374.                 <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
  375.                     <%=CountryCurrency%>
  376.                 </font>
  377.             </td>
  378.             <td align=right> 
  379.                 <%'-----get the total from the java at the bottom%>
  380.                 <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
  381.                     <div id="rrental" name="rrental">
  382.                     </div>
  383.                 </font>
  384.             </td>
  385.         </tr>
  386.         <tr>
  387.             <td>
  388.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  389.                     Number of contracts:
  390.                 </font>
  391.             </td>
  392.             <td colspan=2>
  393.                 <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
  394.                     <%=TotalContracts%>
  395.                 </font>
  396.             </td>
  397.         </tr>
  398.         <tr>
  399.             <td>
  400.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  401.                     Notice period:
  402.                 </font>
  403.             </td>
  404.             <td colspan=2>
  405.                 <font face="Verdana, Arial, Helvetica, sans-serif">
  406.                     <%=Session("CustomerNotice")%> days
  407.                 </font>
  408.             </td
  409.         </tr>
  410.     </table>
  411.  
  412. </td>
  413. <td width="27" valign="top" align="left">
  414. </td>
  415. </tr>
  416. <tr>
  417. <td colspan="3" align="center">
  418. <img src="http://bytes.com/submit/images/transparent.gif" width="2" height="2" border="0">
  419. </td>
  420. </tr>
  421. </table>
  422. </td>
  423. <td bgcolor="silver" width="1%" valign="top" height="111">
  424. &nbsp;
  425. </td>
  426. <td bgcolor="silver" width="46%" height="111" valign="top" align="center">
  427. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  428. <tr>
  429. <td colspan="3" align="center">
  430. &nbsp;
  431. </td>
  432. </tr>
  433. <tr>
  434. <td width="5%" align="right" valign="top">
  435. </td>
  436. <td width="90%" valign="top">
  437. <table border="0" cellpadding="0" cellspacing="0" width="100%" class="SmallText">
  438. <tr align="center">
  439. <th align="left" nowrap width="100%" colspan="2">
  440. <font face="Verdana, Arial, Helvetica, sans-serif"><b><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To Contact Us</font></b></font>
  441. </th>
  442. </tr>
  443. <tbody>
  444. <tr>
  445. <td width="50">
  446. <font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Name:</font>
  447. </td>
  448. <td>
  449. <font face="Verdana, Arial, Helvetica, sans-serif">
  450. <% on error resume next
  451.                         name = rstStaffContact("Staff_Name")
  452.                         pos = instr(1,rstStaffContact("Staff_Name"),",")
  453.                         if pos <> 0 then
  454.                             'name = right(rstStaffContact("Staff_Name"),len(rstStaffContact("Staff_Name"))-pos) + " " + left(rstStaffContact("Staff_Name"),pos - 1)                                                            
  455.                         else
  456.                             name = rstStaffContact("Staff_Name")
  457.                         end if
  458. %>
  459. <%= name %>
  460. </font>
  461. </td>
  462. </tr>
  463. <tr>
  464. <td width="50">
  465. <font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Phone:</font>
  466. </td>
  467. <%if isnull((rstStaffContact("Staff_phone"))) then
  468.                         staff_phone = "+91 22 6761 6400" 
  469.                         else 
  470.                         staff_phone = rstStaffContact("Staff_phone")
  471.                       end if
  472.  
  473.                       %>
  474. <td>
  475. <font face="Verdana, Arial, Helvetica, sans-serif">
  476. <%= staff_phone %>
  477. </font>
  478. </td>
  479. </tr>
  480. <tr>
  481. <td width="50">
  482. <font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Fax:</font>
  483. </td>
  484. <%if isnull((rstStaffContact("Staff_fax"))) then
  485.                         staff_fax = "+91 22 6695 0590" 
  486.                         else 
  487.                         staff_fax = rstStaffContact("Staff_fax")
  488.                       end if
  489.  
  490.                       %>
  491. <td>
  492. <font face="Verdana, Arial, Helvetica, sans-serif">
  493. <%= staff_fax %>
  494. </font>
  495. </td>
  496. </tr>
  497. <tr>
  498. <td width="50">
  499. <font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Mobile:</font>
  500. </td>
  501. <td>
  502. <font face="Verdana, Arial, Helvetica, sans-serif">
  503. <%= rstStaffContact("Staff_cell") %>
  504. </font>
  505. </td>
  506. </tr>
  507. <tr>
  508. <td width="50">
  509. <font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Email:</font>
  510. </td>
  511. <td>
  512. <font face="Verdana, Arial, Helvetica, sans-serif"><a href="mailto:<%= rstStaffContact("staff_email")%>"><font face="Verdana, Arial, Helvetica, sans-serif" color="Navy">
  513. <b>
  514. <%= rstStaffContact("Staff_email")%>
  515. </b></font></a></font>
  516. </td>
  517. </tr>
  518. </tbody>
  519. </table>
  520. </td>
  521. <td width="5%" valign="top" align="left">
  522. </td>
  523. </tr>
  524. <tr>
  525. <td colspan="3" align="center">
  526. <img src="http://bytes.com/submit/images/transparent.gif" width="200" height="8" border="0">
  527. </td>
  528. </tr>
  529. </table>
  530. </td>
  531. </tr>
  532. <tr bgcolor="white" valign="top" align="right">
  533. <td colspan="4">
  534. <table bgcolor="#e5e5e5" cellpadding="0" cellspacing="0" border="0">
  535. <tr>
  536. <td height="20">
  537. <div align="right">
  538. <a href="javascript:window.print()"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#2C85B1"><b>Print</b></font></a> 
  539. | <a href="javascript:refresh_page()"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#2C85B1"><b>Refresh</b></font></a>
  540. </div>
  541. </td>
  542. </tr>
  543. </table>
  544. </td>
  545. </tr>
  546. </tbody>
  547. </table>
  548. </TD>
  549. <TD width="1" align="left" valign="bottom" bgcolor="white" height="130">
  550. <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100">
  551. </table>
  552. </TD>
  553. </TR>
  554. </TBODY>
  555. </TABLE>
  556. <table width="100%" border="0" cellspacing="0" cellpadding="0" height="82%">
  557. <tr>
  558. <td width="168" valign="top" height="100%">
  559. <table width="166" border="0" cellspacing="0" cellpadding="0" height="100%">
  560. <tr>
  561. <td width="166" height="100%" background="../../images/nav/new_b.jpg" valign="top">
  562. <br>
  563. <!-- navbar begin -->
  564. <!-- left navigation -->
  565. <!--#INCLUDE FILE="../include/inc_menu.asp"-->
  566. </td>
  567. </tr>
  568. </table>
  569.  <form name="paging" action="../contract/contlist_contract2.asp" method="POST">
  570.             <input type="hidden" name="PagingMove">
  571.           </form>
  572.  
  573. </td>
  574. <td valign="top" height="645">
  575. <form name="sortform" ACTION="../Contract/contlist_contract2.asp" METHOD="POST">
  576. <br>
  577. <br>
  578. <table width="50%" border="0" cellpadding="0" cellspacing="0">
  579. <tr>
  580. <td height="10" width="2%">
  581. &nbsp;
  582. </td>
  583. <td height="10" width="98%">
  584. <p>
  585. <font face="Arial" size="3" color="#808080"><strong>View your contracts</strong></font>
  586. </p>
  587. </td>
  588. </tr>
  589. </table>
  590.  
  591. <p>
  592. <INPUT TYPE="hidden" NAME="ContListSortItem" value="">
  593. </p>
  594. </form>
  595. <table CELLPADDING="1" CELLSPACING="1" WIDTH="100%" border="0">
  596. <tr bgcolor="#B0C5D4">
  597. <td bgcolor="#bfd0df">
  598. <center>
  599. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by(' right(contract_detail.Contract_no ,4) asc')"><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Contract No in ascending order" align="middle" border="0" width="13" height="9"></a>
  600. <a href="javascript:order_by('right(contract_detail.Contract_no,4) desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Contract No in descending order" align="middle" border="0" width="13" height="9"></a>
  601. <br>
  602. <font color="#000000">Contract No</font> </b></font>
  603. </center>
  604. </td>
  605. <td bgcolor="#bfd0df">
  606. <center>
  607. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by('Contract_Detail.Contract_Commence_Date asc')">
  608. <img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Start Date  in ascending order" align="middle" border="0" width="13" height="9"></a>
  609. <a href="javascript:order_by('contract_detail.Contract_Commence_Date desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Start Date  in descending order" align="middle" border="0" width="13" height="9"></a>
  610. <br>
  611. <font color="#000000">Start Date</font> </b></font>
  612. </center>
  613. </td>
  614. <td bgcolor="#bfd0df">
  615. <center>
  616. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by('contract_detail.Contract_Expiry_Date asc')">
  617. <img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by End Date in ascending order" align="middle" border="0" width="13" height="9"></a>
  618. <a href="javascript:order_by('contract_detail.Contract_Expiry_Date desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by End Date in descending order" align="middle" border="0" width="13" height="9"></a>
  619. <br>
  620. <font color="#000000">End Date</font> </b></font>
  621. </center>
  622. </td>
  623. <td bgcolor="#bfd0df">
  624. <center>
  625. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by('contract_detail.Contract_term asc')"><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Term in ascending order" align="middle" border="0" width="13" height="9"></a>
  626. <a href="javascript:order_by('contract_detail.Contract_term desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Term in descending order" align="middle" border="0" width="13" height="9"></a>
  627. <br>
  628. <font color="#000000">Term</font></b> </font>
  629. </center>
  630. </td>
  631. <td bgcolor="#bfd0df">
  632. <center>
  633. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by('contract_detail.Contract_asset_value asc')">
  634. <img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Value in ascending order" align="middle" border="0" width="13" height="9"></a>
  635. <a href="javascript:order_by('contract_detail.Contract_asset_value desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Value in descending order" align="middle" border="0" width="13" height="9"></a>
  636. <br>
  637. <font color="#000000">Asset Value</font> </b></font>
  638. </center>
  639. </td>
  640. <td bgcolor="#bfd0df">
  641. <center>
  642. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by('contract_detail.Contract_rental asc')"><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Rental in ascending order" align="middle" border="0" width="13" height="9"></a>
  643. <a href="javascript:order_by('contract_detail.Contract_rental desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Rental in descending order" align="middle" border="0" width="13" height="9"></a>
  644. <br>
  645. <font color="#000000">Rental</font> </b></font>
  646. </center>
  647. </td>
  648. <td bgcolor="#bfd0df">
  649. <center>
  650. <font face="Verdana, Arial, Helvetica, sans-serif"><b><a href="javascript:order_by('contract_detail.Contract_frequency asc')"><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Payment in ascending order" align="middle" border="0" width="13" height="9"></a>
  651. <a href="javascript:order_by('contract_detail.Contract_frequency desc')"><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Payment in descending order" align="middle" border="0" width="13" height="9"></a>
  652. <br>
  653. <font color="#000000">Payment</font> </b></font>
  654. </center>
  655. </td>
  656. </tr>
  657. <%if bolNoData then%>
  658. <tr>
  659. <td colspan="4">
  660. There are no contracts to display.
  661. </td>
  662. </tr>
  663. <%else
  664.     BgColour = BGColourA
  665.     intRecordsPrinted = 0
  666.     intRecordNo = ((Session("ContPage") - 1) * CONTRACTLIST_LIST_PAGE_SIZE) + 1
  667.     if not blnNoData then
  668.         rstContract.MoveFirst 
  669.         Do While Not rstContract.EOF
  670.             if rstContract("Contract_frequency") = 90 then
  671.                 PaymentFrequency = "Quarterly"
  672.                 ContractMonths = 3
  673.             elseif rstContract("Contract_frequency") = 30 then
  674.                 PaymentFrequency = "Monthly"
  675.                 ContractMonths = 1
  676.             elseif rstContract("Contract_frequency") = 180 then
  677.                 PaymentFrequency = "Half Yearly"
  678.                 ContractMonths = 6
  679.             elseif rstContract("Contract_frequency") = 360 then
  680.                 PaymentFrequency = "Yearly"
  681.                 ContractMonths = 12
  682.             else
  683.                 PaymentFrequency = (rstContract("Contract_frequency")) & "days"
  684.                 ContractMonths = 360 / rstContract("Contract_frequency")
  685.             end if
  686.  
  687.             SSQL = "SELECT isnull(cashflowdate,0) as cashflowdate,isnull(cashflowamount,0) as cashflowamount,isnull(cashflowfid,0) as cashflowfid,isnull(cashflowstampduty,0) as cashflowstampduty from contract_cashflow where " & _
  688.             "cashflowcontractno ='" & RSTCONTRACT("CONTRACT_NO") & "' and cashflowdate between getdate() and dateadd(m, " & ContractMonths & ",getdate())"
  689.  
  690.             Set rstCASHFLOW = Server.CreateObject("ADODB.Recordset")
  691.             rstCASHFLOW.Open ssql, objRIMSConn, adOpenKeyset, adLockOptimistic
  692.  
  693.             if not rstCASHFLOW.EOF then
  694.                     rental = rstCASHFLOW("cashflowamount") + rstCASHFLOW("cashflowfid") + rstCASHFLOW("cashflowstampduty") 
  695.             else
  696.                 SSQL = "SELECT isnull(cashflowdate,0) as cashflowdate,isnull(cashflowamount,0) as cashflowamount,isnull(cashflowfid,0) as cashflowfid,isnull(cashflowstampduty,0) as cashflowstampduty from contract_cashflow where " & _
  697.                 "cashflowcontractno ='" & RSTCONTRACT("CONTRACT_NO") & "' and cashflowdate = (select max (cashflowdate) from contract_cashflow where cashflowcontractno ='" & RSTCONTRACT("CONTRACT_NO") & "' ) "
  698.                 'Response.Write ssql    
  699.                 Set rstCASHFLOW = Server.CreateObject("ADODB.Recordset")
  700.                 rstCASHFLOW.Open ssql, objRIMSConn, adOpenKeyset, adLockOptimistic
  701.  
  702.                 on error resume next 'Code by Dan to fix error
  703.                 rental = rstCASHFLOW("cashflowamount")
  704.                 rental = rental + rstCASHFLOW("cashflowfid")
  705.                 rental = rental + rstCASHFLOW("cashflowstampduty")
  706.             end if
  707.  
  708.             constatusid = rstContract("ContractStatusID")
  709.             contractvaluest = rstContract("Contract_Asset_Value")
  710.             if isnull(contractvaluest) then 
  711.                 contractvaluest = 0
  712.             end if 
  713.  
  714.             TotalClientRentalValue=TotalClientRentalValue + rental
  715.             rentalQuarterlytotal = rentalQuarterlytotal + rentalQuarterlytotall
  716.  
  717.             If intRecordsPrinted = CONTRACTLIST_LIST_PAGE_SIZE then        ' Printed all contracts in this page.
  718.                 exit do
  719.             End If%>
  720.  
  721.  
  722.     <tr bgcolor="<%=BgColour%>">
  723.     <td ALIGN="left" VALIGN="top" nowrap bgcolor="#000080">
  724.     <a href="contdetail_contract2.asp?Contract_no=<%=rstContract("contract_no")%>">
  725.     <%=rstContract("Contract_no")%>
  726.     &nbsp; </a>
  727.     </td>
  728.     <td align="center" valign="top" bgcolor="<%=BgColour%>">
  729.     <% If rstContract("Contract_Commence_Date") Then %>
  730.         <%= FormatDateTime(rstContract("Contract_Commence_Date"),vbShortDate) %>
  731.     <% end if %>
  732.     </td>
  733.     <td align="center" valign="top" nowrap bgcolor="<%=BgColour%>">
  734.     <% If rstContract("Contract_Expiry_Date") Then %>
  735.     <%=FormatDateTime(rstContract("Contract_Expiry_Date"),vbShortDate) %>
  736.     &nbsp;
  737.     <% end if %>
  738.     </td>
  739.     <td align="right" valign="top" nowrap bgcolor="<%=BgColour%>">
  740.     <%=rstContract("Contract_term") %>
  741.     &nbsp; months
  742.     </td>
  743.     <%if rstContract("Contract_Asset_Value") <> "" then%>
  744.     <td align="right" valign="top" nowrap bgcolor="<%=BgColour%>">
  745.     <%=CountryCurrency%>
  746.     <%=FormatNumber(rstContract("Contract_Asset_Value"),2) %>
  747.     &nbsp;
  748.     </td>
  749.     <%else%>
  750.     <td align="right" valign="top" nowrap bgcolor="<%=BgColour%>">
  751.     <%=CountryCurrency%>
  752.     <%=FormatNumber(0,2) %>
  753.     &nbsp;
  754.     </td>
  755.     <%end if%>
  756.     <td align="right" valign="top" nowrap bgcolor="<%=BgColour%>">
  757.     <%=CountryCurrency%>
  758.     <%=FormatNumber(rental,2)%>
  759.     &nbsp;
  760.     </td>
  761.     <%
  762.         if rstContract("Contract_frequency") = 90 then
  763.             PaymentFrequency = "Quarterly"
  764.         elseif rstContract("Contract_frequency") = 30 then
  765.             PaymentFrequency = "Monthly"
  766.         elseif rstContract("Contract_frequency") = 360 then
  767.             PaymentFrequency = "Yearly"
  768.         else
  769.             PaymentFrequency = int(rstContract("Contract_frequency"))
  770.         end if
  771.  
  772.     %>
  773.     <td align="center" valign="top" nowrap bgcolor="<%=BgColour%>">
  774.     <%=PaymentFrequency%>
  775.     &nbsp;
  776.     </td>
  777.     </tr>
  778.     <%
  779.                 if BgColour = BGColourA then
  780.                     BgColour = BGColourB
  781.                 else
  782.                     BgColour = BGColourA
  783.                 end if
  784.                 intRecordsPrinted = intRecordsPrinted + 1
  785.                 intRecordNo = intRecordNo + 1
  786.  
  787.             %>
  788.     <%
  789.             rstContract.MoveNext
  790.         Loop
  791.     end if        
  792. end if%>
  793. </table>
  794. </td>
  795. </tr>
  796. <% 
  797.       %>
  798. </table>
  799. <%'ccm----this sends the topmenu the total and heading  Quarterly,montly or yearly%>
  800. <script>
  801.  
  802.     window.rrental.innerHTML  = '<%=formatnumber(TotalClientRentalValue,2)%>';
  803.  
  804. </script>
  805. <%'-------ccm%>
  806. <%
  807.     'objRIMSConn.Close
  808.     'Set objRIMSConn = nothing
  809. %>
Feb 20 '12 #1
0 1827

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vincento Harris | last post by:
sql server 2000 8.00.194 Microsoft Windows 2000 Service Pack 2 I looked into my sqlserver agent log and found the following ODBC Error 0 Timeout expired logon to server local '( failed)' ...
2
by: efinney | last post by:
Hi, Has anyone ever had trouble using the query analyzer tool through a vpn client? I'm able to connect outside of work to a sqlserver db on my company lan with enterprise mgr, but the query...
1
by: kamel | last post by:
hello all, my configuration is: Sql 2000 SP3, OS win2003 server when i try a query with enterprise manager the error message appaers timeout expired i verify all components ( query time...
4
by: hb | last post by:
Hi, I got the "System.Data.SqlClient.SqlException: Timeout expired. " error on my web application while saving some data. Would you please tell me how to change the settings in SQL Server...
1
by: Freddy | last post by:
Hi, I have a .aspx page and a .net assembly. The code wihich accesses the database and returns a dataset is present in a function within the assembly. When I try to access this function and try...
3
by: Nils Magnus Englund | last post by:
Hi, I've made a HttpModule which deals with user authentication. On the first request in a users session, it fetches data from a SQL Server using the following code: using (SqlConnection...
4
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying...
1
by: Ron | last post by:
Hi, I had a stored procedure on SQL 2000 server to run calculation with large amount of data. When I called this stored procedure via System.Data.SqlClient.SqlCommand on production, i got error...
3
by: Brad | last post by:
I have been trying to do a query(view) in Enterprise Manger and Query Analyzer with a timeout result everytime. In EM in happens in about 30 seconds and in QA it happens in about 45 seconds. I...
1
by: Simon Wigzell | last post by:
Occassionaly I get the following error, always when storing a record: Microsoft OLE DB Provider for ODBC Drivers error '80040e31' Timeout expired Googling around I see ways of setting the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.