& /elements/header-popup.html, 'Credit line items' &>
<% include( '/elements/xmlhttp.html', 'url' => $p.'misc/xmlhttp-cust_bill_pkg-calculate_taxes.html', 'subs' => [ 'calculate_taxes' ], ) %> <%init> my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('Credit line items'); #a tiny bit of false laziness w/search/cust_bill_pkg.cgi, but we're pretty # specialized and a piece of UI, not a report #slightly more false laziness w/httemplate/edit/elements/ApplicationCommon.html # show_taxes & calc_total here/do_calculate_tax there my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; my $custnum = $1; my $cust_main = qsearchs({ 'table' => 'cust_main', 'hashref' => { 'custnum' => $custnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, }) or die 'unknown customer'; my @cust_bill_pkg = qsearch({ 'select' => 'cust_bill_pkg.*', 'table' => 'cust_bill_pkg', 'addl_from' => 'LEFT JOIN cust_bill USING (invnum)', 'extra_sql' => "WHERE custnum = $custnum ". "AND (pkgnum != 0 or feepart IS NOT NULL)", 'order_by' => 'ORDER BY invnum ASC, billpkgnum ASC', }); my @items = map { my %hash = $_->disintegrate; map [ $_, $hash{$_} ], keys(%hash); } @cust_bill_pkg; #omit line items which have been previously credited? would be nice %init>