-<%
-#<!-- $Id: cust_main.cgi,v 1.4 2001-08-28 14:34:14 ivan Exp $ -->
-
-use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum
- $last $first $ss $company $address1 $address2 $city $zip
- $daytime $night $fax @invoicing_list $invoicing_list $payinfo
- $payname %payby %paybychecked $refnum $otaker $r );
-use vars qw ( $conf $saved_pkgpart $username $password $popnum $ulen $ulen2 );
-use vars qw ( $error );
-#use CGI::Switch;
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-use FS::UID qw(cgisuidsetup getotaker);
-#use FS::Record qw(qsearch qsearchs fields);
-use FS::Record qw(qsearch qsearchs fields dbdef);
-use FS::CGI qw(header popurl itable table);
-use FS::cust_main;
-use FS::agent;
-use FS::part_referral;
-use FS::cust_main_county;
-
- #for misplaced logic below
- use FS::part_pkg;
-
- #for false laziness below
- use FS::svc_acct_pop;
-
- #for (other) false laziness below
- use FS::agent;
- use FS::type_pkgs;
-
-$conf = new FS::Conf;
+<& /elements/header.html,
+ $title,
+ '',
+ ' onUnload="myclose()"' #hmm, in billing.html
+&>
+
+<& /elements/error.html &>
+
+<FORM NAME = "CustomerForm"
+ METHOD = "POST"
+ ACTION = "<% popurl(1) %>process/cust_main.cgi"
+>
+
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
+<INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospectnum %>">
+
+% if ( $custnum ) {
+ <% mt('Customer #') |h %><B><% $cust_main->display_custnum %></B> -
+ <B><FONT COLOR="#<% $cust_main->statuscolor %>">
+ <% ucfirst($cust_main->status) %>
+ </FONT></B>
+ <BR><BR>
+% }
+
+%# agent, agent_custid, refnum (advertising source), referral_custnum
+<& cust_main/top_misc.html, $cust_main, 'custnum' => $custnum &>
+
+%# birthdate
+% if ( $conf->exists('cust_main-enable_birthdate') ) {
+ <BR>
+ <& cust_main/birthdate.html, $cust_main &>
+% }
+
+%# latitude and longitude
+% if ( $conf->exists('cust_main-require_censustract') ) {
+% my ($latitude, $longitude) = $cust_main->service_coordinates;
+% $latitude ||= $conf->config('company_latitude') || '';
+% $longitude ||= $conf->config('company_longitude') || '';
+ <INPUT NAME="latitude" TYPE="hidden" VALUE="<% $latitude |h %>">
+ <INPUT NAME="longitude" TYPE="hidden" VALUE="<% $longitude |h %>">
+% }
+
+%# contact info
+
+% my $same_checked = '';
+% my $ship_disabled = '';
+% my @ship_style = ();
+% unless ( $cust_main->ship_last && $same ne 'Y' ) {
+% $same_checked = 'CHECKED';
+% $ship_disabled = 'DISABLED';
+% push @ship_style, 'background-color:#dddddd';
+% foreach (
+% qw( last first company address1 address2 city county state zip country
+% daytime night fax )
+% ) {
+% $cust_main->set("ship_$_", $cust_main->get($_) );
+% }
+% }
+
+<BR>
+<FONT SIZE="+1"><B><% mt('Billing address') |h %></B></FONT>
+
+<& cust_main/contact.html,
+ 'cust_main' => $cust_main,
+ 'pre' => '',
+ 'onchange' => 'bill_changed(this)',
+ 'disabled' => '',
+ 'ss' => $ss,
+ 'stateid' => $stateid,
+ 'same_checked' => $same_checked, #for address2 "Unit #" labeling
+&>
+
+<SCRIPT>
+function bill_changed(what) {
+ if ( what.form.same.checked ) {
+% for (qw( last first company address1 address2 city zip daytime night fax )) {
+ what.form.ship_<%$_%>.value = what.form.<%$_%>.value;
+% }
+
+ what.form.ship_country.selectedIndex = what.form.country.selectedIndex;
+
+ function fix_ship_city() {
+ what.form.ship_city_select.selectedIndex = what.form.city_select.selectedIndex;
+ what.form.ship_city.style.display = what.form.city.style.display;
+ what.form.ship_city_select.style.display = what.form.city_select.style.display;
+ }