'erp_purchases_by_supplier', 'label' => 'Purchases by supplier', 'description' => 'What the shop bought from each supplier, from the scanned purchase invoices: documents, item lines, net spend and estimated VAT, with credit notes already subtracted.', 'footnote' => 'Sums come from the parsed invoice lines, not the documents\' totals boxes. Delivery notes carry goods, not money, and are not counted here. Rows are per supplier per currency, and the footer totals only mean something while a single currency is filtered. VAT is estimated as net times the line\'s rate; lines with no readable rate contribute zero. Documents still in review are included and counted in their own column.', 'group' => 'eshop_insights', 'section' => 'comparative_turnover', 'icon' => 'building', 'tier' => 'pro', 'scope' => 'local', 'source' => 'sql', 'sql' => $aieo_pbs_sql, 'registry_id' => 'erp_purchases_by_supplier.by_supplier', 'version' => '1', 'per_page' => 50, 'row_key' => 'row_uid', 'default_sort' => array( 'net_purchases', 'desc' ), 'empty_state' => 'No purchase invoices scanned yet. Documents arrive through the Invoice Scanner; once the first invoice is read, its supplier appears here.', 'chart' => array( 'type' => 'bar', 'x' => 'supplier', 'y' => array( 'net_purchases' ), 'limit' => 12, ), 'columns' => array( array( 'key' => 'row_uid', 'label' => 'Key', 'type' => 'id', 'hidden' => true, ), array( 'key' => 'supplier', 'label' => 'Supplier', 'type' => 'text', 'sortable' => true, 'searchable' => true, 'filter' => 'text', 'truncate' => 40, 'tooltip' => true, 'empty' => '— unidentified —', ), array( 'key' => 'supplier_vat', 'label' => 'VAT no.', 'type' => 'code', 'searchable' => true, 'empty' => '—', ), array( 'key' => 'currency', 'label' => 'Currency', 'type' => 'code', 'width' => '80px', 'sortable' => true, 'filter' => 'select', ), array( 'key' => 'documents', 'label' => 'Documents', 'type' => 'integer', 'width' => '90px', 'sortable' => true, 'aggregate' => 'SUM', ), array( 'key' => 'credit_notes', 'label' => 'Credit notes', 'type' => 'integer', 'width' => '90px', 'empty_zero' => true, 'empty' => '—', ), array( 'key' => 'docs_in_review', 'label' => 'In review', 'type' => 'integer', 'width' => '80px', 'empty_zero' => true, 'empty' => '—', 'header_tip' => 'Documents not yet applied to products; their lines are counted here regardless.', ), array( 'key' => 'item_lines', 'label' => 'Item lines', 'type' => 'integer', 'width' => '90px', 'sortable' => true, 'aggregate' => 'SUM', ), array( 'key' => 'net_purchases', 'label' => 'Net purchases', 'type' => 'money', 'sortable' => true, 'filter' => 'number_range', 'aggregate' => 'SUM', ), array( 'key' => 'vat_estimated', 'label' => 'Estimated VAT', 'type' => 'money', 'sortable' => true, 'aggregate' => 'SUM', ), array( 'key' => 'first_doc', 'label' => 'First invoice', 'type' => 'date', 'nowrap' => true, 'empty' => '—', ), array( 'key' => 'last_doc', 'label' => 'Latest invoice', 'type' => 'date', 'nowrap' => true, 'sortable' => true, 'filter' => 'date_range', 'empty' => '—', ), ), );