CORE POS - Fannie
The CORE POS back end
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ObfWeeklyReport Class Reference
Inheritance diagram for ObfWeeklyReport:
FannieReportPage FanniePage ObfWeeklyReportV2

Public Member Functions

 preprocess ()
 
 report_description_content ()
 
 fetch_report_data ()
 
 form_content ()
 
- Public Member Functions inherited from FannieReportPage
 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)
 
 setForm (COREPOS\common\mvc\ValueContainer $f)
 
 requiredFields ()
 
 drawPage ()
 
 draw_page ()
 
 baseUnitTest ($phpunit)
 

Public Attributes

 $page_set = 'Plugin :: Open Book Financing'
 
 $report_set = 'Sales Reports'
 
 $description = '[OBF Weekly Report] shows open book financing sales and labor data for a given week.'
 
 $themed = true
 
- Public Attributes inherited from FannieReportPage
 $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

 initTotalSales ()
 
 initTotalTrans ()
 
 initTotalHours ()
 
 initTotalWages ()
 
 getAverageWage ($labor)
 
 projectHours ($splhGoal, $dept_proj, $dept_trend)
 
 projectWages ($labor, $proj_hours, $trend_hours)
 
 rewritePercentageOfSales ($data, $total_sales)
 
 headerRow ($header, $text='black')
 
 percentGrowth ($a, $b)
 
 findYearMonth ($start_ts, $end_ts)
 
 updateSalesCache ($week, $num_cached, $dateInfo)
 
 prepareStatements ($dbc)
 
 prepTrendsStatement ($dbc, $week)
 
 getStock ($dbc, $args)
 
 ownershipThisWeek ($dbc, $start_ts, $end_ts, $start_ly, $end_ly)
 
 ownershipThisYear ($dbc, $end_ts)
 
 calculateTrend ($dbc, $categoryID, $superID)
 
- Protected Member Functions inherited from FannieReportPage
 hasAllFields ($fields)
 
 hasWarehouseSource ()
 
 getData ()
 
 multiContent ($data)
 
 singleContent ($data)
 
 format ($data)
 
 checkDataCache ()
 
 freshenCache ($data)
 
 defaultDescriptionContent ($rowcount, $datefields=array())
 
 formatCheck ()
 

Protected Attributes

 $header = 'OBF: Weekly Report'
 
 $title = 'OBF: Weekly Report'
 
 $required_fields = array('weekID')
 
 $new_tablesorter = false
 
 $report_headers
 
 $class_lib = 'ObfLib'
 
 $colors
 
 $salesP = null
 
 $quarterSalesP = null
 
 $quarterLaborP = null
 
 $quarterSplhP = null
 
 $stockP = null
 
 $trendP = null
 
- Protected Attributes inherited from FannieReportPage
 $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
 
 $new_tablesorter = false
 
 $no_jquery = false
 
 $chart_label_column = 0
 
 $chart_data_columns = array()
 
 $form
 

Member Function Documentation

ObfWeeklyReport::fetch_report_data ( )

Timestamps for the start and end of the current week

Use the entire month from the previous calendar year as the time period for year-over-year comparisons

Sales information is cached to avoid expensive aggregate queries

LOOP ONE Examine OBF Categories that have sales. These will include both sales and labor information

Go through sales records for the category

total sales for the category

Now labor values based on sales calculationsabove

LOOP TWO Examine OBF Categories without sales. These will include only labor information

Storewide totals section

ObfWeeklyReport::findYearMonth (   $start_ts,
  $end_ts 
)
protected

Determine which month a given week falls in. If the first and last day of the week are not in the same month, choose whichever month 4+ days of the week belong to

ObfWeeklyReport::initTotalHours ( )
protected

Information about labor hours

  • actual => actual hours for the current week
  • projected => planned hours for the current week based on sales growth and SPLH goals
  • trend => expected hours for the current week based on recent history sales trends and SPH goals
  • quarterActual => actual hours for the quarter
  • quarterProjected => planned hours for the quarter based on sales growth goals

See sales above for more info about "Quarters"

ObfWeeklyReport::initTotalSales ( )
protected

Information about sales

  • thisYear => sales for the current week
  • lastYear => sales for the same week last year
  • projected => planned sales for the current week based on sales growth goals
  • trend => expected sales for the current week based on recent history sales trends
  • quarterActual => actual sales for the quarter
  • quarterProjected => planned sales for the quarter based on sales growth goals
  • quarterLaborSales => actual sales for the quarter as defined by labor measurements

"Quarter" is not necessarily a calendar quarter. It's whatever period is currently defined for the "long-term" over under column. This period can be defined separately for sales and labor. A separate sales number is always tracked in concert with the long-term labor period so that the long-term sales per labor hour number makes sense.

ObfWeeklyReport::initTotalTrans ( )
protected

Information about number of transactions

  • thisYear => transactions for the current week
  • lastYear => transactions for the same week last year
  • quarterThisYear => transactions for the quarter
  • quarterLastYear => transactions for the same quarter year-over-year

See sales above for more info about "Quarters"

ObfWeeklyReport::initTotalWages ( )
protected

Information about wages. Fields are the same as hours.

ObfWeeklyReport::prepareStatements (   $dbc)
protected

Look up sales for the week in a given category

Look up sales for the [sales] quarter in a given category

Look up labor for the [labor] quarter in a given category

Look up sales for the [labor] quarter in a given category

Since the "quarter" can differ for long-term sales and long-term labor, this value is needed to calculate long-term SPLH correctly.

ObfWeeklyReport::prepTrendsStatement (   $dbc,
  $week 
)
protected

Trends are based on the previous thirteen weeks that contain sales data. First build a list of week IDs, then prepare statement to query a specific category of sales data.

ObfWeeklyReport::rewritePercentageOfSales (   $data,
  $total_sales 
)
protected

Now that total sales for the all categories have been calculated, go back and divide specific columns by total sales to get percentage of sales

ObfWeeklyReport::updateSalesCache (   $week,
  $num_cached,
  $dateInfo 
)
protected

Lookup total sales for each category in a given date range

Lookup number of transactions in a given date range

Lookup tables for current week and year-over-year comparison

Lookup number of transactions for the current week and save that information if the week is complete

Lookup sales for the current week. Actual sales is zeroed out until the week is complete, but the records are saved as placeholders for later

Now lookup year-over-year info Since it examines a whole month rather than a single week, we'll take the average and then extend that out to seven days

Transactions last year, pro-rated

Sales last year, pro-rated

plugged new store numbers

Member Data Documentation

ObfWeeklyReport::$colors
protected
Initial value:
= array(
'#CDB49B',
'#99C299',
'#CDB49B',
'#99C299',
'#CDB49B',
'#99C299',
'#CDB49B',
'#99C299',
'#CDB49B',
'#6685C2',
'#FF4D4D',
'#99C299',
'#C299EB',
'#FFB280',
'#FFFF66',
)
ObfWeeklyReport::$report_headers
protected
Initial value:
= array(
array('', 'Last Year', 'Plan Goal', '% Store', 'Trend', 'Actual', '% Growth', '% Store', 'Current O/U', 'Long-Term O/U'),
array('', 'Last Year', 'Plan Goal', '% Store', 'Trend', 'Actual', '% Growth', '% Store', 'Current O/U', 'Long-Term O/U'),
array('', 'Last Year', 'Plan Goal', '% Store', 'Trend', 'Actual', '% Growth', '% Store', 'Current O/U', 'Long-Term O/U'),
array('', 'Last Year', 'Plan Goal', '% Store', 'Trend', 'Actual', '% Growth', '% Store', 'Current O/U', 'Long-Term O/U'),
array('', 'Last Year', 'Plan Goal', '% Store', 'Trend', 'Actual', '% Growth', '% Store', 'Current O/U', 'Long-Term O/U'),
array('', 'Last Year', 'Plan Goal', '% Store', 'Trend', 'Actual', '% Growth', '% Store', 'Current O/U', 'Long-Term O/U'),
array('', 'Current Year', 'Last Year', '', '', '', '', '', '', ''),
)

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