- \%data;
-
-}
-
-sub invoiced { #invoiced
- my( $self, $speriod, $eperiod ) = ( shift, shift, shift );
- $self->scalar_sql("
- SELECT SUM(charged) FROM cust_bill
- WHERE ". $self->in_time_period($speriod, $eperiod)
- );
-}
-
-sub netsales { #net sales
- my( $self, $speriod, $eperiod ) = ( shift, shift, shift );
-
- my $credited = $self->scalar_sql("
- SELECT SUM(cust_credit_bill.amount)
- FROM cust_credit_bill, cust_bill
- WHERE cust_bill.invnum = cust_credit_bill.invnum
- AND ". $self->in_time_period($speriod, $eperiod, 'cust_bill')
- );
-
- #horrible local kludge
- my $expenses = !$expenses_kludge ? 0 : $self->scalar_sql("
- SELECT SUM(cust_bill_pkg.setup)
- FROM cust_bill_pkg, cust_bill, cust_pkg, part_pkg
- WHERE cust_bill.invnum = cust_bill_pkg.invnum
- AND ". $self->in_time_period($speriod, $eperiod, 'cust_bill'). "
- AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum
- AND cust_pkg.pkgpart = part_pkg.pkgpart
- AND LOWER(part_pkg.pkg) LIKE 'expense _%'
- ");
-
- $self->invoiced($speriod,$eperiod)-$credited-$expenses;
-}
-
-#deferred revenue
-
-sub receipts { #cashflow
- my( $self, $speriod, $eperiod ) = ( shift, shift, shift );
-
- #cashflow
- my $paid = $self->scalar_sql("
- SELECT SUM(paid) FROM cust_pay
- WHERE ". $self->in_time_period($speriod, $eperiod)
- );
+ #these need to get generalized, sheesh
+ $data{'items'} = $self->{'items'};
+ $data{'item_labels'} = $self->{'item_labels'} || $self->{'items'};
+ $data{'colors'} = $self->{'colors'};
+ $data{'links'} = $self->{'links'} || [];
+
+ if ( $self->{'remove_empty'} ) {
+
+ my $col = 0;
+ #these need to get generalized, sheesh
+ my @newitems = ();
+ my @newlabels = ();
+ my @newdata = ();
+ my @newcolors = ();
+ my @newlinks = ();
+ foreach my $item ( @{$self->{'items'}} ) {