=== MOA Accounting ===
Contributors: mohsenalamgiralam
Donate link: https://mohsenalamgir.ir
Tags: woocommerce, accounting, profit, orders, bookkeeping
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A bilingual WooCommerce accounting plugin with a modern dashboard, configurable role access, and automatic order profit and loss calculations.

== Description ==

MOA Accounting is a lightweight WooCommerce plugin designed to help store owners automatically calculate and monitor the profit and loss of every order.

= Features =

* Automatically calculates order profit based on selling price, purchase cost, shipping cost, and transaction fee.
* Modern dashboard displaying total, daily, monthly, and yearly profit.
* Inline editing of purchase cost and actual shipping cost for each order.
* Manually import an order using its order ID.
* Bulk import completed orders within a selected date range.
* Customizable settings for transaction fee percentage, minimum fee, and maximum fee.
* Fully redesigned, responsive admin dashboard and settings screen.
* Configurable dashboard access by WordPress user role with secure capability checks.
* Automatic English interface on English WordPress and Persian RTL interface on Persian WordPress.
* WooCommerce HPOS compatibility and protected AJAX operations.
* Order pagination with 15 tracked orders per page and an accurate total count.

= ویژگی‌ها (فارسی) =

* محاسبه خودکار سود و زیان سفارش بر اساس فروش، خرید، ارسال و کارمزد.
* داشبورد حرفه‌ای و واکنش‌گرا با کارت‌های سود کل، روزانه، ماهانه و سالانه.
* ویرایش سریع هزینه خرید و ارسال واقعی هر سفارش.
* افزودن دستی سفارش تکمیل‌شده و ورود گروهی سفارش‌ها در بازه تاریخی.
* تنظیم درصد، حداقل و حداکثر کارمزد و هزینه ارسال پیش‌فرض.
* تعیین نقش‌های کاربری مجاز برای مشاهده و ویرایش پنل حسابداری؛ مدیر سایت همیشه دسترسی دارد.
* رابط خودکار فارسی و راست‌چین در وردپرس فارسی و انگلیسی در وردپرس انگلیسی.
* سازگاری با HPOS ووکامرس و کنترل امن دسترسی در صفحات و درخواست‌های AJAX.
* صفحه‌بندی سفارش‌ها با نمایش ۱۵ سفارش در هر صفحه و شمارش دقیق کل سفارش‌ها.

= Requirements =

This plugin requires WooCommerce to be installed and activated.

== Installation ==

1. Upload the `moa-accounting` folder to the `/wp-content/plugins/` directory, or upload the ZIP file via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin from the **Plugins** screen in WordPress.
3. Make sure WooCommerce is installed and activated.
4. Open the **Accounting** menu and configure your transaction fee and default shipping cost settings.

== Frequently Asked Questions ==

= Does this plugin work without WooCommerce? =

No. MOA Accounting depends entirely on WooCommerce and will remain inactive if WooCommerce is not installed and activated.

= How is order profit calculated? =

Profit = (Selling Price + Shipping Charged to Customer) − (Purchase Cost + Actual Shipping Cost + Transaction Fee)

The transaction fee percentage, minimum fee, and maximum fee can all be configured from the plugin settings page.

== Screenshots ==

1. Main accounting dashboard showing profit summary cards.
2. Settings page for transaction fees and order importing.

== Changelog ==

= 2.0.2 =

English:

* Added server-side dashboard pagination with 15 tracked orders per page.
* Added an accurate total-order count, current-page indicator, and responsive previous/next navigation.
* Preserved complete profit summaries across all tracked orders while limiting only the visible table rows.
* Refreshed the Accounting Settings page with a dashboard-matching gradient header, icon-led cards, improved focus states, and polished responsive styling.
* Updated the plugin version and stable tag to 2.0.2.

فارسی:

* افزودن صفحه‌بندی سمت سرور برای داشبورد با نمایش ۱۵ سفارش رهگیری‌شده در هر صفحه.
* افزودن شمارش دقیق کل سفارش‌ها، نشانگر صفحه فعلی و دکمه‌های واکنش‌گرای قبلی و بعدی.
* حفظ محاسبه کامل کارت‌های سود بر اساس تمام سفارش‌ها و محدود کردن صرفاً ردیف‌های قابل‌مشاهده جدول.
* بازطراحی صفحه تنظیمات حسابداری هماهنگ با داشبورد، شامل سربرگ گرادیانی، کارت‌های آیکون‌دار، حالت‌های فوکوس بهتر و نمایش واکنش‌گرا.
* ارتقای نسخه افزونه و Stable Tag به ۲.۰.۲.

= 2.0.0 =

English:

* Redesigned the dashboard and settings screens with a modern, responsive admin UI.
* Added configurable accounting-dashboard access by WordPress user role.
* Added a dedicated `moaac_view_accounting` capability and enforced it on menus, pages, REST meta authorization, and AJAX requests.
* Added complete English source strings and a compiled Persian translation for automatic locale-based language switching.
* Improved the tracked-orders table, mobile layout, empty state, quick order import, inline editing, and live profit updates.
* Added stronger validation for settings, date ranges, order IDs, editable fields, and non-negative monetary inputs.
* Updated the plugin version to 2.0.0 and plugin page URL to `https://mohsenalamgir.ir/wp-plugins/moa-accounting/`.

فارسی:

* طراحی کامل و حرفه‌ای داشبورد و صفحه تنظیمات با رابط واکنش‌گرا و مدرن.
* افزودن امکان تعیین سطح دسترسی پنل حسابداری بر اساس نقش‌های کاربری وردپرس.
* افزودن دسترسی اختصاصی `moaac_view_accounting` و کنترل آن در منوها، صفحات، متای REST و درخواست‌های AJAX.
* تکمیل ساختار دوزبانه با متن پایه انگلیسی و ترجمه کامپایل‌شده فارسی برای تغییر خودکار بر اساس زبان وردپرس.
* بهبود جدول سفارش‌ها، نمایش موبایل، حالت بدون سفارش، افزودن سریع سفارش، ویرایش درجا و به‌روزرسانی زنده سود.
* تقویت اعتبارسنجی تنظیمات، بازه تاریخی، شناسه سفارش، فیلدهای قابل‌ویرایش و مبالغ غیرمنفی.
* ارتقای نسخه به ۲.۰.۰ و تغییر آدرس صفحه افزونه به `https://mohsenalamgir.ir/wp-plugins/moa-accounting/`.

= 1.0.2 =

* رفع اشکال مهم: بررسی فعال بودن ووکامرس از سطح اصلی فایل به هوک `plugins_loaded` منتقل شد. پیش‌تر، چون وردپرس افزونه‌ها را به ترتیب الفبایی بارگذاری می‌کند و «moa-accounting» زودتر از «woocommerce» می‌آمد، افزونه همیشه ووکامرس را غیرفعال تشخیص می‌داد و کلاً غیرفعال می‌ماند.
* افزودن اعلام سازگاری با سیستم ذخیره‌سازی سفارش با کارایی بالا (HPOS) ووکامرس.

= 1.0.1 =

* Moved inline JS/CSS on the dashboard page to properly enqueued files (wp_enqueue_script/wp_enqueue_style).
* Prefixed all functions, hooks, options, and post meta keys with a unique `moaac_` / `_moaac_` prefix to avoid naming collisions.

= 1.0.0 =

* Initial public release of MOA Accounting.

== Upgrade Notice ==

= 2.0.2 =

Adds 15-order pagination and a refreshed Accounting Settings interface.

= 2.0.0 =

Major dashboard, access-control, security, and bilingual-interface update. Review allowed roles under Accounting → Settings after upgrading.

= 1.0.1 =

Internal code-quality fixes only (asset loading and naming prefixes); no user-facing changes.

= 1.0.0 =

Initial public release.
