- sub {
- my $latanum = shift->latanum;
- my @dids = qsearch('phone_avail',
- { 'svcnum' => '',
- 'latanum' => $latanum,
- }
- );
- return scalar(@dids);
- },
- sub {
- my $latanum = shift->latanum;
- my @dids = provisioned_dids($latanum);
- return scalar(@dids);
- },
- sub {
- my $latanum = shift->latanum;
- my @dids = provisioned_dids($latanum);
- my $count = 0;
- foreach my $did ( @dids ) {
- next unless $did->cust_svc;
- my $svc_phone = $did->cust_svc->svc_x;
- next unless $svc_phone;
- my @cdrs = $svc_phone->get_cdrs;
- $count++ if scalar(@cdrs);
- }
- $count;
- },
+ sub { # LATA Description
+ my $phone_avail = shift;
+ return '' unless $phone_avail->lata;
+ $phone_avail->lata->description;
+ },
+ sub { # Available
+ my $latanum = shift->latanum;
+ my $cnt = qsearchs({ 'table' => 'phone_avail',
+ 'hashref' =>
+ { 'svcnum' => '',
+ 'latanum' => $latanum,
+ },
+ 'select' => 'count(1) as cnt',
+ });
+ ($cnt) ? $cnt->cnt : '';
+ },
+ sub { # Provisioned
+ my $latanum = shift->latanum;
+ my $cnt = qsearchs({ 'table' => 'phone_avail',
+ 'hashref' => { 'latanum' => $latanum,
+ 'svcnum' => { op => '>',
+ value => '0'
+ },
+ },
+ 'select' => 'count(1) as cnt'
+ });
+ ($cnt) ? $cnt->cnt : '';
+ },
+ sub { # Have Usage
+ my $phone_avail = shift;
+ return '' unless $phone_avail->lata;
+ $phone_avail->lata->have_usage;
+ },