=== Jeet Daily Production Sheet ===
Contributors: jeetsanwal
Tags: woocommerce, production, preparation, bakery, csv
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A small WooCommerce preparation list: net quantities per product/model, optional production dates, print and spreadsheet-safe CSV.

== Description ==

For a bakery, tiffin kitchen or small made-to-order store, the first useful question is often: how many of each item do we need to prepare? This plugin adds WooCommerce → Production sheet, with a focused quantity list instead of customer addresses or revenue charts.

* Filter a maximum 31-day inclusive date range, in the WordPress site timezone.
* Explicitly choose order creation date or a saved production date. They are different; no automatic fulfillment-date inference is made.
* Add an optional preparation day in the Production date box on the standard WooCommerce order edit screen. Both HPOS and legacy order storage use WooCommerce CRUD.
* Include Processing and On hold by default; optionally include Completed. Cancelled, Refunded, Failed, Pending payment and draft orders are excluded.
* Group product/model quantities and show saved order names, available variation attributes, current SKUs and contributing-order counts.
* Subtract recorded line-item quantity refunds, never below zero. Money-only refunds do not alter quantities, and are flagged for review.
* Print a clean preparation sheet, with warnings preserved on paper.
* Download CSV with formula-triggering text escaped for spreadsheet use. CSV includes the date basis, statuses, scope, generation time and warnings.
* Requires manage_woocommerce; order-date edits also require permission to edit that order. Report requests, export and date saves are nonce-protected.
* No public endpoints, frontend assets, adverts, signup, subscriptions, tracking or external calls.

**Bounded batches, honest subtotals:** each scan checks at most 500 orders (50 per query), newest order ID first, and at most 5,000 included line items. When the order scope exceeds 500, the report and CSV prominently say BATCH SUBTOTAL. Change Scan batch to 2, 3, etc. to review remaining batches. These are separate subtotals, not one complete plan. If the line-item cap is reached, the next entire order and subsequent orders are omitted and an INCOMPLETE warning appears. Narrow the creation-date range or inspect the omitted orders directly; selecting the next batch alone does not recover omitted orders inside the previous batch.

With order creation date, the scan scope is orders created in the selected range and statuses. With saved production date, the scan scope is ALL creation dates in the selected statuses, then the plugin checks the saved date within the current batch. Orders without a valid saved date are excluded and counted. No scheduled date is guessed from a delivery extension or customer note.

**Practical limits:** this counts order line quantities in their existing units. It does not calculate ingredients, recipes, production capacity, stock reservations, bundle components or custom add-ons. Personalized line metadata is not included. Same product/variation with a different saved name or known attribute value is kept separate. Attribute names come from the current variation definition; deleted/changed products can lose attribute/SKU detail. Current SKU is not a historical order snapshot. Mixed product units should not be treated as one meaningful overall unit.

Reports are live, not saved snapshots. Orders can change during or between requests; CSV regenerates the report rather than exporting a frozen copy of a previous screen. If you review several batches, reconcile changes before treating the combined sheets as a final plan. The plugin does not mark orders fulfilled or change stock/order statuses.

== Installation ==

1. Install and activate WooCommerce. Use WordPress and PHP versions supported by your WooCommerce version; this plugin's lower minimum does not override WooCommerce's requirements.
2. Install this ZIP in Plugins → Add New → Upload Plugin, then activate it.
3. Open WooCommerce → Production sheet. Choose the date basis, range and statuses; click Generate sheet.
4. For a preparation-day workflow, edit each order, set Production date → Preparation day and update the order. Then choose Saved production date on the report.
5. Read all warnings before preparing quantities. Download CSV or print the current sheet.

== Frequently Asked Questions ==

= Is this a delivery-date plugin? =

No. The optional date is this plugin's manual preparation-day field. It does not modify shipping dates, checkout or delivery-extension data. One order has one production date, applying to all its line items.

= Does a refund reduce the preparation quantity? =

Only an actual refunded line quantity. For example, quantity 10 with quantity refund 2 contributes 8. A money-only refund keeps 10, with a review warning when the order has no refunded line quantities. Fully Refunded-status orders are always excluded. If a single order mixes quantity refunds with separate money-only refunds, quantities are reduced only by the recorded quantity refunds; inspect the original order for any other adjustments.

= Will the sheet contain customer information? =

The plugin does not read customer addresses, emails, phone numbers, order notes or arbitrary item metadata. It displays the saved item name, known variation attributes, current SKU, product/variation IDs, quantities and aggregated counts. Product names or attribute values can themselves contain personal data entered elsewhere; handle exported sheets appropriately.

= Is HPOS supported? =

Yes. Reports use wc_get_orders and order/item APIs, and the preparation date uses WooCommerce metadata CRUD. There are no direct order-table queries or post-meta order writes. The order-date box is registered for both standard WooCommerce order editor screens. Third-party replacement editors may need the standard meta-box area.

= Why does a production-date scan show more orders in scope than included? =

The portable scan checks selected-status orders across all creation dates in batches of 500, then tests each saved production date. Missing dates and dates outside the selected preparation range do not contribute. Change Scan batch to inspect older selected-status orders.

= Is there a paid tier, branding in the sheet or automatic updater? =

No paid tier, adverts or frontend credit. This self-hosted package uses its own Update URI to avoid unrelated directory replacements. No custom automatic updater is included; install new ZIP versions manually from jeetsanwal.in.

= What remains after uninstalling? =

Only optional production dates stored on orders remain, so reinstalling preserves them. The plugin creates no tables, cached reports or settings. Clear a Production date field and update that order to remove that order's saved date before uninstalling. Exported CSV/printed sheets remain wherever you saved them. No orders, products or uploads are deleted.

== Privacy ==

All processing happens inside your WordPress installation. There are no external requests, analytics, remote fonts or services. Reports are not saved by the plugin. Production dates are ordinary order metadata and may be included in backups or exports by other tools. Store downloaded CSVs and printed sheets according to your own data-handling policy.

== Changelog ==

= 1.0.0 =
* Initial self-hosted release: net preparation quantities, manual production dates, bounded reports, print and protected CSV export.
