show discounts on invoices as negative line items, #31273
[freeside.git] / FS / FS / cdr / orcon.pm
1 package FS::cdr::orcon;
2
3 use strict;
4 use vars qw( @ISA %info);
5 use FS::cdr;
6 use Date::Parse;
7
8 @ISA = qw(FS::cdr);
9
10 %info = (
11   'name'          => 'Orcon',
12   'weight'        => 120,
13   'header'        => 1,
14   'import_fields' => [
15
16         skip(1)      ,  #id
17         skip(1)      ,  #billing period
18         'accountcode',  #account number
19         skip(2),        #username
20                         #service id
21         sub { my ($cdr, $calldate, $param) = @_;
22         
23                 $cdr->set('calldate', $calldate);
24
25                 if ($calldate =~ /^(\d{4})-(\d{2})-(\d{2})\s*(\d{2}):(\d{2}):(\d{2})$/){
26
27                 my $tmp_date = "$2/$3/$1 $4:$5:$6";
28
29                 $tmp_date = str2time($tmp_date);
30                 $cdr->set('startdate', $tmp_date);
31         
32                 } else {
33
34                         $param->{skiprow} = 1
35                 }
36                   },    #date
37         skip(1),        #tariff region
38         'src',          #originating number
39         'dst',          #terminating number
40         'duration',      #duration actual
41         'billsec',      #duration billed
42         skip(1),        #discount
43         'upstream_price',#charge
44
45   ],
46 );
47
48 sub skip { map {''} (1..$_[0]) }
49
50 1;
51