{if $all_zeroes}
{* Too easy to shoot yourself in the foot *}
[`Not enough sales data to build cohort chart for the selected period.`]
{/if}
[`Group by`]:
{$group_by_options = [
'weeks' => "[`week`]",
'months' => "[`month`]",
'quarters' => "[`quarters`]"
]}
{if $table_data}
{if $group_by == 'quarters'} {$header_str = "[`Quarter %s`]"} {elseif $group_by == 'months'} {$header_str = "[`Month %s`]"} {elseif $group_by == 'weeks'} {$header_str = "[`Week %s`]"} {else} {$header_str = "[`Day %s`]"} {/if} {foreach $table_data as $row} | {sprintf($header_str, $row@index + 1)} | {/foreach}[`Total`] | {/strip}|
---|---|---|---|
{$table_headers[$reg_date]} | {foreach array_keys($table_data) as $col_date}{strip} {if empty($row[$col_date@index])}{else} {$stats = $row[$col_date@index]} {$percent = 100-$stats.percent_of_max} {$_bg_style = "linear-gradient(to bottom, transparent 0%, transparent {number_format($percent,2)}%, {$stats.color} {number_format($percent,2)}%, {$stats.color} 100%)"} {if !empty($request_options.type) && $request_options.type == "roi" && (round($stats.metric) <= 100)} {$_image_url = "{$wa_url}wa-apps/shop/img/patterns/white-pattern.png"} {$_bg_style = "background: url('{$_image_url}'), {$_bg_style};"} {else} {$_bg_style = "background: {$_bg_style};"} {/if} | {if in_array(ifset($request_options.type), ['sales', 'profit', 'clv'])} {wa_currency_html($stats.metric, $def_cur)} {elseif ifset($request_options.type) == 'roi'} {round($stats.metric)}% {else} {round($stats.metric, 2)} {/if} | {/if} {/strip}{/foreach}{strip} {if in_array(ifset($request_options.type), ['sales', 'profit', 'clv'])} {wa_currency_html($table_totals[$reg_date], $def_cur)} {elseif ifset($request_options.type) == 'roi'} {round($table_totals[$reg_date])}% {else} {round($table_totals[$reg_date], 2)} {/if} {/strip} |