summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/browse/vend_class.html33
-rw-r--r--httemplate/browse/vend_main.html36
-rw-r--r--httemplate/edit/process/vend_class.html10
-rw-r--r--httemplate/edit/process/vend_main.html10
-rw-r--r--httemplate/edit/vend_class.html5
-rw-r--r--httemplate/edit/vend_main.html27
-rw-r--r--httemplate/elements/menu.html21
-rwxr-xr-xhttemplate/misc/delete-vend_bill.html20
-rw-r--r--httemplate/search/report_vend_bill.html34
-rw-r--r--httemplate/search/vend_bill.html52
10 files changed, 246 insertions, 2 deletions
diff --git a/httemplate/browse/vend_class.html b/httemplate/browse/vend_class.html
new file mode 100644
index 000000000..806b27882
--- /dev/null
+++ b/httemplate/browse/vend_class.html
@@ -0,0 +1,33 @@
+<& elements/browse.html,
+ 'title' => 'Vendor classes',
+ 'html_init' => $html_init,
+ 'name' => 'vendor classes',
+ 'disableable' => 1,
+ 'disabled_statuspos' => 2,
+ 'query' => { 'table' => 'vend_class',
+ 'hashref' => {},
+ 'order_by' => 'ORDER BY classnum',
+ },
+ 'count_query' => $count_query,
+ 'header' => $header,
+ 'fields' => $fields,
+ 'links' => $links,
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init =
+ 'Vendor classes group vendor charges for Accounts Payable reporting.<BR><BR>'.
+ qq!<A HREF="${p}edit/vend_class.html"><I>Add a vendor class</I></A><BR><BR>!;
+
+my $count_query = 'SELECT COUNT(*) FROM vend_class';
+
+my $link = [ $p.'edit/vend_class.html?', 'classnum' ];
+
+my $header = [ '#', 'Class' ];
+my $fields = [ 'classnum', 'classname' ];
+my $links = [ $link, $link ];
+
+</%init>
diff --git a/httemplate/browse/vend_main.html b/httemplate/browse/vend_main.html
new file mode 100644
index 000000000..ef1c06021
--- /dev/null
+++ b/httemplate/browse/vend_main.html
@@ -0,0 +1,36 @@
+<& elements/browse.html,
+ 'title' => 'Vendors',
+ 'html_init' => $html_init,
+ 'name' => 'vendors',
+ 'disableable' => 1,
+ 'disabled_statuspos' => 2,
+ 'query' => { 'table' => 'vend_main',
+ 'hashref' => {},
+ 'order_by' => 'ORDER BY vendname',
+ },
+ 'count_query' => $count_query,
+ 'header' => $header,
+ 'fields' => $fields,
+ 'links' => $links,
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init =
+ #'Vendors.<BR><BR>'.
+ qq!<A HREF="${p}edit/vend_main.html"><I>Add a vendor</I></A><BR><BR>!;
+
+my $count_query = 'SELECT COUNT(*) FROM vend_main';
+
+my $link = [ $p.'edit/vend_main.html?', 'vendnum' ];
+my $clink = [ $p.'edit/vend_class.html?', 'classnum' ];
+
+my $header = [ '#', 'Vendor', 'Class', ];
+my $fields = [ 'vendnum', 'vendname',
+ sub { shift->vend_class->classname; }
+ ];
+my $links = [ $link, $link, $clink ];
+
+</%init>
diff --git a/httemplate/edit/process/vend_class.html b/httemplate/edit/process/vend_class.html
new file mode 100644
index 000000000..6a7add60f
--- /dev/null
+++ b/httemplate/edit/process/vend_class.html
@@ -0,0 +1,10 @@
+<& elements/process.html,
+ 'table' => 'vend_class',
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/vend_main.html b/httemplate/edit/process/vend_main.html
new file mode 100644
index 000000000..3f02e9c74
--- /dev/null
+++ b/httemplate/edit/process/vend_main.html
@@ -0,0 +1,10 @@
+<& elements/process.html,
+ 'table' => 'vend_main',
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/vend_class.html b/httemplate/edit/vend_class.html
new file mode 100644
index 000000000..c04c337ef
--- /dev/null
+++ b/httemplate/edit/vend_class.html
@@ -0,0 +1,5 @@
+<& elements/class_Common.html,
+ 'name_singular' => 'Vendor Class',
+ 'table' => 'vend_class',
+ 'nocat' => 1,
+&>
diff --git a/httemplate/edit/vend_main.html b/httemplate/edit/vend_main.html
new file mode 100644
index 000000000..97a3d0b4b
--- /dev/null
+++ b/httemplate/edit/vend_main.html
@@ -0,0 +1,27 @@
+<& elements/edit.html,
+ 'name_singular' => 'Vendor',
+ 'table' => 'vend_main',
+ 'fields' => [
+ 'vendname',
+ { field=>'disabled', type=>'checkbox', value=>'Y', },
+ { field => 'classnum',
+ type => 'select-table',
+ table => 'vend_class',
+ disable_empty => 1,
+ name_col => 'classname',
+ },
+ ],
+ 'labels' => {
+ 'vendnum' => 'Vendor number',
+ 'vendname' => 'Vendor',
+ 'classnum' => 'Class',
+ 'disabled' => 'Disabled',
+ },
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index f2ff2acca..a7411b796 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -369,6 +369,10 @@ if( $curuser->access_right('Financial reports') ) {
} # else $report_financial contains nothing.
+tie my %report_payable, 'Tie::IxHash',
+ 'Payables' => [ $fsurl. 'search/report_vend_bill.html' ],
+;
+
tie my %report_logs, 'Tie::IxHash';
$report_logs{'System log'} = [ $fsurl.'search/log.html', 'View system events and debugging information.' ],
if $curuser->access_right('View system logs')
@@ -405,9 +409,12 @@ $report_menu{'Employees'} = [ \%report_employees, 'Employee reports' ]
if keys %report_employees;
$report_menu{'Billing events'} = [ \%report_bill_event, 'Billing events' ]
if $curuser->access_right('Billing event reports');
-$report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ]
+$report_menu{'Financial (Receivables)'} = [ \%report_financial, 'Financial reports (Receivables)' ]
if $curuser->access_right('Financial reports')
or $curuser->access_right('Receivables report');
+$report_menu{'Financial (Payables)'} = [ \%report_payable, 'Financial reports (Payables)' ]
+ if $curuser->access_right('Financial reports');
+
$report_menu{'Logs'} = [ \%report_logs, 'System and email logs' ]
if (keys %report_logs); # empty if the user has no rights to it
$report_menu{'SQL Query'} = [ $fsurl.'search/report_sql.html', 'SQL Query']
@@ -694,11 +701,21 @@ $config_menu{'Packages'} = [ \%config_pkg, '' ]
|| $curuser->access_right('Edit package definitions')
|| $curuser->access_right('Edit global package definitions');
-if ( $curuser->access_right('Configuration' ) ) {
+if ( $curuser->access_right('Configuration') ) {
$config_menu{'Services'} = [ \%config_export_svc, '' ];
$config_menu{separator3} = '';
}
+tie my %config_vendor, 'Tie::IxHash',
+ 'Vendor classes' => [ $fsurl.'browse/vend_class.html', '' ],
+ 'Vendors' => [ $fsurl.'browse/vend_main.html', '' ],
+;
+
+if ( $curuser->access_right('Configuration') ) {
+ $config_menu{'Vendors'} = [ \%config_vendor, '' ];
+ $config_menu{separator4} = '';
+}
+
$config_menu{'Billing'} = [ \%config_billing, '' ]
if $curuser->access_right('Edit billing events')
|| $curuser->access_right('Edit global billing events');
diff --git a/httemplate/misc/delete-vend_bill.html b/httemplate/misc/delete-vend_bill.html
new file mode 100755
index 000000000..d1d58cea6
--- /dev/null
+++ b/httemplate/misc/delete-vend_bill.html
@@ -0,0 +1,20 @@
+% if ( $error ) {
+% errorpage($error);
+% } else {
+<% $cgi->redirect($p. "search/vend_bill.html") %>
+% }
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+#untaint vendbillnum
+my($query) = $cgi->keywords;
+$query =~ /^(\d+)$/ || die "Illegal vendbillnum";
+my $vendbillnum = $1;
+
+my $vend_bill = qsearchs('vend_bill',{'vendbillnum'=>$vendbillnum});
+
+my $error = $vend_bill->delete;
+
+</%init>
diff --git a/httemplate/search/report_vend_bill.html b/httemplate/search/report_vend_bill.html
new file mode 100644
index 000000000..aec1bba8f
--- /dev/null
+++ b/httemplate/search/report_vend_bill.html
@@ -0,0 +1,34 @@
+<& /elements/header.html, mt('Payables Report') &>
+
+<FORM ACTION="vend_bill.html" METHOD="GET">
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <TR>
+ <TD ALIGN="right" VALIGN="center"><% mt('Date') |h %></TD>
+ <TD>
+ <TABLE>
+ <& /elements/tr-input-beginning_ending.html,
+ prefix => '_date',
+ layout => 'horiz',
+ &>
+ </TABLE>
+ </TD>
+ </TR>
+
+
+ </TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
+
+</FORM>
+
+<& /elements/footer.html &>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
+
diff --git a/httemplate/search/vend_bill.html b/httemplate/search/vend_bill.html
new file mode 100644
index 000000000..ddcc0c93e
--- /dev/null
+++ b/httemplate/search/vend_bill.html
@@ -0,0 +1,52 @@
+<& elements/search.html,
+ 'title' => 'Payables',
+ 'name' => 'payables',
+ 'menubar' => [ 'Add a payable' => '../edit/vend_bill.html', ],
+ 'html_init' => $html_init,
+ 'query' => $query,
+ 'count_query' => $count_query,
+ 'count_addl' => [ '$%.2f total', ],
+ 'header' => [ 'Date',
+ 'Vendor',
+ 'Class',
+ 'Amount',
+ '',
+ ],
+ 'fields' => [
+ sub { time2str('%D', shift->_date) },
+ sub { shift->vend_main->vendname },
+ sub { shift->vend_main->vend_class->classname },
+ 'charged',
+ sub { '<A HREF="javascript:areyousure('.
+ shift->vendbillnum.
+ ')">delete</A>';
+ },
+ ],
+
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my %search = ();
+
+# begin/end/beginning/ending
+my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '');
+$search{'_date'} = [ $beginning, $ending ];
+
+my $query = FS::vend_bill->search( \%search );
+my $count_query = delete( $query->{'count_query'} );
+
+my $html_init .= <<"END";
+<SCRIPT TYPE="text/javascript">
+ function areyousure(vendbillnum) {
+ if ( confirm('Are you sure you want to delete this payable?') )
+ window.location.href="${p}misc/delete-vend_bill.html?" + vendbillnum;
+
+ }
+</SCRIPT>
+END
+
+</%init>
+