invoice_sections_with_taxes per-agent, RT#79636
[freeside.git] / httemplate / index.html
index 97016e6..6e84611 100644 (file)
@@ -1,94 +1,72 @@
-<HTML>
-  <HEAD>
-    <TITLE>
-      Freeside Main Menu
-    </TITLE>
-  </HEAD>
-  <BODY BGCOLOR="#FFFFFF">
-  <table width="100%">
-    <tr><td>
-        <IMG BORDER=0 ALT="Silicon Interactive Software Design" SRC="images/small-logo.png">
-    </td><td>
-      <font color="#ff0000" size=7>freeside main menu</font>
-    </td><td align=right valign=bottom>
-      version 1.4.0
-      <BR><A HREF="http://www.sisd.com/freeside">Freeside home page</A>
-      <BR><A HREF="docs/">Documentation</A>
-    </td></tr>
-  </table>
-    <hr noshade>
-    <ul>
-      <li><A HREF="edit/cust_main.cgi">New Customer</A>
-      <li><A NAME="search">Search</A>
-        <ul>
-        <LI><A HREF="search/cust_main.html">customers (by last name and/or company)</A>
-        <LI><A HREF="search/cust_main-payinfo.html">customers (by credit card number)</A>
-        <LI><A HREF="search/svc_acct.html">accounts (by username)</A>
-        <LI><A HREF="search/svc_domain.html">domains (by domain)</A>
-<!--        <LI><A HREF="search/svc_acct_sm.html">mail aliases (by domain, and optionally username)</A>-->
-        <LI><A HREF="search/svc_forward.html">mail forwards (by ?)</A>
-        <LI><A HREF="search/cust_bill.html">invoices (by invoice number)</A>
-        </ul>
-      <li><A NAME="browse">Browse</A>
-        <ul>
-          <LI>customers (<A HREF="search/cust_main.cgi?browse=custnum">by customer number</A>) (<A HREF="search/cust_main.cgi?browse=last">by last name</A>) (<A HREF="search/cust_main.cgi?browse=company">by company</A>)
-          <LI>invoices
-            <UL>
-              <LI>open invoices (<A HREF="search/cust_bill.cgi?OPEN_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN_custnum">by customer number</A>)
-              <LI>30 day open invoices (<A HREF="search/cust_bill.cgi?OPEN30_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN30_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN30_custnum">by customer number</A>)
-              <LI>60 day open invoices (<A HREF="search/cust_bill.cgi?OPEN60_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN60_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN60_custnum">by customer number</A>)
-              <LI>90 day open invoices (<A HREF="search/cust_bill.cgi?OPEN90_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN90_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN90_custnum">by customer number</A>)
-              <LI>120 day open invoices (<A HREF="search/cust_bill.cgi?OPEN120_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN120_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN120_custnum">by customer number</A>)
-              <LI>all invoices (<A HREF="search/cust_bill.cgi?invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?date">by date</A>) (<A HREF="search/cust_bill.cgi?custnum">by customer number</A>)
-            </UL>
-          <LI>packages
-            <UL>
-              <LI><A HREF="search/cust_pkg.cgi?pkgnum">packages (by package number)</A>
-              <LI><A HREF="search/cust_pkg.cgi?APKG_pkgnum">packages with unconfigured services (by package number)</A>
-            </UL>
-          <LI>services
-            <UL>
-              <LI>accounts (<A HREF="search/svc_acct.cgi?svcnum">by service number</A>) (<A HREF="search/svc_acct.cgi?username">by username</A>) (<A HREF="search/svc_acct.cgi?uid">by uid</A>)
-              <LI>mail forwards (<A HREF="search/svc_forward.cgi?svcnum">by service number</A>) (by ?))
-              <LI>domains (<A HREF="search/svc_domain.cgi?svcnum">by service number</A>) (<A HREF="search/svc_domain.cgi?domain">by domain</A>)
-            </UL>
-          <LI>unlinked services
-            <UL>
-              <LI>unlinked accounts (<A HREF="search/svc_acct.cgi?UN_svcnum">by service number</A>) (<A HREF="search/svc_acct.cgi?UN_username">by username</A>) (<A HREF="search/svc_acct.cgi?UN_uid">by uid</A>)
-              <LI>unlinked mail forwards (<A HREF="search/svc_forward.cgi?UN_svcnum">by service number</A>) (by ?))
-              <LI>unlinked domains (<A HREF="search/svc_domain.cgi?UN_svcnum">by service number</A>) (<A HREF="search/svc_domain.cgi?UN_domain">by domain</A>)
-            </UL>
-          <LI><A HREF="browse/nas.cgi">NAS ports</A>
-          <LI><A HREF="browse/queue.cgi">Joe queue</A>
-          <LI><A HREF="browse/cust_pay_batch.cgi">Pending credit card batch</A>
-        </ul>
-    </ul>
-    <hr noshade>
-    <ul>
-      <li><A NAME="config" HREF="config/config-view.cgi">Configuration</a><!-- - <font size="+2" color="#ff0000">start here</font> -->
-      <li><A NAME="admin">Administration</a>
-        <ul>
-          <LI><A HREF="browse/part_svc.cgi">View/Edit service definitions</A>
-            - Services are items you offer to your customers.
-          <LI><A HREF="browse/part_pkg.cgi">View/Edit package definitions</A>
-            - One or more services are grouped together into a package and
-              given pricing information.  Customers purchase packages, not
-              services.
-          <LI><A HREF="browse/agent_type.cgi">View/Edit agent types</A>
-            - Agent types define groups of package definitions that you can
-              then assign to particular agents.
-          <LI><A HREF="browse/agent.cgi">View/Edit agents</A>
-            - Agents are resellers of your service.  Agents may be limited
-              to a subset of your full offerings (via their type).
-          <LI><A HREF="browse/part_referral.cgi">View/Edit referrals</A>
-            - Where a customer heard about your service.  Tracked for
-              informational purposes.
-          <LI><A HREF="browse/cust_main_county.cgi">View/Edit locales and tax rates</A>
-            - Change tax rates, or break down a country into states, or a state
-              into counties and assign different tax rates to each.
-          <LI><A HREF="browse/svc_acct_pop.cgi">View/Edit POPs</A>
-            - Points of Presence 
-        </ul>
-      </ul>
-  </BODY>
-</HTML>
+<%init>my $debug = $cgi->param('debug');</%init>
+% warn time.": header.html\n" if $debug;
+%
+<& /elements/header.html, mt('Billing Main') &>
+
+% warn time.": dashboard-install_welcome.html\n" if $debug;
+%
+<& /elements/dashboard-install_welcome.html &>
+
+% warn time.": dashboard-toplist.html\n" if $debug;
+%
+<& /elements/dashboard-toplist.html &>
+
+% my $curuser = $FS::CurrentUser::CurrentUser;
+% my $numcust = $curuser->option('dashboard_customers');
+% $numcust ||= 10 unless $numcust =~ /^\s*0+\s*$/;
+% if ( $numcust ) {
+%
+%   warn time.": fetching recently changed customers\n" if $debug;
+%
+%   my $sth = dbh->prepare(
+%     #"SELECT DISTINCT custnum FROM h_cust_main JOIN cust_main USING ( custnum )
+%     "SELECT custnum FROM h_cust_main JOIN cust_main USING ( custnum )
+%        WHERE ( history_action = 'insert' OR history_action = 'replace_new' ) 
+%          AND ( history_usernum = ? OR history_user = ? )
+%          AND ". $curuser->agentnums_sql( table=>'cust_main' ).
+%     "  ORDER BY history_date desc LIMIT 1000" # LIMIT 10
+%     ) or die dbh->errstr;
+%
+%
+%   $sth->execute( $curuser->usernum, $curuser->username ) or die $sth->errstr;
+%
+%   my %saw = ();
+%   my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref };
+%
+%   @custnums = splice(@custnums, 0, $numcust);
+%
+%   if ( @custnums ) {
+%     warn time.": displaying recently changed customers\n" if $debug;
+
+      <& /elements/table-grid.html &>
+
+%     my $bgcolor1 = '#eeeeee';
+%     my $bgcolor2 = '#ffffff';
+%     my $bgcolor = $bgcolor2;
+
+        <TR>
+          <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=1><% mt('Customers I recently added or modified') |h %></TH>
+        </TR>
+
+%     foreach my $custnum ( @custnums ) { 
+%     my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); 
+%     next unless $cust_main; 
+
+        <TR>
+          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="view/cust_main.cgi?<% $custnum %>"><% $cust_main->display_custnum %>: <% $cust_main->name |h %></A></TD>
+        </TR>
+
+%       if ( $bgcolor eq $bgcolor1 ) {
+%          $bgcolor = $bgcolor2;
+%        } else {
+%          $bgcolor = $bgcolor1;
+%        }
+%    
+%     } 
+
+      </TABLE>
+
+%   } 
+% }
+
+<& /elements/footer.html &>