use FS::cust_bill_pay_batch;
use FS::part_bill_event;
use FS::payby;
-use FS::bill_batch;
-use FS::cust_bill_batch;
@ISA = qw( FS::cust_main_Mixin FS::Record );
'notice_name' => $notice_name,
);
- if($conf->exists('invoice_print_pdf')) {
- # Add the invoice to the current batch.
- $self->batch_invoice(\%opt);
- }
- else {
- do_print $self->lpr_data(\%opt);
- }
+ do_print $self->lpr_data(\%opt);
}
=item fax_invoice HASHREF | [ TEMPLATE ]
}
-=item batch_invoice [ HASHREF ]
-
-Place this invoice into the open batch (see C<FS::bill_batch>). If there
-isn't an open batch, one will be created.
-
-=cut
-
-sub batch_invoice {
- my ($self, $opt) = @_;
- my $batch = FS::bill_batch->get_open_batch;
- my $cust_bill_batch = FS::cust_bill_batch->new({
- batchnum => $batch->batchnum,
- invnum => $self->invnum,
- });
- return $cust_bill_batch->insert($opt);
-}
-
=item ftp_invoice [ TEMPLATENAME ]
Sends this invoice data via FTP.
}
- my $agentnum = $self->cust_main->agentnum;
-
my %invoice_data = (
#invoice from info
- 'company_name' => scalar( $conf->config('company_name', $agentnum) ),
- 'company_address' => join("\n", $conf->config('company_address', $agentnum) ). "\n",
+ 'company_name' => scalar( $conf->config('company_name', $self->cust_main->agentnum) ),
+ 'company_address' => join("\n", $conf->config('company_address', $self->cust_main->agentnum) ). "\n",
'returnaddress' => $returnaddress,
'agent' => &$escape_function($cust_main->agent->agent),
'smallerfooter' => $conf->exists('invoice-smallerfooter'),
'balance_due_below_line' => $conf->exists('balance_due_below_line'),
- #layout info -- would be fancy to calc some of this and bury the template
- # here in the code
- 'topmargin' => scalar($conf->config('invoice_latextopmargin', $agentnum)),
- 'headsep' => scalar($conf->config('invoice_latexheadsep', $agentnum)),
- 'textheight' => scalar($conf->config('invoice_latextextheight', $agentnum)),
- 'extracouponspace' => scalar($conf->config('invoice_latexextracouponspace', $agentnum)),
- 'couponfootsep' => scalar($conf->config('invoice_latexcouponfootsep', $agentnum)),
- 'verticalreturnaddress' => $conf->exists('invoice_latexverticalreturnaddress', $agentnum),
- 'addresssep' => scalar($conf->config('invoice_latexaddresssep', $agentnum)),
- 'amountenclosedsep' => scalar($conf->config('invoice_latexcouponamountenclosedsep', $agentnum)),
- 'coupontoaddresssep' => scalar($conf->config('invoice_latexcoupontoaddresssep', $agentnum)),
- 'addcompanytoaddress' => $conf->exists('invoice_latexcouponaddcompanytoaddress', $agentnum),
-
# better hang on to conf_dir for a while (for old templates)
'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
$invoice_data{'previous_balance'} = sprintf("%.2f", $pr_total);
$invoice_data{'balance'} = sprintf("%.2f", $balance_due);
+ my $agentnum = $self->cust_main->agentnum;
+
my $summarypage = '';
if ( $conf->exists('invoice_usesummary', $agentnum) ) {
$summarypage = 1;
foreach my $section (@sections, @$late_sections) {
- # begin some normalization
- $section->{'subtotal'} = $section->{'amount'}
- if $multisection
- && !exists($section->{subtotal})
- && exists($section->{amount});
-
$invoice_data{finance_amount} = sprintf('%.2f', $section->{'subtotal'} )
if ( $invoice_data{finance_section} &&
$section->{'description'} eq $invoice_data{finance_section} );
sprintf('%.2f', $section->{'subtotal'})
if $multisection;
- # continue some normalization
+ # begin some normalization
$section->{'amount'} = $section->{'subtotal'}
if $multisection;