/beta/AR/include_SelectAccount.asp
ASP | 177 lines | 151 code | 11 blank | 15 comment | 28 complexity | f75b5ad37ed7ffa02173b8d4c3539487 MD5 | raw file
1<% 2' This Include File Needs Following Variables to have values: 3' 4' SA_Action (the Action of the Suubmit Button) 5' SA_TitleOrName (AccountTitle or Name to be searched) 6' SA_SearchAgainURL () 7' SA_StepText (e.g. '��� ��� :') 8' SA_ActName (e.g. 'submitsearch') 9' SA_SearchBox (e.g. 'CustomerNameSearchBox') 10' SA_IsVendor (is 1 or 0) 11' 12' 13if SA_ActName="" then SA_ActName="submitsearch" 14if SA_SearchBox="" then SA_SearchBox="CustomerNameSearchBox" 15 16 SA_RecordLimit = 20 17 18 if SA_IsVendor = 1 then 19 extraConditions = " and [type]=1 " 20 else 21 extraConditions = " " 22 end if 23 24 Set SA_RS1 = Server.CreateObject("ADODB.Recordset") 25 SA_RS1.CursorLocation=3 '---------- Alix: Because in ADOVBS_INC adUseClient=3 26 27 SA_RS1.PageSize = SA_RecordLimit 28 29 SA_mySQL="SELECT Accounts.*, Users.RealName AS CSRName FROM Accounts LEFT OUTER JOIN Users ON Accounts.CSR = Users.ID WHERE (REPLACE(Accounts.AccountTitle, ' ', '') LIKE REPLACE(N'%"& sqlSafe(SA_TitleOrName) & "%', ' ', ''))"& extraConditions & " ORDER BY Accounts.AccountTitle" 30'response.write SA_mySQL 31' SA_RS1.Open SA_mySQL ,Conn,adOpenStatic,,adcmdcommand 32 SA_RS1.Open SA_mySQL ,Conn,3,,adcmdcommand 33 FilePages = SA_RS1.PageCount 34 35 Page=1 36 if isnumeric(Request.QueryString("p")) then 37 if (clng(Request.QueryString("p")) <= FilePages) and clng(Request.QueryString("p") > 0) then 38 Page=clng(Request.QueryString("p")) 39 end if 40 end if 41 42 if not SA_RS1.eof then 43 SA_RS1.AbsolutePage=Page 44 end if 45 46 if (SA_RS1.eof) then 47 ' Not Found 48 conn.close 49 response.redirect "?errmsg=" & Server.URLEncode("���� ����� ���� ���.<br><a href='../CRM/AccountEdit.asp?act=getAccount'>���� ���Ͽ</a>") 50 end if %><br> 51 <div dir='rtl'><B><%=SA_StepText%></B> 52 </div><br> 53<!-- ������ ���� --> 54 <table style="font-family:tahoma;font-size:9pt; border:1 dashed #888888; direction:RTL;" align="center" Width="90%" Cellspacing="0" Cellpadding="5"> 55 <tbody id="AccountsTable"> 56 <tr bgcolor='#33AACC'> 57 <td style="width:10px;"> # </td> 58 <td><INPUT TYPE="radio" NAME="O" checked disabled></td> 59 <td> ����� ���� </td> 60 <td> ��� ����</td> 61 <td> ��� ���� ��� </td> 62 <td width='50px'> ����� ������ </td> 63 <td width='70px'> ����� ����</td> 64 <td width='70px'> ����� ����</td> 65 </tr> 66 <% 67 SA_tempCounter= (Page - 1 ) * SA_RecordLimit 68 while Not ( SA_RS1.EOF) and (SA_RS1.AbsolutePage = Page) 69 'SA_OldAccountNo=SA_RS1("ACCID") 70 SA_AccountNo=SA_RS1("ID") 71 SA_AccountTitle=SA_RS1("AccountTitle") 72 SA_totalBalance=SA_RS1("ARBalance") 73 SA_totalBalanceAP=SA_RS1("APBalance") 74 SA_totalBalanceAO=SA_RS1("AOBalance") 75 if SA_RS1("Type") = 1 then 76 SA_AccountTitle = SA_AccountTitle & " (�������) " 77 end if 78 if isnull(SA_totalBalance) then 79 SA_totalBalance=0 80 SA_totalBalanceText="<i>N / A</i>" 81 SA_tempBalanceColor="gray" 82 else 83 SA_totalBalanceText=Separate(SA_totalBalance) 84 if (cdbl(SA_totalBalance) >= 0 )then 85 SA_tempBalanceColor="green" 86 else 87 SA_tempBalanceColor="red" 88 end if 89 end if 90 SA_tempCounter=SA_tempCounter+1 91 if (SA_tempCounter Mod 2 = 1)then 92 SA_tempColor="#FFFFFF" 93 else 94 SA_tempColor="#DDDDDD" 95 end if 96 97 %> <tr> 98 <td style="border-bottom: solid 1pt black"><%=SA_tempCounter %> </td> 99 <td style="border-bottom: solid 1pt black;"><INPUT TYPE="radio" NAME="selectedCustomer" Value="<%=SA_RS1("ID")%>" <% if SA_RS1("status")="3" then %> disabled <% end if %> onclick="okToProceed=true;setColor(this)" ></td> 100 <td style="border-bottom: solid 1pt black"> 101 <%if Auth(1 , 1) then %> 102 <A href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=SA_AccountNo%>" target='_blank'><%=SA_AccountTitle%></A> <% if SA_RS1("status")="3" then %> <FONT COLOR="red"><B>�����</B></FONT> <% end if %> 103 <%else 104 response.write SA_AccountTitle 105 end if%> 106 </td> 107 <td style="border-bottom: solid 1pt black;"><%=SA_RS1("�CompanyName")%> </td> 108 <td style="border-bottom: solid 1pt black"><%=SA_RS1("Dear1")& " " & SA_RS1("FirstName1")& " " & SA_RS1("LastName1")%> </td> 109 <td style="border-bottom: solid 1pt black"><B><FONT Color='blue'><%=SA_RS1("CSRName")%></FONT></B> </td> 110 <td style="border-bottom: solid 1pt black; direction:LTR; text-align:right;"><FONT COLOR="<%=SA_tempBalanceColor%>"><%=SA_totalBalanceText%></FONT> </td> 111 <td style="border-bottom: solid 1pt black; direction:LTR; text-align:right;"><FONT COLOR="black"><%=Separate(SA_totalBalanceAP)%></FONT> </td> 112 </tr> 113 <% SA_RS1.movenext 114 wend 115 %> 116 <tr bgcolor='#33AACC'> 117 <td align='right' colspan=3> 118 <INPUT class="GenButton" TYPE="submit" name="submitSelection" value="������" onclick="<%=SA_Action%>"> 119 120 <SCRIPT LANGUAGE="JavaScript"> 121 <!-- 122 if (! window.dialogArguments){// if this is NOT a modal window 123 document.write(' <INPUT class="GenButton" TYPE="button" name="submitSelection" value="����" onclick="window.location=\'../CRM/AccountEdit.asp?act=getAccount\'">'); 124 } 125 //--> 126 </SCRIPT> 127 </td> 128 <td align='center' colspan="7" dir="RTL"> <span id="sa_links"> 129 <% 130 if FilePages>1 then 131 response.write "���� " 132 for i=1 to FilePages 133 if i = page then %> 134 [<%=i%>] 135<% else%> 136 <A HREF="?p=<%=i%>&<%=SA_SearchBox%>=<%=SA_TitleOrName%>&act=<%=SA_ActName%>"><%=i%></A> 137<% end if 138 next 139 end if 140%> 141 </span></td> 142 </tr> 143 </tbody> 144 </table> 145<SCRIPT LANGUAGE="JavaScript"> 146<!-- 147function setColor(obj) 148{ 149 for(i=0; i<document.all.selectedCustomer.length; i++) 150 { 151 theTR = document.all.selectedCustomer[i].parentNode.parentNode 152 theTR.setAttribute("bgColor","#C3DBEB") 153 } 154 theTR = obj.parentNode.parentNode 155 theTR.setAttribute("bgColor","#FFFFFF") 156} 157i=0; 158 159do { 160 radio1=document.getElementsByName("selectedCustomer")[i]; 161 i++; 162} while (radio1.disabled && i<document.getElementsByName("selectedCustomer").length) 163if (!radio1.disabled){ 164 radio1.checked=true; 165 okToProceed=true; 166 setColor(radio1); 167 if (window.dialogArguments){// if this is a modal window 168 if (document.all.selectedCustomer.length==<%=SA_RecordLimit%>) 169 document.getElementById("sa_links").innerText="����� ���� �� ����� �� ��� ��� ... ����� �� ����� �� ����"; 170 else 171 document.getElementById("sa_links").innerText=""; 172 }else{ 173 radio1.focus(); 174 } 175} 176//--> 177</SCRIPT>