=== PoPayPOS Reports for WooCommerce === Contributors: amitrotem Tags: popay, pos, woocommerce, reports, sales analytics Requires at least: 5.0 Tested up to: 6.8 Stable tag: 2.1.1 Requires PHP: 7.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Complete sales analytics and reporting solution for PoPayPOS and Omni POS integration with WooCommerce. == Description == **PoPayPOS Reports for WooCommerce** is a powerful analytics plugin designed specifically for businesses using **PopayPOS (Omni POS)** systems with WooCommerce. Get comprehensive insights into your point-of-sale transactions with professional reports, visual analytics, and data export capabilities. Transform your **Popay POS** data into actionable business intelligence with detailed sales reports, payment method tracking, and employee performance analytics. **Why Choose PoPayPOS Reports?** ✅ **100% HPOS Compatible** - Future-proof with WooCommerce High-Performance Order Storage ✅ **Real-time Analytics** - Track sales performance instantly ✅ **Professional Reports** - Export to CSV/Excel for business analysis ✅ **Visual Dashboards** - Beautiful charts and graphs ✅ **Payment Method Tracking** - Monitor all payment types ✅ **Employee Performance** - Track individual cashier sales **Perfect for Popay users** who need detailed reporting and analytics for their POS transactions. The plugin allows site administrators to view detailed analytics for POS orders, including: - Comparison between **Popay POS orders** and regular orders - Daily detailed reports with visual graphs - Export data to CSV/Excel formats - Detailed statistics and performance metrics - **Full compatibility with High-Performance Order Storage (HPOS)** == System Requirements == - WordPress 5.0 or higher - WooCommerce 5.0 or higher - PHP 7.4 or higher - PopayPOS/Omni POS system integration == Compatibility == This plugin is fully compatible with WooCommerce High-Performance Order Storage (HPOS). It uses the WooCommerce Data Store API instead of direct SQL queries, ensuring compatibility with future database changes. Supported features: - HPOS enabled - HPOS disabled (traditional database) - Automatic switching between systems - Support for WooCommerce 5.0+ == Installation == = From WordPress Dashboard = 1. Go to **Plugins > Add New** 2. Search for "PoPayPOS Reports" or "Popay" 3. Click **Install Now** then **Activate** 4. Navigate to **WooCommerce > PoPayPOS Reports** = Manual Installation = 1. Download the plugin ZIP file 2. Upload the `popaypos-reports` folder to `/wp-content/plugins/` 3. Go to **Plugins** in your WordPress admin 4. Find **PoPayPOS Reports for WooCommerce** and activate it 5. Navigate to **WooCommerce > PoPayPOS Reports** = Requirements = - WordPress 5.0+ - WooCommerce 5.0+ - PHP 7.4+ - PoPayPOS/Omni POS system integration == Usage == = Accessing Reports = 1. Go to the WordPress admin panel 2. Navigate to **WooCommerce > PoPayPOS Reports** = Creating a Report = 1. Select a start date and end date 2. Click **Generate Report** 3. View results in summary cards, graphs, and tables = Exporting Data = 1. Generate a report 2. Select an export format (CSV or Excel) 3. Click **Export Report** == Features == = Summary Cards = - Number of POS orders - Total POS order amount - Number of regular orders - Total regular order amount - Total revenue - Percentage of POS orders from all orders = Graphs = - Line chart comparing daily revenue - Bar chart comparing daily order counts = Detailed Tables = - List of all POS orders with direct links - Daily breakdown of orders and revenue = Data Export = - Export to CSV - Export to Excel (basic) == Data Structure == The plugin identifies orders with the meta field: `order_source` = `pos` Orders without this field or with a different value are considered regular orders. == Technical Architecture == = WooCommerce Data Store API = Instead of direct SQL queries: ```php $orders = wc_get_orders(array( 'limit' => -1, 'status' => array('completed', 'processing', 'on-hold'), 'meta_query' => array( array( 'key' => 'order_source', 'value' => 'pos', 'compare' => '=' ) ) )); ``` = HPOS Detection = ```php if (class_exists('Automattic\WooCommerce\Utilities\OrderUtil')) { $hpos_enabled = \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled(); } ``` == Customization == = Adding More Fields = Edit the `get_orders_by_source` function: ```php private function get_orders_by_source($source, $start_date, $end_date) { $args = array( 'limit' => -1, 'status' => array('completed', 'processing', 'on-hold'), 'date_created' => $start_date . '...' . $end_date, 'orderby' => 'date', 'order' => 'DESC', 'meta_query' => array( array( 'key' => 'your_custom_field', 'value' => 'your_value', 'compare' => '=' ) ) ); return wc_get_orders($args); } ``` = Styling = Edit `assets/css/admin.css`. == Troubleshooting == - **Plugin not in menu**: Ensure WooCommerce is active and you have `manage_woocommerce` permissions. - **No data in reports**: Make sure orders contain `order_source` = `pos` and check the date range. - **JavaScript errors**: Verify all assets are loading and check browser console. - **HPOS issues**: Ensure WooCommerce is updated. == Performance == - Uses WooCommerce Data Store API for efficiency - HPOS improves performance - Optimized queries for the active database - Loads orders in small batches to save memory == Support == For questions or support, contact the plugin developer. == License == This plugin is licensed under the GPL v2 or later. == Changelog == = 2.1.1 = * Moved the order-statuses endpoint to GET /wc/v3/popay-order-statuses so it authenticates with WooCommerce REST API consumer keys = 2.1.0 = * Added REST endpoint GET /wc/v3/popay-order-statuses returning all order statuses, including custom ones (e.g. Popay POS) * Customer search result limit is now adjustable per request via the "search_limit" query param (default 50, max 500) = 2.0.5 = * Fixed customer search returning too many results for multi-word names (e.g. "First Last" no longer matches every customer sharing just the first name) * Customer search now mirrors WooCommerce core: the whole search term is matched against name, email, phone, and company fields * Added word-by-word fallback that matches names split across first/last name fields when an exact phrase match is not found * Bounded the customer search result set to keep queries fast on common terms = 2.0.4 = * Added info note about Popay POS connection status on Settings page * Minor UI improvements to Settings page header layout = 2.0.3 = * Aligned POPAYPOS_REPORTS_VERSION constant with plugin header * Added Settings link to PoPayPOS Reports page header * Added Settings button to page header with flex layout = 2.0.0 = * Major update with WooCommerce Analytics style interface * Added refund tracking and reporting * Added payment method breakdown charts * Added employee/user filtering * Improved performance and code structure * Full PHPCS compliance * Enhanced REST API for customer phone search = 1.0.4 = * Enhanced search visibility for "Popay" searches * Improved plugin description and tags * Better SEO optimization = 1.0.3 = * Rename for compatibility with WordPress repository = 1.0.1 = * Full HPOS compatibility * Uses WooCommerce Data Store API * Automatic HPOS detection * Admin interface compatibility notices * Significant performance improvements = 1.0.0 = * Initial release * Basic reports * Visual graphs * Data export * Modern user interface