From 4396080ed2829ae0595f1fd777f39d090c9bcd7c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 06:42:33 +0000 Subject: experimental package balances, RT#4339 --- httemplate/elements/select-cust_pkg-balances.html | 30 +++++++++++++++++++++ .../elements/tr-select-cust_pkg-balances.html | 31 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 httemplate/elements/select-cust_pkg-balances.html create mode 100644 httemplate/elements/tr-select-cust_pkg-balances.html (limited to 'httemplate/elements') diff --git a/httemplate/elements/select-cust_pkg-balances.html b/httemplate/elements/select-cust_pkg-balances.html new file mode 100644 index 000000000..d41bd033e --- /dev/null +++ b/httemplate/elements/select-cust_pkg-balances.html @@ -0,0 +1,30 @@ + +<%init> + +my %opt = @_; + +my @cust_pkg; +if ( $opt{'cust_pkg'} ) { + + @cust_pkg = @{ $opt{'cust_pkg'} }; + +} else { + + my $custnum = $opt{'custnum'}; + + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + + @cust_pkg = + grep { ! $_->get('cancel') || $cust_main->balance_pkgnum($_->pkgnum) } + $cust_main->all_pkgs; + +} + + diff --git a/httemplate/elements/tr-select-cust_pkg-balances.html b/httemplate/elements/tr-select-cust_pkg-balances.html new file mode 100644 index 000000000..89dc5d415 --- /dev/null +++ b/httemplate/elements/tr-select-cust_pkg-balances.html @@ -0,0 +1,31 @@ +% if ( scalar(@cust_pkg) == 0 ) { + +% } elsif ( scalar(@cust_pkg) == 1 ) { + +% } else { + + For package + + <% include('select-cust_pkg-balances.html', + 'cust_pkg' => \@cust_pkg, + 'cgi' => $opt{'cgi'}, + ) + %> + + + +% } + +<%init> +my %opt = @_; + +my $custnum = $opt{'custnum'}; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + +my @cust_pkg = + grep { ! $_->get('cancel') || $cust_main->balance_pkgnum($_->pkgnum) } + $cust_main->all_pkgs; + + -- cgit v1.2.1