add back invoice event reports
[freeside.git] / httemplate / elements / menu.html
1 <script type="text/javascript" src="<%$fsurl%>elements/cssexpr.js"></script>
2 <script type="text/javascript" src="<%$fsurl%>elements/xmenu.js"></script>
3 <link href="<%$fsurl%>elements/xmenu.css" type="text/css" rel="stylesheet">
4 <link href="<%$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet">
5
6 <SCRIPT TYPE="text/javascript">
7
8   webfxMenuImagePath      = "<%$fsurl%>images/";
9   webfxMenuUseHover       = 1;
10   webfxMenuShowTime       = 300;
11   webfxMenuHideTime       = 500;
12
13   var myBar = new WebFXMenuBar;
14
15 % foreach my $item ( keys %menu ) {
16 %
17 %     my( $url_or_submenu, $tooltip ) = @{ $menu{$item} };
18 %
19 %     if ( ref($url_or_submenu) ) {
20 %
21 %         #warn $item;
22 %
23 %         my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item);
24
25           <% $subhtml %>
26           myBar.add(new WebFXMenuButton("<% $item %>", null, "<% $tooltip %>", <% $submenuname %> ));
27
28 %     } else { 
29     
30           myBar.add(new WebFXMenuButton("<% $item %>", "<% $url_or_submenu %>", "<% $tooltip %>" ));
31
32 %     }
33 %
34 % }
35
36   myBar.show( null, 'vertical' );
37   myBar.width = 154;
38
39 </SCRIPT>
40
41 <%init>
42 my( %opt ) = @_;
43 my $conf = new FS::Conf;
44 my $fsurl = $opt{'freeside_baseurl'};
45
46 my $curuser = $FS::CurrentUser::CurrentUser;
47
48 #Active tickets not assigned to a customer
49
50 tie my %report_customers_lists, 'Tie::IxHash',
51   'by customer number' => [ $fsurl. 'search/cust_main.cgi?browse=custnum', '' ],
52   'by last name' => [ $fsurl. 'search/cust_main.cgi?browse=last', '' ],
53   'by company name' => [ $fsurl. 'search/cust_main.cgi?browse=company', '' ],
54   'by active trouble tickets' => [ $fsurl. 'search/cust_main.cgi?browse=tickets', '' ],
55 ;
56
57 tie my %report_customers_search, 'Tie::IxHash',
58   'by ordering employee' => [ $fsurl. 'search/cust_main-otaker.cgi' ],
59 ;
60
61 tie my %report_customers, 'Tie::IxHash',
62   'List customers' => [ \%report_customers_lists, 'List customers' ],
63   'Search customers' => [ \%report_customers_search, 'Search customers' ],
64   'Zip code distribution' => [ $fsurl.'search/report_cust_main-zip.html', 'Zip codes by number of customers' ],
65 ;
66
67 tie my %report_invoices_open, 'Tie::IxHash',
68   'All open invoices' => [ $fsurl.'search/cust_bill.html?OPEN_date', 'All invoices with an unpaid balance' ],
69   '15 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN15_date', 'Invoices 15 days or older with an unpaid balance' ],
70   '30 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN30_date', 'Invoices 30 days or older with an unpaid balance' ],
71   '60 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN60_date', 'Invoices 60 days or older with an unpaid balance' ],
72   '90 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN90_date', 'Invoices 90 days or older with an unpaid balance' ],
73   '120 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN120_date', 'Invoices 120 days or older with an unpaid balance' ],
74 ;
75
76 tie my %report_invoices, 'Tie::IxHash',
77   'Open invoices' => [ \%report_invoices_open, 'Open invoices' ],
78   'All invoices'  => [ $fsurl. 'search/cust_bill.html?date', 'List all invoices' ],
79   'Advanced invoice reports' => [ $fsurl.'search/report_cust_bill.html', 'by agent, date range, etc.' ],
80 ;
81
82 tie my %report_services_acct, 'Tie::IxHash',
83   'All accounts by username' => [ $fsurl.'search/svc_acct.cgi?username', '' ],
84   'All accounts by UID'      => [ $fsurl.'search/svc_acct.cgi?uid', '' ],
85 ;
86 $report_services_acct{'Unlinked accounts'} = [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside accounts without a customer record' ]
87   if $curuser->access_right('View/link unlinked services');
88
89 tie my %report_services_domain, 'Tie::IxHash',
90   'All domains'      => [ $fsurl.'search/svc_domain.cgi?domain', '' ],
91 ;
92 $report_services_domain{'Unlinked domains'} = [ $fsurl.'search/svc_domain.cgi?UN_domain', 'Pre-Freeside domains without a customer record' ]
93   if $curuser->access_right('View/link unlinked services');
94
95 tie my %report_services_forward, 'Tie::IxHash',
96   'All mail forwards'      => [ $fsurl.'search/svc_forward.cgi?svcnum', '' ],
97 ;
98 $report_services_forward{'Unlinked mail forwards'} = [ $fsurl.'search/svc_forward.cgi?UN_svcnum', 'Pre-Freeside mail forwards without a customer record' ]
99   if $curuser->access_right('View/link unlinked services');
100
101 tie my %report_services_www, 'Tie::IxHash',
102   'All virtual hosts'     => [ $fsurl.'search/svc_www.cgi?svcnum', '' ],
103 ;
104 $report_services_www{'Unlinked virtual hosts'} = [ $fsurl.'search/svc_www.cgi?UN_svcnum', 'Pre-Freeside virtual hosts without a customer record' ]
105   if $curuser->access_right('View/link unlinked services');
106
107 tie my %report_services_broadband, 'Tie::IxHash',
108   'All broadband services' => [ $fsurl.'search/svc_broadband.cgi?svcnum', '' ],
109   #'Unlinked domain' => [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside domains without a customer record' ],
110 ;
111
112 tie my %report_services_phone, 'Tie::IxHash',
113   'All phone numbers' => [ $fsurl.'search/svc_phone.cgi?svcnum', '' ],
114 ;
115
116 tie my %report_services_external, 'Tie::IxHash',
117   'All external services' => [ $fsurl.'search/svc_external.cgi?id', '' ],
118 ;
119 $report_services_external{'Unlinked external services'} = [ $fsurl.'search/svc_external.cgi?UN_id', 'Pre-Freeside domains without a customer record' ]
120   if $curuser->access_right('View/link unlinked services');
121
122 tie my %report_services, 'Tie::IxHash';
123 if ( $curuser->access_right('Configuration') ) {
124   $report_services{'Service definitions'} =  [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ];
125   $report_services{'separator'} =  '';
126 }
127 $report_services{'Accounts'} =  [ \%report_services_acct, 'Access accounts and mailboxes' ];
128 $report_services{'Domains'} =  [ \%report_services_domain, 'Domains', ];
129 $report_services{'Mail forwards'} =  [ \%report_services_forward, 'Mail forwards', ];
130 $report_services{'Virtual hosts'} =  [ \%report_services_www, 'Virtual hosting', ];
131 $report_services{'Broadband services'} =  [ \%report_services_broadband, 'Fixed (username-less) broadband services', ];
132 $report_services{'Phone numbers'} =  [ \%report_services_phone, 'Telephone numbers', ];
133 $report_services{'External services'} =  [ \%report_services_external, 'External services', ];
134
135 tie my %report_packages, 'Tie::IxHash';
136 if ( $curuser->access_right('Configuration') ) {
137   $report_packages{'Package definitions'} =  [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ];
138   $report_packages{'separator'} =  '';
139 }
140 $report_packages{'All customer packages'} =  [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ];
141 $report_packages{'Suspended customer packages'} =  [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ];
142 $report_packages{'Customer packages with unconfigured services'} =  [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
143 $report_packages{'Advanced package reports'} =  [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ];
144
145 tie my %report_rating, 'Tie::IxHash',
146   'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ],
147 ;
148
149 tie my %report_bill_event, 'Tie::IxHash',
150   'All billing events' => [ $fsurl.'search/cust_bill_event.html', 'All billing events for a date range' ],
151   'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'failed credit cards, processor or printer problems, etc.' ],
152 ;
153
154 tie my %report_financial, 'Tie::IxHash', 
155   'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ],
156   'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ],
157   'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ],
158   'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Credit report (by type and/or date range)' ],
159   'A/R Aging' => [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ],
160   'Prepaid Income' => [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue)  report' ],
161   'Sales Tax Liability' => [ $fsurl.'search/report_tax.html', 'Sales tax liability report' ],
162 ;
163
164 tie my %report_menu, 'Tie::IxHash';
165 $report_menu{'Customers'}   = [ \%report_customers, 'Customer reports'  ]
166   if $curuser->access_right('List customers');
167 $report_menu{'Invoices'}    =  [ \%report_invoices,  'Invoice reports'   ]
168   if $curuser->access_right('List invoices');
169 $report_menu{'Packages'}    =  [ \%report_packages,  'Package reports'   ]
170   if $curuser->access_right('List packages');
171 $report_menu{'Services'}    =  [ \%report_services,  'Services reports'  ]
172   if $curuser->access_right('List services');
173 $report_menu{'Rating data'} =  [ \%report_rating,    'Rating reports'  ]
174   if $curuser->access_right('List rating data');
175 $report_menu{'Billing events'} =  [ \%report_bill_event, 'Billing events' ]
176   if $curuser->access_right('Billing event reports');
177 $report_menu{'Financial'}  = [ \%report_financial, 'Financial reports' ]
178   if $curuser->access_right('Financial reports');
179
180 tie my %tools_importing, 'Tie::IxHash',
181   'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
182   'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
183   'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ],
184 ;
185
186 tie my %tools_exporting, 'Tie::IxHash',
187   'Download database dump' => [ $fsurl. 'misc/dump.cgi', '' ],
188 ;
189
190 #    <!-- <BR>View active NAS ports: 
191 #      <A HREF="browse/nas.cgi">session server</A> -->
192 #      <!-- or <A HREF="browse/nas-sqlradius.cgi">RADIUS</A>
193 #    <BR> -->
194
195 tie my %tools_menu, 'Tie::IxHash', ();
196 $tools_menu{'Quick payment entry'} =  [ $fsurl.'misc/batch-cust_pay.html', 'Enter multiple payments in a batch' ]
197   if $curuser->access_right('Post payment batch');
198 $tools_menu{'Job Queue'} =  [ $fsurl.'search/queue.html', 'View pending job queue' ]
199   if $curuser->access_right('Job queue');
200 $tools_menu{'Importing'} =  [ \%tools_importing, 'Import tools' ]
201   if $curuser->access_right('Import');
202 $tools_menu{'Exporting'} =  [ \%tools_exporting, 'Export tools' ]
203   if $curuser->access_right('Export');
204
205 tie my %config_employees, 'Tie::IxHash',
206   'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ],
207   'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ],
208 ;
209
210 tie my %config_export_svc_pkg, 'Tie::IxHash',
211   'View/Edit exports'             => [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ],
212   'View/Edit service definitions' => [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ],
213   'View/Edit package definitions' => [ $fsurl.'browse/part_pkg.cgi', 'One or more services are grouped together into a package and given pricing information. Customers purchase packages, not services' ],
214   'View/Edit package classes'     => [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ],
215 ;
216
217 tie my %config_agent, 'Tie::IxHash',
218   'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],
219   'View/Edit agents'      => [ $fsurl.'browse/agent.cgi', 'Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type)' ],
220 ;
221
222 tie my %config_billing, 'Tie::IxHash',
223   'View/Edit payment gateways'         => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ],
224   'View/Edit invoice events'           => [ $fsurl.'browse/part_bill_event.cgi', 'Actions for overdue invoices' ],
225   'View/Edit prepaid cards'            => [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ],
226   'View/Edit call rates and regions'   => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
227   'View/Edit locales and tax rates'    => [ $fsurl.'browse/cust_main_county.cgi', 'Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each' ],
228 ;
229
230 tie my %config_dialup, 'Tie::IxHash',
231   'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ],
232 ;
233
234 tie my %config_broadband, 'Tie::IxHash',
235   'View/Edit routers'        => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ],
236   'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ],
237 ;
238
239 tie my %config_misc, 'Tie::IxHash';
240 $config_misc{'View/Edit advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service.  Tracked for informational purposes' ]
241   if $curuser->access_right('Configuration')
242   || $curuser->access_right('Edit advertising sources')
243   || $curuser->access_right('Edit global advertising sources');
244 if ( $curuser->access_right('Configuration') ) {
245   $config_misc{'View/Edit virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ];
246   $config_misc{'View/Edit message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ];
247   $config_misc{'View/Edit inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ];
248 }
249
250 tie my %config_menu, 'Tie::IxHash';
251 if ( $curuser->access_right('Configuration' ) ) {
252   %config_menu = (
253     'Settings'      => [ $fsurl.'config/config-view.cgi', '' ],
254     'separator'     => '', #its a separator!
255     'Employees'     => [ \%config_employees, '' ],
256     'Provisioning, services and packages'
257                     => [ \%config_export_svc_pkg, ''    ],
258     'Resellers'     => [ \%config_agent, ''    ],
259     'Billing'       => [ \%config_billing, ''    ],
260     'Dialup'        => [ \%config_dialup, ''    ],
261     'Fixed (username-less) broadband'
262                     => [ \%config_broadband, ''    ],
263   );
264 }
265 $config_menu{'Miscellaneous'} = [ \%config_misc, ''    ]
266   if $curuser->access_right('Configuration')
267   || $curuser->access_right('Edit advertising sources')
268   || $curuser->access_right('Edit global advertising sources');
269
270 tie my %menu, 'Tie::IxHash',
271   'Billing Main'   => [ $fsurl, 'Billing start page', ],
272   'Ticketing Main' => [ 
273                         ( $conf->config('ticket_system') eq 'RT_External'
274                           ? FS::TicketSystem->baseurl()
275                           : $fsurl.'rt/'
276                         ),
277                         'Ticketing start page',
278                       ],
279 ;
280 $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ]
281   if keys %report_menu;
282 $menu{'Tools'} = [ \%tools_menu, 'Tools' ]
283   if keys %tools_menu;
284 $menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ]
285   if $curuser->access_right('Configuration')
286   || $curuser->access_right('Edit advertising sources')
287   || $curuser->access_right('Edit global advertising sources');
288
289 use vars qw($gmenunum);
290 $gmenunum = 0;
291
292 sub submenu {
293   my($submenu, $title) = @_;
294   my $menunum = $gmenunum++;
295
296   #return two args: html, menuname
297
298   "var myMenu$menunum = new WebFXMenu;\n".
299   #"myMenu$menunum.useAutoPosition = true;\n".
300   "myMenu$menunum.emptyText = '$title';\n".
301
302   (
303     join("\n", map {
304
305       if ( !ref( $submenu->{$_} ) ) {
306
307         "myMenu$menunum.add(new WebFXMenuSeparator());";
308
309       } else {
310
311         my($url_or_submenu, $tooltip ) = @{ $submenu->{$_} };
312         if ( ref($url_or_submenu) ) {
313
314           my($subhtml, $submenuname ) = submenu($url_or_submenu, $_); #mmm, recursion
315
316           "$subhtml\n".
317           "myMenu$menunum.add(new WebFXMenuItem(\"$_\", null, \"$tooltip\", $submenuname ));";
318
319         } else {
320
321           "myMenu$menunum.add(new WebFXMenuItem(\"$_\", \"$url_or_submenu\", \"$tooltip\" ));";
322
323         }
324
325       }
326
327     } keys %$submenu )
328   ). "\n".
329   "myMenu$menunum.width = 224\n",
330
331   "myMenu$menunum";
332
333 }
334
335 </%init>
336