cancel
Showing results for 
Search instead for 
Did you mean: 

customer search

c_oudeluttikhuis
Explorer
0 Kudos

hello,

i have a problem with searching accounts in the customer page under the focus menu. the problem is that this person has about 15.000 accounts and he doesn't want to go through all of them everytime he wants to select a specific account.

is it possible to make a search field in customers.ascx that can filter only the customer(account) or part of the customers name?

kind regards,

C. Oude Luttikhuis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Would the focus search block in the top slot of the focus theme work?

You can enter part of a customer name or number and get a result set

c_oudeluttikhuis
Explorer
0 Kudos

thnx for the reply, but no the focusblock doesnt work, i've tried that before. the problem with the focussearchblock is, it searches through accounts and not customers. and there are multiple sales people and they have to be restricted to see all accounts.

i already tried to adjust the focussearchblock but without succes.

any help would be appreciated.

greets,

C. Oude Luttikhuis

Former Member
0 Kudos

Hi C. Oude,

What sort of filter exacty are you looking for?

Unfortunatley I'm kind of busy at the moment but if its something simple I might be able to help.

Regards,

Steve

c_oudeluttikhuis
Explorer
0 Kudos

by the way stephen byrne, i only need a filter that searches the page with the letters the type in the search box.

e.g. if they want to find a customer "Pete's autoshop" they can type [pe] and then it list all accounts that starts with pe, so they can search a little faster.

(this company has a lot of accounts so they dont want the search the whole list everytime because it has mostly bout 20-30 pages per salesperson in netpoint.)

thanks,

Coen

c_oudeluttikhuis
Explorer
0 Kudos

i have created a new aspx file with the search function, the only problem i now have is how to get data from the textbox into the new aspx file. In asp.net 2.0 its not that hard but i havent got a way to do this in asp.net 1.1 can anyone help me how to realize this.

so far i have completed this code into Customers.aspx

<asp:TextBox id="txtAccounts" visible="true" Runat="server" Columns="16" ></asp:TextBox>

<ahref="NPsearchResults.aspx"><IM G alt="" src="~/assets/common/icons/search.gif" runat="server" /></a>

which redirects to NPSearchResults.aspx (i have used HTML cause <asp:Button ID="btnGo" runat="server" OnClick="btnGo_Click" Text="GO" PostBackUrl="NPSearchResults.aspx" /> doesnt work in 1.1)

this is the code from NPSearchResults.aspx

<%@ Page language="c#" AutoEventWireup="false"%>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.SqlClient" %>

<script runat="server">

override protected void OnInit(EventArgs e)

{

InitializeComponent();

base.OnInit(e);

}

private void InitializeComponent()

{

this.Load += new System.EventHandler(this.Page_Load);

}

private void Page_Load(object sender, System.EventArgs e)

{

GetAccountsBySalesPerson();

}

private DataTable GetAccountsBySalesPerson()

{

try

{

using(SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=netpoint2;User Id=sa;Password=agion2c"))

{

SqlDataAdapter adapter = new SqlDataAdapter(CreateQuery("manager"), conn);

DataTable table = new DataTable();

adapter.Fill(table);

DataGrid1.DataSource = table;

DataGrid1.DataBind();

}

}

catch (Exception ex)

{

Response.Write("Exception!!!!! \n" + ex);

}

return null;

}

private string CreateQuery(string userid)

{

StringBuilder builder = new StringBuilder();

//builder.Append("SELECT * FROM UsersAccount");

string text = "";//includeInactive ? "" : "ua.Active = 'Y' AND";

builder.Append("SELECT ua.AccountID, ua.AccountName, ua.Phone1, ua.EmailAddress, ua.Website, ua.MainContactID, ua.DefaultBillAddressID, ");

builder.Append("(SELECT COUNT(EventID) FROM Events WHERE AccountID = ua.AccountID AND StatusCode = 'O') OpenActivitiesCount, ");

builder.Append("(SELECT COUNT(TicketID) FROM SupportTickets WHERE AccountID = ua.AccountID AND TicketStatus = 'open' AND ParentID IS NULL) OpenTicketsCount, ");

builder.Append("(SELECT COUNT(OpportunityID) FROM Opportunity WHERE AccountID = ua.AccountID AND ClosedDate IS NULL) OpenOpportunitiesCount, ");

builder.Append("(SELECT COUNT(GrandTotal) FROM OrderMaster WHERE AccountID = ua.AccountID AND CartType = 'Q') OpenQuotesCount, ");

builder.Append("(SELECT SUM(GrandTotal) FROM OrderMaster WHERE AccountID = ua.AccountID AND CartType = 'O' AND PurchaseDate BETWEEN dateadd(d, -30, getdate()) AND getdate()) Orders30, ");

builder.Append("(SELECT SUM(GrandTotal) FROM OrderMaster WHERE AccountID = ua.AccountID AND CartType = 'O' AND PurchaseDate BETWEEN dateadd(d, -60, getdate()) AND dateadd(ms, -1, dateadd(d, -30, getdate()))) Orders60, ");

builder.Append("(SELECT SUM(GrandTotal) FROM OrderMaster WHERE AccountID = ua.AccountID AND CartType = 'O' AND PurchaseDate BETWEEN dateadd(d, -90, getdate()) AND dateadd(ms, -1, dateadd(d, -60, getdate()))) Orders90, ");

builder.Append("(SELECT SUM(GrandTotal) FROM OrderMaster WHERE AccountID = ua.AccountID AND CartType = 'O' AND PurchaseDate < dateadd(d, -90, getdate())) Orders90Plus ");

builder.Append("FROM UsersAccount ua ");

if ((userid != null) && (userid.Length > 0))

{

builder.Append("WHERE " + text + " ua.AccountID IN (");

builder.Append("SELECT AccountID FROM UsersAccountSalesPerson WHERE SalesPerson = '");

builder.Append(userid);

builder.Append("')");

}

else

{

builder.Append("WHERE " + text + " NOT ua.AccountType = 'C'");

}

if ((userid != null) && (userid.Length > 0))

{

builder.Append("AND ua.AccountID IN ( SELECT AccountID FROM UsersAccountSalesPerson )");

}

builder.Append("ORDER BY ua.AccountID");

return builder.ToString();

}

</script>

<HTML>

<HEAD>

<title>WebForm1</title>

<LINK HREF="../assets/common/themes/Focus5/theme.css" REL="stylesheet" TYPE="text/css">

<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">

<meta name="CODE_LANGUAGE" Content="C#">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<asp:datagrid id="DataGrid1" PageSize="50" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"

Width="100%" runat="server">

<ItemStyle CssClass="npadminbody"></ItemStyle>

<AlternatingItemStyle CssClass="npadminbodyalt"></AlternatingItemStyle>

<HeaderStyle CssClass="npadminsubheader"></HeaderStyle>

<Columns>

<asp:HyperLinkColumn DataTextField="AccountName" HeaderText="colName" SortExpression="AccountName" DataNavigateUrlField="AccountID"

DataNavigateUrlFormatString="~/admin/common/accounts/AccountInfo.aspx?accountid="></asp:HyperLinkColumn> <asp:BoundColumn DataField="Phone1" HeaderText="colPhone" SortExpression="Phone1"></asp:BoundColumn> <asp:HyperLinkColumn Text="<img src=../assets/common/icons/email.gif border=0>" DataNavigateUrlField="AccountID" DataNavigateUrlFormatString="~/dashboard/EmailDetail.aspx?accountid=">

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</asp:HyperLinkColumn>

<asp:HyperLinkColumn DataTextField="OpenActivitiesCount" HeaderText="colActivities" SortExpression="OpenActivitiesCount"

DataTextFormatString="" DataNavigateUrlField="AccountID" DataNavigateUrlFormatString="~/admin/common/accounts/AccountActivities.aspx?section=EV&accountid=">

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</asp:HyperLinkColumn>

<asp:HyperLinkColumn DataTextField="OpenTicketsCount" HeaderText="colTickets" SortExpression="OpenTicketsCount"

DataTextFormatString="" DataNavigateUrlField="AccountID" DataNavigateUrlFormatString="~/admin/common/support/tickets.aspx?status=open&accountid=">

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</asp:HyperLinkColumn>

<asp:HyperLinkColumn DataTextField="OpenOpportunitiesCount" HeaderText="colOpportunities" DataTextFormatString="" SortExpression="OpenOpportunitiesCount" DataNavigateUrlField="AccountID" DataNavigateUrlFormatString="~/admin/common/accounts/AccountTransactions.aspx?section=OP&accountid=">

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</asp:HyperLinkColumn>

<asp:HyperLinkColumn DataTextField="OpenQuotesCount" HeaderText="colQuotes" DataTextFormatString="" SortExpression="OpenQuotesCount" DataNavigateUrlField="AccountID" DataNavigateUrlFormatString="~/admin/common/accounts/AccountTransactions.aspx?section=QU&accountid=">

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</asp:HyperLinkColumn>

<asp:TemplateColumn SortExpression="Orders30" HeaderText="colOrders30">

<HeaderStyle HorizontalAlign="Right"></HeaderStyle>

<ItemStyle HorizontalAlign="Right"></ItemStyle>

<ItemTemplate>

<asp:Literal ID="ltlOrders30" Runat="server"></asp:Literal>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn SortExpression="Orders60" HeaderText="colOrders60">

<HeaderStyle HorizontalAlign="Right"></HeaderStyle>

<ItemStyle HorizontalAlign="Right"></ItemStyle>

<ItemTemplate>

<asp:Literal ID="ltlOrders60" Runat="server"></asp:Literal>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn SortExpression="Orders90" HeaderText="colOrders90">

<HeaderStyle HorizontalAlign="Right"></HeaderStyle>

<ItemStyle HorizontalAlign="Right"></ItemStyle>

<ItemTemplate>

<asp:Literal ID="ltlOrders90" Runat="server"></asp:Literal>

</ItemTemplate>

</asp:TemplateColumn>

</Columns>

<PagerStyle BorderStyle="None" HorizontalAlign="Right" Position="Bottom" CssClass="npadminbody"

Mode="NumericPages"></PagerStyle>

</asp:datagrid>

</form>

</body>

</HTML>

-


so the private string CreateQuery(string userid) should have the data from the textbox txtAccounts from the customers.aspx. Any help would be nice.

thnx.

Kind regards,

Coen Oude Luttikhuis

Former Member
0 Kudos

Hopefully I am understanding what you are doing. So you are adding some controls to the Customer.aspx page so a sales person can enter some search criteria, click a button and that will send them to you new search results page.

I see 2 ways to solve this but you will need to make your search page accept the search text as a querystring parameter for both.

1) Create a user control with a textbox and submit button and have your own postback event there that appends the search text to the url to get to the search page. (eg, NPSearchResults.aspx?search=custname). You could also try adding the event for your asp:Button control to the aspx page with a server side script tag. I personally prefer code behinds for debugging but you will end up with a dll you need to put in the bin folder of the website.

2) Add a javascript function so that when you click the button you call javascript that will append the text to the url. So your link will have a javascript onclick event that calls "javascript:doSearch();" or something like that. It's been a while since I've written javascript lol.

Steve

Answers (2)

Answers (2)

Former Member
0 Kudos

Maybe I am missing something but couldn't you just give your salespeople access to the normal accountsearch page? You can enter search criteria for accounts and users from there and see the results. Unless you need to restrict access to only return accounts that have the current salesperson assigned to them.

Steve

c_oudeluttikhuis
Explorer
0 Kudos

yes, thats exactly the problem. the other salesperson are restricted to see the other customers from the different salespeople, i already changed NP so they cant use accountsearch. So i specifically need a filter/search for the customers from only the salesperson thats currently logged in, if that it possible.

Thnx for the fast replies.

Kind regards,

Coen

Former Member
0 Kudos

There are currently no other filters than are already there.

The control would need to be re-written to provide a filter.