{if $list} {assign var=total_qty value=0} {assign var=total_sum value=0} {if $fields_count == 1 and in_array('order_id', $fields) or $fields_count == 2 and in_array('order_id', $fields) and in_array('date', $fields)} {assign var=only_order_id value=true} {else} {assign var=only_order_id value=false} {/if} {if $PRINTABLE}

{$LABEL.lbl_sales_stat} ({$CONFIG.settings.shop_name})

{$LABEL.lbl_time_period}: {$from_date} - {$to_date}
{$LABEL.lbl_category}: {$category}
{$LABEL.lbl_product}: {$product}

{/if} {if not $PRINTABLE}

{$LABEL.lbl_printable}

{/if} {foreach from=$fields item=field} {if $field eq 'caption'} {elseif $field eq 'sku'} {elseif $field eq 'date'} {elseif $field eq 'order_id'} {/if} {/foreach} {if not $only_order_id} {/if} {foreach from=$list item=item name=list} {foreach from=$fields item=field} {if $field eq 'caption'} {elseif $field eq 'sku'} {elseif $field eq 'date'} {elseif $field eq 'order_id'} {/if} {/foreach} {if not $only_order_id} {/if} {assign var=total_qty value=$total_qty+$item.product_qty} {if $only_order_id} {assign var=total_sum value=$total_sum+$item.product_price} {else} {assign var=total_sum value=$total_sum+$item.product_price*$item.product_qty} {/if} {/foreach} {foreach from=$fields item=field} {if $field eq 'order_id'} {else} {/if} {/foreach} {if not $only_order_id} {/if}
 {$LABEL.lbl_designation}{$LABEL.lbl_sku}{$LABEL.lbl_date}{$LABEL.lbl_order_id}{$LABEL.lbl_price}, {$BASE_CURRENCY.short_name}{$LABEL.lbl_qty2} {$LABEL.thead_sum}, {$BASE_CURRENCY.short_name}
  {if $item.product_id and fn_check_admin_rights('products', 'edit') and not $PRINTABLE} {$item.product_caption} {else} {$item.product_caption} {/if} {if $item.product_id and fn_check_admin_rights('products', 'edit') and not $PRINTABLE} {$item.product_sku} {else} {$item.product_sku} {/if} {$item.date} {if fn_check_admin_rights('orders', 'details') and not $PRINTABLE} {$item.order_id} {else} {$item.order_id} {/if} {$item.product_price}{$item.product_qty} {if $only_order_id} {$item.product_price} {else} {$item.product_price*$item.product_qty} {/if}
{$LABEL.lbl_summary}:{$total_orders_qty}  {$total_qty} {$total_sum}
{else} {$LABEL.lbl_empty_list} {/if}