=== CostCalc Pro ===
Contributors: groweik
Tags: pricing, profit, cost, woocommerce, calculator
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.12.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Enter every cost from purchase to delivery, pick the profit you want, and get the exact sales price. Markup and margin are shown separately.

== Description ==

CostCalc Pro answers one question: "What price do I need to charge to actually earn the profit I want?"

* Guided cost cards for a local source and an import source (factory price x exchange rate, freight by weight, ads in USD converted to your currency, net courier, COD with manual override), plus a fully custom mode.
* Source profiles: create a profile per country (currency, exchange rate, shipping modes with their own rate per kg) and choose which cost fields each profile shows. Clone, edit, deactivate or delete them.
* Add any number of fixed costs (purchase, ads, packaging, shipping) per unit or per order.
* Add costs that are a percentage of the sales price (COD fee, payment gateway fee). The price is solved exactly, so these fees are not under-counted.
* Choose the target as markup on cost, margin on price, or a fixed profit amount.
* See the exact price, total cost, profit, markup and margin, a cost breakdown chart and a bulk-order table.
* In custom mode a blank cost is reported as an error, never silently treated as zero. In the guided cards a blank amount counts as 0, and the card says so.
* Save scenarios and reusable cost presets. Export CSV or print.
* English and Bangla interface.

= WooCommerce (optional) =

* Search products and variations, read the native cost of goods value when WooCommerce provides it.
* "Apply price to product" sets the regular price only after you confirm. The server recalculates the price, refuses stale prices, and records who changed what and when.
* Dashboard shows product profit or loss from real orders: units sold times the saved cost of the linked calculation, refunds subtracted. Orders are only read, never changed, and nothing leaves your site.
* Compatible with High-Performance Order Storage.

= Accuracy =

All arithmetic uses exact fractions (no floating point). The calculation engine is checked against independently generated test cases.

== Installation ==

1. Upload the plugin and activate it.
2. Open CostCalc Pro in the admin menu.
3. Optional: in Settings choose your currency and language.

== Frequently Asked Questions ==

= Is my data sent anywhere? =
Your prices, costs and scenarios stay in your own WordPress database and are never sent to us. The only external contact is the optional licence and account service described under External services below.

= What happens to my data if I delete the plugin? =
Nothing, unless you tick "Remove all plugin data when the plugin is deleted" in Settings.

= Does it support multisite? =
Built for it, but not yet tested on a real multisite network. Each site has its own tables, settings and permissions and sets itself up the first time it loads; data removal on uninstall is decided per site. Please test on a staging network first.

== External services ==

This plugin uses the Freemius service (https://freemius.com) to manage licences and the optional account connection for the paid plans (Starter, Premium, Agency). Freemius is contacted only if you opt in to connect your account or you activate a licence. Data sent when you opt in: your WordPress admin email and name, site URL and WordPress/PHP versions, the plugin version and licence key. No calculations, costs, prices or customer data are sent. You can skip the opt-in and use the free plan without any connection.

Freemius Terms of Service: https://freemius.com/terms/
Freemius Privacy Policy: https://freemius.com/privacy/

== Changelog ==

= 0.12.8 =
* New: Job quotes gain ready templates (agency project, retainer, cleaning) and a Quantity breaks calculator for print and signage (setup spread over 1 to 3 quantities, unit price rounded up). Maths matches the web app, tested against a shared fixture.

= 0.12.7 =
* Fix: the paid build no longer ships uninstall.php (Freemius requires its after_uninstall hook); data removal logic is unchanged.

= 0.12.6 =
* New: Job quotes tab (Starter and above). Price a job or a monthly retainer from labour, costs, overhead and fees; break-even and recommended price; revisions that never change; estimated vs actual profit; a client PDF that shows only the price.

= 0.12.5 =
* New: price history per saved calculation (Premium). Each change of a price is recorded, with a History button on the Scenarios tab. Applied store prices are recorded too.

= 0.12.4 =
* Change: Starter allows 50 exports a month, the same as the web app. A shared plan table test keeps the plugin and the web app in step.

= 0.12.3 =
* New: a WordPress.org edition (tools/build_zip.py --org) without the Freemius licence code and without quotas.
* Fix: brick-math error messages are escaped. Readme: tested up to 7.1.

= 0.12.2 =
* Readme: added the External services disclosure and corrected the data note. No code changes.

= 0.12.1 =
* Freemius licensing connected: product 44471, plans starter, premium and agency are read from the licence.

= 0.12.0 =
* New: licence link. A paid licence (Starter, Premium or Agency) now sets the plan automatically; without one the plugin runs as Free. Upgrade and Manage licence buttons in the Plans tab.

= 0.11.2 =
* New: Getting started checklist and a plan comparison table; locked features now name the plan that unlocks them.
* New: Restore default sources (Local and Import) if they were deleted.
* Change: plan prices are now Starter $49, Premium $99, Agency $199 per year.
* Fix: no inner scrollbar on the sticky price block.

= 0.11.1 =
* Fix: a calculation that hits a temporary server error (busy host, database lock) is retried once instead of showing "HTTP 500".
* Fix: a failing price-finishing step can no longer turn a valid price into a server error.
* Change: calculator layout. Cost breakdown now shows bars, and breakdown and bulk calculator sit under Target profit. Price and cost distribution stay together in one sticky block, so cards no longer slide over each other.
* Change: notices stay 7 seconds and have a close button; error notices stay until closed.

= 0.11.0 =
* New: VAT, price rounding and minimum price (exact), including each product's WooCommerce tax class.
* New: CSV import of calculations, typical cost templates for US, UK, AU, CA and EU, ad-cost and office-cost per-order helpers with break-even.
* New: choose which roles can use the plugin (Premium), dashboard trend chart (Premium), your own report name (Agency).
* Fix: product profit in the Products table no longer counts VAT as profit.

= 0.10.5 =
* Packaging cleanup (no behaviour change).

= 0.10.4 =
* Fix: calculation failed on sites where another plugin loads an older Brick Math library. The math library now ships under the plugin's own namespace so it cannot clash.

= 0.10.3 =
* Result card stays visible while scrolling the calculator.
* USD stores: the USD rate now defaults to 1 so ads are not silently ignored.
* A server error during calculation now shows its cause on screen.

= 0.10.2 =
* Plans card now shows yearly prices (Starter 39, Premium 79, Agency 199 USD). Payment is not connected yet.

= 0.10.1 =
* Build re-issued with a new version number so WordPress and browsers load fresh files. No code change.

= 0.10.0 =
* New: four plans (Free, Starter, Premium, Agency) with limits and a Plans card in Settings. Payment is not connected yet.
* New: Products tab: price vs calculated price, profit now, apply per product, bulk apply (Premium).
* New: link a saved calculation to a product later, or create a draft product from a calculation (Premium).
* New: country picker with automatic currency suggestion in source profiles.
* New: duplicate, sort and paginate saved calculations; backup and restore as JSON (Premium); loss and price alerts on the dashboard (Premium).
* Fix: readable activity log with user names, full keyboard and ARIA tab pattern, server limit of 12 bulk quantities.

= 0.9.1 =
* Fix: site administrators can always open the plugin, even if its capability was removed from their role (it is restored automatically).
* Fix: a saved calculation re-opens with its source profile and guided card values, not as flat custom costs.
* Fix: settings and names now show a clear error instead of being silently changed.
* Fix: PDF no longer overlaps long labels, skips zero lines and asks for a product name.
* Fix: calculator result cards and the source dialog fit on phones; prices use thousands separators everywhere.

= 0.9.0 =
* First release candidate: calculator, scenarios, presets, settings, WooCommerce price apply.
