prefix . 's1erp_temp_store_orders_table'; if ( (string) $wpdb->get_var( "SHOW TABLES LIKE '{$aieo_erp_raw_table}'" ) !== $aieo_erp_raw_table ) { return array(); } return array( 'id' => 'insights_erp_raw_orders', 'label' => 'ERP raw order data', 'description' => 'Order lines exactly as the ERP delivered them into staging — the place to look when a summarised report needs checking against the source.', 'footnote' => 'This is the raw feed, duplicates and all: the ERP re-delivers orders daily, so the same line can appear more than once, and downstream reports deduplicate before counting. The quantity column contains a handful of corrupt values as delivered and is deliberately never totalled; line price is.', 'group' => 'catalog_sync', 'section' => 'sync_feeds', 'menu_priority' => 90, 'tier' => 'pro', 'scope' => 'local', 'source' => 'table', 'table' => '{prefix}s1erp_temp_store_orders_table', 'registry_id' => 'insights_t33.erp_raw_orders', 'version' => '1', 'per_page' => 50, 'row_key' => 'Id', 'default_sort' => array( 'OrderDate', 'desc' ), 'empty_state' => 'The ERP staging table is empty. Rows appear when the ERP sync delivers order lines.', 'capabilities' => array( 'export' => 'aieo_report_export', ), 'columns' => array( array( 'key' => 'Id', 'label' => 'Row', 'type' => 'id', 'hidden' => true, ), array( 'key' => 'OrderDate', 'label' => 'Order date', 'type' => 'datetime', 'sortable' => true, 'filter' => 'date_range', ), array( 'key' => 'Branch', 'label' => 'Branch', 'type' => 'text', 'filter' => 'select', ), array( 'key' => 'InvoiceType', 'label' => 'Invoice type', 'type' => 'id', 'filter' => 'select', ), array( 'key' => 'SKU', 'label' => 'SKU', 'type' => 'code', 'sortable' => true, 'searchable' => true, 'filter' => 'text', ), array( 'key' => 'quantity_num', 'select' => "CAST(REPLACE(`Quantity`, ',', '.') AS DECIMAL(14,3))", 'label' => 'Quantity', 'type' => 'integer', 'sortable' => true, 'filter' => 'number_range', ), array( 'key' => 'CustomerName', 'label' => 'Customer', 'type' => 'text', 'searchable' => true, 'truncate' => 28, 'tooltip' => true, ), array( 'key' => 'OrderCode', 'label' => 'Order code', 'type' => 'code', 'searchable' => true, ), array( 'key' => 'line_price_num', 'select' => "CAST(REPLACE(`Line_price`, ',', '.') AS DECIMAL(14,2))", 'label' => 'Line price', 'type' => 'money', 'sortable' => true, 'filter' => 'number_range', 'aggregate' => 'SUM', ), array( 'key' => 'Soft1ProductId', 'label' => 'ERP product', 'type' => 'id', 'hidden' => true, ), array( 'key' => 'CustomerId', 'label' => 'Customer ID', 'type' => 'id', 'sortable' => true, 'hidden' => true, ), array( 'key' => 'OrderId', 'label' => 'Order ID', 'type' => 'id', 'searchable' => true, ), array( 'key' => 'LoyaltyId', 'label' => 'Loyalty ID', 'type' => 'id', 'hidden' => true, ), ), );