CORE POS - Fannie
The CORE POS back end
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
FannieReportPage Class Reference
Inheritance diagram for FannieReportPage:
FanniePage ActivityReport ArReport BasketLimitedReport BatchReport CashierPerformanceReport CashierRecordsReport CCReport CorrelatedMovementReport CouponsReport CustomerCountReport CustomerPurchasesReport CWBasketReport CWDemographicsReport CWTransactionsReport DDDReport DepartmentMovementReport DeptSettingsReport DeptTransactionsReport DiscountsReport DraftPatronageReport EquityAllReport EquityReport GeneralDayReport GeneralRangeReport GeneralSalesReport GumBothReport GumDividendReport GumDividendTaxReport GumEquityReport GumInterestReport GumIssuedDividendReport GumLoanReport GumMailingList GumPeopleReport HourlyCustomersReport HourlySalesReport HourlyTransReport ItemLastQuarterReport ItemOrderHistoryReport ItemPurchasesReport LocalInvoicesReport LocalMixReport ManufacturerMovementReport MarginMovementReport MembersReport MemberSummaryReport MonthOverMonthReport NewItemsReport NonMovementReport ObfWeeklyReport OpenRingsReport OwnerJoinLeaveReport PatronageChecksReport PatronageReport PayrollARReport PcDailyReport PercentageOfSalesReport PPODayEnd PriceHistoryReport PriceMovementReport ProductHistoryReport ProductLineReport ProductMovementModular ProgramEventsReport RecallReport RecentSalesReport SalePerformanceReport ScaleItemsReport SmartMovementReport StockSummaryReport StoreSummaryReport StoreSummaryReportAlt SuspensionHistoryReport SuspensionsReport TenderInOutReport TimesheetExport TimesheetGeneralReport TrendsReport UnfiExportForMas VendorMovementReport VendorSalesReport VotenetReport WeeklySalesReport WfcHtCsvDump WfcHtFinal WfcHtReport WfcHtSalesLaborReport WfcPtoStudy ZipCodeReport

Public Member Functions

 preprocess ()
 
 form_content ()
 
 bodyContent ()
 
 report_content ()
 
 both_content ()
 
 calculate_footers ($data)
 
 assign_headers ()
 
 select_headers ($incrIndex=False)
 
 report_description_content ()
 
 report_end_content ()
 
 fetch_report_data ()
 
 render_data ($data, $headers=array(), $footers=array(), $format='html')
 
 dekey_array ($arr)
 
 htmlLine ($row, $header=False)
 
 csvLine ($row)
 
 excelFormat ($item, $style='')
 
 xlsMeta ($data)
 
 drawPage ()
 
 draw_page ()
 

Public Attributes

 $required = True
 
 $description
 
 $page_set = 'Reports'
 
 $report_set = ''
 
 $discoverable = true
 
const META_BOLD = 1
 
const META_BLANK = 2
 
const META_REPEAT_HEADERS = 4
 
const META_CHART_DATA = 8
 
const META_COLOR = 16
 

Protected Member Functions

 format ($data)
 
 checkDataCache ()
 
 freshenCache ($data)
 
 defaultDescriptionContent ($datefields=array())
 
 formatCheck ()
 

Protected Attributes

 $content_function = "form_content"
 
 $required_fields = array()
 
 $report_headers = array()
 
 $report_format = 'html'
 
 $report_cache = 'none'
 
 $multi_report_mode = False
 
 $multi_counter = 1
 
 $header_index = 0
 
 $sortable = true
 
 $no_sort_but_style = false
 
 $sort_column = 0
 
 $sort_direction = 0
 
 $no_jquery = false
 
 $chart_label_column = 0
 
 $chart_data_columns = array()
 

Member Function Documentation

FannieReportPage::assign_headers ( )

Assign new values to $report_headers, which is intially assigned in the report, usually for 2nd+ reports in multi_report_mode.

FannieReportPage::both_content ( )

Displays both form_content and report_content

Returns
html string
FannieReportPage::calculate_footers (   $data)

Calculate a footer row

Parameters
$dataan two-dimensional array of data
Returns
array of footer values

Principally, footers are separate from data so they can be marked in such in HTML rendering and stay at the bottom when data sorting changes.

This function may also be used to set values for headers or default sorting. On more elaborate reports, the number of columns may vary depending on what options are selected. This function is always called so those values will be set reliably even if caching is enabled.

FannieReportPage::checkDataCache ( )
protected

Look for cached SQL data

Data is stored in the archive database, reportDataCache table.

The key column is an MD5 hash of the current URL (minus the excel parameter, if present). This means your forms should use type GET if caching is enabled.

The data is stored as a serialized, gzcompressed string.

FannieReportPage::csvLine (   $row)

Turn array into CSV line

Parameters
$rowan array of data
Returns
CSV string
FannieReportPage::defaultDescriptionContent (   $datefields = array())
protected

Standard lines to include above report data

Parameters
$datefields[array] names of one or two date fields in the GET/POST data. The fields "date", "date1", and "date2" are detected automatically.
Returns
array of description lines
FannieReportPage::dekey_array (   $arr)

Convert keyed array to numerical indexes and maintain order

FannieReportPage::drawPage ( )

Check for input and display the page

Use FanniePage::drawPage for the plain old html version of the page

Global setting overrides default behavior to force the menu to appear. Unlike normal pages, the override is only applied when the output format is HTML.

FannieReportPage::excelFormat (   $item,
  $style = '' 
)

Remove formatting from cell contents for Excel formats

FannieReportPage::fetch_report_data ( )

Get the report data

Returns
a two dimensional array

Actual SQL queries go here!

If using multi_report_mode, this should return an array of two dimensional arrays where each two dimensional arrays contains a report's data.

FannieReportPage::form_content ( )

Define the data input form

Returns
An HTML string
FannieReportPage::format (   $data)
protected

Apply formatting to data. This method can be used to add markup to records - e.g., links to other content.

Parameters
$datatwo-dimensional array of report data
Returns
two-dimensional array of report data
FannieReportPage::formatCheck ( )
protected

Helper: check default export args

Verify whether PEAR is available. If it is not, fall back to CSV output. Should probably generate some kind of log message or notification.

FannieReportPage::freshenCache (   $data)
protected

Store SQL data in the cache

Parameters
$datathe data
Returns
True or False based on success

See checkDataCache for details

FannieReportPage::htmlLine (   $row,
  $header = False 
)

Turn array into HTML table row

Parameters
$rowan array of data
$headerTrue means

tags, False means

tags

Returns
HTML string

Javascript sorting utility requires header rows to be

tags

FannieReportPage::preprocess ( )

Handle pre-display tasks such as input processing

Returns
  • True if the page should be displayed
  • False to stop here

The default version will check required_fields to determine whether the form_content or report_content method should be called. It also the value of "excel" for the request and sets necessary output options.

FannieReportPage::render_data (   $data,
  $headers = array(),
  $footers = array(),
  $format = 'html' 
)

Format data for display

Parameters
$dataa two dimensional array of data
$headersa header row (optional)
$formatoutput format (html | xls | csv)
Returns
formatted string

Detect PEAR and only offer XLS if the system is capable.

FannieReportPage::report_content ( )

Define the report display

Returns
An HTML string

Generally this function is not overriden.

This will first check the cache to see if data for this report has been saved. If not, it will look up the data by calling the fetch_report_data function. That function should be overriden.

Once the data is retrieved, this will call the calculate_footers function on the data. Footers are not required, but it's useful for some final calculations.

Finally, the render_data function is called. Overriding that is not recommended.

Use CoreWarehouse data source if requested & available Fail back to FannieReportPage::fetch_report_data() if a data source cannot be found or data source fails to handle the request

For XLS multi-report ouput, re-assemble the reports into a single long array of rows (dataset).

FannieReportPage::report_description_content ( )

Extra, non-tabular information prepended to reports

Returns
array of strings
FannieReportPage::report_end_content ( )

Extra, non-tabular information appended to reports

Returns
array of strings
FannieReportPage::select_headers (   $incrIndex = False)

Return a single-dimension array of headers (column-heads).

Parameters
@returnarray of header values

Allow for but not require different headers on each report. Input may be one- or two-dimensional. If the latter, index is header_index. If headers[x] doesn't exist use the last one that does exist or empty if none exists.

FannieReportPage::xlsMeta (   $data)

Apply meta rules to XLS data

Member Data Documentation

FannieReportPage::$chart_data_columns = array()
protected

Column(s) containing chart data values. An empty array signifies means every column except the label contains data.

FannieReportPage::$chart_label_column = 0
protected

Column containing chart labels.

FannieReportPage::$content_function = "form_content"
protected

Function for drawing page content. form_content and report_content are provided by default.

FannieReportPage::$description
Initial value:
= "
Base class for creating reports.
"

Description of the report

FannieReportPage::$multi_report_mode = False
protected

Allow for reports that contain multiple separate tables of data. If all the reports are the same width, using META_BLANK and/or META_REPEAT_HEADERS may be preferrable.

FannieReportPage::$no_jquery = false
protected

Disable inclusion of jquery. In rare cases the report content may be embedded in a page that already included jquery and multiple copies included can cause problems.

FannieReportPage::$no_sort_but_style = false
protected

Apply CSS to table but not sorting JS. May become default behavior if it does not mess up current unsorted reports

FannieReportPage::$report_cache = 'none'
protected

Enable caching of SQL data. Valid values are: none, day, month

FannieReportPage::$report_format = 'html'
protected

Define report format. Valid values are: html, xls, csv

FannieReportPage::$report_headers = array()
protected

Define report headers. Headers are necessary if sorting is desired

FannieReportPage::$report_set = ''

Assign report to a "set" of reports

FannieReportPage::$required_fields = array()
protected

If fields are present in the request, the form has been submitted and report can be displayed

FannieReportPage::$sort_column = 0
protected

Which column to sort by default

FannieReportPage::$sort_direction = 0
protected

Sort direction. 0 is ascending, 1 is descending

FannieReportPage::$sortable = true
protected

Option to enable/disable javascript sorting

const FannieReportPage::META_BOLD = 1

Assign meta constant(s) to a row's "meta" field for special behavior.

Bold is self-explanatory. Blank will insert a blank line and repeat headers will repeat the report_headers. The latter two will terminate the current <tbody> and start a new one. This breaks the report into separately sortable chunks.


The documentation for this class was generated from the following file: