# Purchase Order Change Control Preflight (`winning_moonstone/purchase-order-change-control-preflight`) Actor

Compare an approved purchase order with a proposed revision, quantify exact price, quantity, total and delivery changes, and flag policy or fulfillment conflicts.

- **URL**: https://apify.com/winning_moonstone/purchase-order-change-control-preflight.md
- **Developed by:** [月 明](https://apify.com/winning_moonstone) (community)
- **Categories:** Business, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$50.00 / 1,000 completed po change preflight reports

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Purchase Order Change Control Preflight

Compare one approved purchase order with one proposed revision before it enters an approval workflow. The Actor creates a deterministic change register, normalizes per-piece/per-100/per-1000 prices, quantifies total impact, and flags changes that exceed your supplied policy.

### What it checks

- exact PO, supplier, currency and line identity;
- normalized line price, quantity, freight and complete PO total deltas;
- price and total increase thresholds, including exact-boundary behavior;
- new and deleted lines, SKU or unit changes, payment terms and delivery delays;
- a proposed quantity below already received or invoiced quantity;
- completeness of the two versions being compared.

The Actor never submits, approves, changes or pays a purchase order. `changeApproved` is always `false`. A `PASS_WITHIN_SUPPLIED_POLICY` status means only that no exception was found under the supplied data and thresholds.

### Input

Paste a `caseJson` string. It must contain:

- `approvedOrder`: the complete approved version, including `receivedQuantity` and `invoicedQuantity` on every line;
- `proposedOrder`: the complete proposed revision;
- `policy`: allowed total/price increases, delivery delay and new/deleted-line settings;
- `coverageConfirmed`: set to `true` only after confirming both versions and fulfillment quantities cover the same PO.

Each order has `poId`, `supplierId`, uppercase three-letter `currency`, `paymentTerms`, `freightAmount`, and 1–500 `lines`. Each line has `lineId`, `sku`, `unit`, `quantity`, `unitPrice`, `priceBasisQuantity`, and an optional ISO `requestedDeliveryDate`.

All quantities, prices and thresholds are plain decimal strings. Exact identifiers are case- and whitespace-sensitive; leading zeros remain significant. The Actor does not perform fuzzy matching, foreign-exchange conversion, tax calculation or unit conversion. Supply net prices and explicitly represented freight only.

### Output statuses

- `PASS_WITHIN_SUPPLIED_POLICY`: no supplied policy or fulfillment conflict was found.
- `REVIEW_REQUIRED`: one or more changes require review or block safe comparison.
- `INCOMPLETE_REVIEW`: input coverage was not confirmed.

One report is written to the default Dataset and to the `REPORT` key-value record. Malformed input fails before a report is created or charged.

### Pricing

**$0.05 per completed report ($50 per 1,000 reports).** A report with findings or incomplete coverage is still a completed, billable report. Invalid JSON or invalid fields are not billed. Use an Apify maximum-charge limit to cap a run.

### Data and safety

The Actor makes no network requests and uses no external AI, OCR, ERP or paid API. Processing occurs inside your Apify run. Results remain in your Apify storage subject to your retention settings. Do not include bank details, personal data, confidential attachments or unrelated columns.

### Why this is separate from invoice matching

This Actor reviews the controlled change from an approved PO version to a proposed PO version. It does not match invoices to receipts, interpret supplier acknowledgments, or decide whether a payment should be released.

### Reference basis

- Microsoft documents that approved purchase orders can require a request-change and reapproval workflow, with confirmed-version journals preserving history: https://learn.microsoft.com/en-us/dynamics365/supply-chain/procurement/purchase-order-approval-confirmation
- Oracle documents that the currently approved purchasing document remains the source of truth until a change order is approved and validated: https://docs.oracle.com/en/cloud/saas/procurement/25c/oaprc/change-orders.html
- The UK Government Commercial Functional Standard calls for an audit trail, quantified cost, approvals and retained evidence for contractual changes: https://www.gov.uk/government/publications/government-functional-standard-govs-008-commercial-and-commercial-continuous-improvement-assessment-framework/government-functional-standard-govs-008-commercial-html

# Actor input Schema

## `caseJson` (type: `string`):

One JSON object containing approvedOrder, proposedOrder, policy and coverageConfirmed. Decimal quantities and money values must be strings.

## Actor input object example

```json
{
  "caseJson": "{\n  \"approvedOrder\": {\n    \"poId\": \"PO-1042\",\n    \"supplierId\": \"SUP-008\",\n    \"currency\": \"USD\",\n    \"paymentTerms\": \"NET30\",\n    \"freightAmount\": \"25.00\",\n    \"lines\": [{\"lineId\":\"0010\",\"sku\":\"BRACKET-A\",\"unit\":\"EA\",\"quantity\":\"100\",\"unitPrice\":\"50.00\",\"priceBasisQuantity\":\"100\",\"requestedDeliveryDate\":\"2026-11-01\",\"receivedQuantity\":\"20\",\"invoicedQuantity\":\"20\"}]\n  },\n  \"proposedOrder\": {\n    \"poId\": \"PO-1042\",\n    \"supplierId\": \"SUP-008\",\n    \"currency\": \"USD\",\n    \"paymentTerms\": \"NET30\",\n    \"freightAmount\": \"25.00\",\n    \"lines\": [{\"lineId\":\"0010\",\"sku\":\"BRACKET-A\",\"unit\":\"EA\",\"quantity\":\"120\",\"unitPrice\":\"0.50\",\"priceBasisQuantity\":\"1\",\"requestedDeliveryDate\":\"2026-11-03\"}]\n  },\n  \"policy\": {\"maxTotalIncrease\":\"15.00\",\"maxTotalIncreasePercent\":\"5\",\"maxLinePriceIncreasePercent\":\"2\",\"maxDeliveryDelayDays\":3,\"allowNewLines\":false,\"allowDeletedLines\":false,\"requireApprovalForPaymentTermChange\":true},\n  \"coverageConfirmed\": true\n}"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `report` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("winning_moonstone/purchase-order-change-control-preflight").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("winning_moonstone/purchase-order-change-control-preflight").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call winning_moonstone/purchase-order-change-control-preflight --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,winning_moonstone/purchase-order-change-control-preflight"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3frDrv5S1zWOSxEN7/builds/s0saNxMGyHC5fDqa4/openapi.json
