RT# 80488 Banner on customer page when missing tax districts
[freeside.git] / httemplate / elements / header-cust_main.html
1 <%doc>
2
3 Examples:
4
5   <& /elements/header-cust_main.html,
6        view      => 'basics', #required
7        cust_main => $cust_main, # cust_main or custnum is required
8        custnum   => $custnum,   #
9   &>
10
11 </%doc>
12 <& /elements/header.html, {
13              'title'             => $title,
14              'title_noescape'    => $title_noescape,
15              'head'              => $head,
16              'etc'               => $opt{'etc'},
17              'include_selectize' => $opt{include_selectize} ? 1 : 0,
18              #'nobr'             => 1,
19           }
20 &>
21
22 % my @part_tag = $cust_main->part_tag;
23 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
24 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
25 %   foreach my $part_tag ( @part_tag ) {
26 <TR>
27   <TD>
28       <FONT SIZE="+1"
29             <% length($part_tag->tagcolor)
30                  ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
31                  : ''
32       %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
33   </TD>
34 </TR>
35 %   }
36 </TABLE>
37 % }
38 % if ( scalar @cust_locations_missing_district ) {
39   <div style="margin: 0 1em; padding: 1em; border: solid 1px #999; background-color: #fee;">
40     <h4 style="margin: 0; border-bottom: solid 1px #aaa; color: red;">Customer will not be billed:</h4>
41     <p style="margin: .5em;">
42     The following customer locations are missing tax districts for Washington State.<br>
43     Sales taxes cannot be calculated for this customer.<br>
44     Correct the address information, or enter a tax district number.
45     <ul>
46 %   for my $cust_location ( @cust_locations_missing_district ) {
47       <li>
48         (<a href="#" onclick="overlib_edit_location(<% $cust_location->locationnum %>);">
49           EDIT
50         </a>)
51         <% $cust_location->address1 %>
52         <% $cust_location->city %>
53         <% $cust_location->state %>
54         <% $cust_location->zip %>
55         (<% $cust_location->locationnum %>)
56       </li>
57 %   } # /for my $cust_location
58     </ul>
59   </div>
60   <script>
61     function overlib_edit_location(locationnum) {
62       overlib(
63         OLiframeContent(
64           '<% $fsurl %>edit/cust_location.cgi?locationnum=' + locationnum,
65           700, 355,
66           'popup-1548013977-3901-3256727185.50958',
67           0,
68           'auto'
69         ),
70         CAPTION, 'Edit location',
71         STICKY,
72         AUTOSTATUSCAP,
73         MIDX, 0,
74         MIDY, 0,
75         DRAGGABLE,
76         CLOSECLICK,
77         TEXTPADDING, 0,
78         BASE, 0,
79         BGCOLOR, '#333399',
80         CGCOLOR, '#333399',
81         FGCOLOR, '#f8f8f8',
82         CLOSETEXT, 'Close'
83       );
84       return false;
85     }
86   </script>
87   <br>
88 % } # /if @cust_locations_missing_district
89 <& /view/cust_main/menu.html, cust_main => $cust_main, show => $opt{'view'} &>
90 <BR>
91
92 <DIV CLASS="fstabcontainer">
93
94 <& /elements/init_overlib.html &>
95
96 <SCRIPT TYPE="text/javascript">
97 function areyousure(href, message) {
98   if (confirm(message) == true)
99     window.location.href = href;
100 }
101 function areyousure_popup(message, action, actionlabel) {
102   if (confirm(message) == true) {
103 <% include('/elements/popup_link_onclick.html',
104      'js_action' => 'action',
105      'js_actionlabel' => 'actionlabel',
106    ) %>
107   }
108 }
109 </SCRIPT>
110
111 <%init>
112
113 my $curuser = $FS::CurrentUser::CurrentUser;
114
115 my $conf = new FS::Conf;
116
117 my %opt = @_;
118
119 my $cust_main = $opt{'cust_main'} || qsearchs( {
120   'table'     => 'cust_main',
121   'hashref'   => { 'custnum' => $opt{'custnum'} },
122   'extra_sql' => ' AND '. $curuser->agentnums_sql,
123 });
124 die "Customer not found!" unless $cust_main;
125
126 my $title = mt("Customer").' #'. $cust_main->display_custnum. ': ';
127 my $title_noescape = $title. encode_entities($cust_main->name);
128 $title .= $cust_main->name;
129
130 if ( $curuser->num_agents ) {
131   $title_noescape =
132     encode_entities($cust_main->agent->agent). " $title_noescape";
133   $title = $cust_main->agent->agent. " $title";
134 }
135
136 my $status = $cust_main->status_label;
137 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
138 $title_noescape .= ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status.  '</FONT></B>)';
139 $title .= " ($status)";
140
141 my $ie_compat = $conf->config('ie-compatibility_mode');
142 my $head = '';
143 if ( $ie_compat ) {
144   $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);
145 }
146
147 my @cust_locations_missing_district;
148 my $tax_district_method = $conf->config('tax_district_method');
149 if ( $tax_district_method && $tax_district_method eq 'wa_sales' ) {
150   @cust_locations_missing_district = $cust_main->cust_locations_missing_district();
151 }
152
153 </%init>