add Avalara tax status field to prospects, #25718
[freeside.git] / httemplate / view / prospect_main.html
1 <& /elements/header.html, 'Prospect View: '. $prospect_main->company &>
2
3 % if ( $curuser->access_right('Edit prospect') ) { 
4   <A HREF="<% $p %>edit/prospect_main.html?<% $prospectnum %>">Edit this prospect</A>
5 % } 
6
7 <% ntable("#cccccc",2) %>
8
9 <TR>
10   <TD ALIGN="right">Prospect #</TD>
11   <TD BGCOLOR="#FFFFFF"><B><% $prospectnum %></B>
12 %   if ( $prospect_main->disabled ) {
13       <B>(DISABLED)</B>
14 %   }
15   </TD>
16 </TR>
17
18 %unless ( scalar(@agentnums) == 1
19 %         && !$curuser->access_right('View customers of all agents') ) {
20 %  my $agent = qsearchs('agent',{ 'agentnum' => $prospect_main->agentnum } );
21    <TR>
22      <TD ALIGN="right">Agent</TD>
23      <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent |h %></TD>
24    </TR>
25 %}
26
27 %unless ( ! $prospect_main->refnum ) { # || scalar(@part_referral) == 1 ) {
28 %  my $part_referral = qsearchs('part_referral',{ 'refnum' => $prospect_main->refnum } );
29    <TR>
30      <TD ALIGN="right">Advertising source</TD>
31      <TD BGCOLOR="#ffffff"><% $part_referral->referral |h %></TD>
32    </TR>
33 %}
34
35 % if ( $prospect_main->company ) { 
36   <TR>
37     <TD ALIGN="right">Company</TD>
38     <TD BGCOLOR="#FFFFFF"><B><% $prospect_main->company |h %></B></TD>
39   </TR>
40 % }
41
42 % foreach my $prospect_contact ( $prospect_main->prospect_contact ) {
43 %   my $contact = $prospect_contact->contact;
44     <TR>
45       <TD ALIGN="right"><% $prospect_contact->contact_classname %> Contact</TD>
46       <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
47     </TR>
48 %}
49
50 % my @cust_location =
51 %   qsearch('cust_location', { 'prospectnum' => $prospectnum } );
52 % #but only one, for now
53 % foreach my $cust_location (@cust_location) {
54     <TR>
55       <TD ALIGN="right">Address</TD>
56       <TD BGCOLOR="#FFFFFF">
57         <% $cust_location->location_label(
58              'join_string'     => '<BR>',
59              'double_space'    => ' &nbsp; ',
60              'escape_function' => \&encode_entities,
61            )
62         %>
63       </TD>
64     </TR>
65 %   if ( $cust_location->latitude && $cust_location->longitude ) {
66       <& /elements/tr-coords.html, $cust_location->latitude,
67                                    $cust_location->longitude,
68                                    $prospect_main->name,
69       &>
70 %   }
71 % }
72 % if ( my $tax_status = $prospect_main->tax_status ) {
73   <TR>
74     <TD ALIGN="right">Tax status</TD>
75     <TD BGCOLOR="#FFFFFF">
76       <B><% $tax_status->taxstatus %>:</B> <% $tax_status->description %>
77     </TD>
78   </TR>
79 % }
80
81 </TABLE>
82
83 <BR>
84
85 <& /elements/quotations.html, prospect_main=>$prospect_main &>
86
87 % if ( $curuser->access_right('Qualify service') ) { 
88 <% include( '/elements/popup_link-prospect_main.html',
89               'action'        => $p. 'misc/qual.html',
90               'label'         => 'New&nbsp;Qualification',
91               'actionlabel'   => 'New Qualification',
92               'color'         => '#333399',
93               'prospect_main' => $prospect_main,
94               'closetext'     => 'Close',
95               'width'         => 763,
96               'height'        => 436,
97           )
98 %>
99   | <A HREF="<%$p%>search/qual.cgi?prospectnum=<% $prospect_main->prospectnum %>">View Qualifications</A>
100     <BR><BR>
101 % }
102
103 <!--
104 <% ntable("#cccccc") %>
105
106 <TR>
107   <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Tickets</FONT></TH>
108 </TR>
109
110 </TABLE>
111 -->
112
113 <%init>
114
115 my $curuser = $FS::CurrentUser::CurrentUser;
116
117 die "access denied"
118   unless $curuser->access_right('View prospect');
119
120 my $prospectnum;
121 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
122   $prospectnum = $1;
123 } else {
124   die "No prospect specified (bad URL)!" unless $cgi->keywords;
125   my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
126   $query =~ /^(\d+)$/;
127   $prospectnum = $1;
128 }
129
130 my $prospect_main = qsearchs( {
131   'table'     => 'prospect_main',
132   'hashref'   => { 'prospectnum' => $prospectnum },
133   'extra_sql' => ' AND '. $curuser->agentnums_sql,
134 });
135 die "Prospect not found!" unless $prospect_main;
136
137 my @agentnums = $curuser->agentnums;
138
139 </%init>