X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FReport%2FTable%2FMonthly.pm;h=0ff7efd16c43424525b706d30fd2077cc54549e1;hb=98ea15536afc6896cce08a41b877d6cb52444d14;hp=d75f0be79f7eb3c00fb3347579e5e2a1cb076f4f;hpb=978fea1c303551f90c95ae852b6463951b78246b;p=freeside.git diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm index d75f0be79..0ff7efd16 100644 --- a/FS/FS/Report/Table/Monthly.pm +++ b/FS/FS/Report/Table/Monthly.pm @@ -2,10 +2,9 @@ package FS::Report::Table::Monthly; use strict; use vars qw( @ISA ); -use Time::Local; -use FS::UID qw( dbh ); +use FS::UID qw(dbh); use FS::Report::Table; -use FS::CurrentUser; +use Time::Local qw( timelocal ); @ISA = qw( FS::Report::Table ); @@ -25,6 +24,8 @@ FS::Report::Table::Monthly - Tables of report data, indexed monthly 'end_year' => 2020, #opt 'agentnum' => 54 + 'refnum' => 54 + 'cust_classnum' => [ 1,2,4 ], 'params' => [ [ 'paramsfor', 'item_one' ], [ 'item', 'two' ] ], # ... 'remove_empty' => 1, #collapse empty rows, default 0 'item_labels' => [ ], #useful with remove_empty @@ -32,49 +33,186 @@ FS::Report::Table::Monthly - Tables of report data, indexed monthly my $data = $report->data; -=head1 METHODS +=head1 PARAMETERS + +=head2 TIME PERIOD + +C, C, C, and C specify the date +range to be included in the report. The start and end months are included. +Each month's values are summed from midnight on the first of the month to +23:59:59 on the last day of the month. + +=head2 REPORT ITEMS + +=over 4 + +=item items: An arrayref of observables to calculate for each month. See +L for a list of observables and their parameters. + +=item params: An arrayref, parallel to C, of arrayrefs of parameters +(in paired name/value form) to be passed to the observables. + +=item cross_params: Cross-product parameters. This must be an arrayref of +arrayrefs of parameters (paired name/value form). This creates an additional +"axis" (orthogonal to the time and C axes) in which the item is +calculated once with each set of parameters in C. These +parameters are merged with those in C. Instead of being nested two +levels, C will be nested three levels, with the third level +corresponding to this arrayref. + +=back + +=head2 FILTERING + +=over 4 + +=item agentnum: Limit to customers with this agent. + +=item refnum: Limit to customers with this advertising source. + +=item cust_classnum: Limit to customers with this classnum; can be an +arrayref. + +=item remove_empty: Set this to a true value to hide rows that contain +only zeroes. The C array in the returned data will list the item +indices that are actually present in the output so that you know what they +are. Ignored if C is in effect. + +=back + +=head2 PASS-THROUGH + +C, C, and C may be specified as arrayrefs +parallel to C. Those values will be returned in C, with any +hidden rows (due to C) filtered out, which is the only +reason to do this. Now that we have C it's probably better to +use that. + +=item PROCESSING + +=item normalize: Set this to an item index to have all other items expressed +as a percentage of that one. That item will then be omitted from the output. +If the normalization item is zero in some period, all the values in that +period will be undef. + +=head1 RETURNED DATA + +The C method runs the report and returns a hashref of the following: =over 4 +=item label + +Month labels, in MM/YYYY format. + +=item speriod, eperiod + +Absolute start and end times of each month, in unix time format. + +=item items + +The values passed in as C, with any suppressed rows deleted. + +=item indices + +The indices of items in the input C list that appear in the result +set. Useful for figuring out what they are when C has deleted +some items. + +=item item_labels, colors, links - see PASS-THROUGH above + =item data -Returns a hashref of data (!! describe) +The actual results. An arrayref corresponding to C