ext_description => [],
};
$detail->{'ref'} = $line_item->{'pkgnum'};
+ $detail->{'pkgpart'} = $line_item->{'pkgpart'};
$detail->{'quantity'} = 1;
$detail->{'section'} = $multisection ? $previous_section
: $default_section;
warn "$me setting options\n"
if $DEBUG > 1;
- my $multilocation = scalar($cust_main->cust_location); #too expensive?
my %options = ();
$options{'section'} = $section if $multisection;
$options{'format'} = $format;
$options{'summary_page'} = $summarypage;
$options{'skip_usage'} =
scalar(@$extra_sections) && !grep{$section == $_} @$extra_sections;
- $options{'multilocation'} = $multilocation;
$options{'multisection'} = $multisection;
warn "$me searching for line items\n"
ext_description => [],
};
$detail->{'ref'} = $line_item->{'pkgnum'};
+ $detail->{'pkgpart'} = $line_item->{'pkgpart'};
$detail->{'quantity'} = $line_item->{'quantity'};
$detail->{'section'} = $section;
$detail->{'description'} = &$escape_function($line_item->{'description'});
} } @discounts_avail;
}
+ # debugging hook: call this with 'diag' => 1 to just get a hash of
+ # the invoice variables
+ return \%invoice_data if ( $params{'diag'} );
+
# All sections and items are built; now fill in templates.
my @includelist = ();
push @includelist, 'summary' if $summarypage;
$not_tax{$section} = 1
unless $cust_bill_pkg->pkgnum == 0;
+ # there's actually a very important piece of logic buried in here:
+ # incrementing $late_subtotal{$section} CREATES
+ # $late_subtotal{$section}. keys(%late_subtotal) is later used
+ # to define the list of late sections, and likewise keys(%subtotal).
+ # When _items_cust_bill_pkg is called to generate line items for
+ # real, it will be called with 'section' => $section for each
+ # of these.
if ( $display->post_total && !$summarypage ) {
if (! $type || $type eq 'S') {
$late_subtotal{$section} += $cust_bill_pkg->setup
multisection: a flag indicating that this is a multisection invoice,
which does something complicated.
-multilocation: a flag to display the location label for the package.
-
Returns a list of hashrefs, each of which may contain:
-pkgnum, description, amount, unit_amount, quantity, _is_setup, and
+pkgnum, description, amount, unit_amount, quantity, pkgpart, _is_setup, and
ext_description, which is an arrayref of detail lines to show below
the package line.
my $unsquelched = $opt{unsquelched} || ''; #unused
my $section = $opt{section}->{description} if $opt{section};
my $summary_page = $opt{summary_page} || ''; #unused
- my $multilocation = $opt{multilocation} || '';
my $multisection = $opt{multisection} || '';
my $discount_show_always = 0;
my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50;
my $cust_main = $self->cust_main;#for per-agent cust_bill-line_item-ate_style
+ # and location labels
my @b = ();
my ($s, $r, $u) = ( undef, undef, undef );
if $DEBUG > 1;
foreach my $display ( grep { defined($section)
- ? $_->section eq $section
- : 1
- }
- #grep { !$_->summary || !$summary_page } # bunk!
+ ? $_->section eq $section
+ : 1
+ }
grep { !$_->summary || $multisection }
@cust_bill_pkg_display
)
- {
+ {
warn "$me _items_cust_bill_pkg considering cust_bill_pkg_display ".
$display->billpkgdisplaynum. "\n"
my $cust_pkg = $cust_bill_pkg->cust_pkg;
+ # which pkgpart to show for display purposes?
+ my $pkgpart = $cust_bill_pkg->pkgpart_override || $cust_pkg->pkgpart;
+
# start/end dates for invoice formats that do nonstandard
# things with them
my %item_dates = map { $_ => $cust_bill_pkg->$_ } ('sdate', 'edate');
$cust_pkg->h_labels_short($self->_date, undef, 'I')
unless $cust_bill_pkg->pkgpart_override; #don't redisplay services
- if ( $multilocation ) {
+ if ( ! $cust_pkg->locationnum or
+ $cust_pkg->locationnum != $cust_main->ship_locationnum ) {
my $loc = $cust_pkg->location_label;
$loc = substr($loc, 0, $maxlength). '...'
if $format eq 'latex' && length($loc) > $maxlength;
$s = {
_is_setup => 1,
description => $description,
- #pkgpart => $part_pkg->pkgpart,
+ pkgpart => $pkgpart,
pkgnum => $cust_bill_pkg->pkgnum,
amount => $cust_bill_pkg->setup,
setup_show_zero => $cust_bill_pkg->setup_show_zero,
unless ( $cust_pkg->part_pkg->hide_svc_detail
|| $cust_bill_pkg->itemdesc
|| $cust_bill_pkg->hidden
- || $is_summary && $type && $type eq 'U' )
+ || $is_summary && $type && $type eq 'U'
+ )
{
warn "$me _items_cust_bill_pkg adding service details\n"
warn "$me _items_cust_bill_pkg done adding service details\n"
if $DEBUG > 1;
- if ( $multilocation ) {
+ if ( $cust_pkg->locationnum != $cust_main->ship_locationnum ) {
my $loc = $cust_pkg->location_label;
$loc = substr($loc, 0, $maxlength). '...'
if $format eq 'latex' && length($loc) > $maxlength;
} else {
$r = {
description => $description,
- #pkgpart => $part_pkg->pkgpart,
+ pkgpart => $pkgpart,
pkgnum => $cust_bill_pkg->pkgnum,
amount => $amount,
recur_show_zero => $cust_bill_pkg->recur_show_zero,
} else {
$u = {
description => $description,
- #pkgpart => $part_pkg->pkgpart,
+ pkgpart => $pkgpart,
pkgnum => $cust_bill_pkg->pkgnum,
amount => $amount,
recur_show_zero => $cust_bill_pkg->recur_show_zero,