summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-03-29 17:18:17 -0700
committerMark Wells <mark@freeside.biz>2012-03-29 17:18:17 -0700
commit180c20dc0b463cab61f9c8b31009e18a7be1b5c0 (patch)
tree38b6526eb13ab41c7f5abaf01d26fed72d26f4ef
parent32276032c4c3754b6318b9b70a934a1f8fb52586 (diff)
one-line CSV format for invoice spool, #16382
-rw-r--r--FS/FS/Conf.pm4
-rw-r--r--FS/FS/cust_bill.pm34
2 files changed, 36 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 22a618d86..344dc2aee 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2918,7 +2918,7 @@ and customer address. Include units.',
'section' => 'invoicing',
'description' => 'Enable FTP of raw invoice data - format.',
'type' => 'select',
- 'select_enum' => [ '', 'default', 'billco', ],
+ 'select_enum' => [ '', 'default', 'oneline', 'billco', ],
},
{
@@ -2954,7 +2954,7 @@ and customer address. Include units.',
'section' => 'invoicing',
'description' => 'Enable spooling of raw invoice data - format.',
'type' => 'select',
- 'select_enum' => [ '', 'default', 'billco', ],
+ 'select_enum' => [ '', 'default', 'oneline', 'billco', ],
},
{
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 3aa75eca5..945771e0d 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2005,6 +2005,36 @@ sub print_csv {
'0', # 29 | Other Taxes & Fees*** NUM* 9
);
+ } elsif ( lc($opt{'format'}) eq 'oneline' ) { #name?
+
+ my ($previous_balance) = $self->previous;
+ my $totaldue = sprintf('%.2f', $self->owed + $previous_balance);
+ my @items = map {
+ ($_->{pkgnum} || ''),
+ $_->{description},
+ $_->{amount}
+ } $self->_items_pkg;
+
+ $csv->combine(
+ $cust_main->agentnum,
+ $self->custnum,
+ $cust_main->first,
+ $cust_main->last,
+ $cust_main->address1,
+ $cust_main->address2,
+ $cust_main->city,
+ $cust_main->state,
+ $cust_main->zip,
+
+ # invoice fields
+ time2str("%x", $self->_date),
+ $self->invnum,
+ $self->charged,
+ $totaldue,
+
+ @items,
+ );
+
} else {
$csv->combine(
@@ -2044,6 +2074,10 @@ sub print_csv {
}
+ } elsif ( lc($opt{'format'}) eq 'oneline' ) {
+
+ #do nothing
+
} else {
foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) {