Skip to content

Connecting purchases, stock and sales

AI & agentic workflows In use; development continues

I built and run a connected finance process covering purchases, stock, sales invoicing and customer-payment reconciliation.

  1. The problem

    Purchases, stock and sales needed to reconcile. Finance needed to issue sales invoices, match customer receipts and explain differences.

  2. My role

    I designed, built and run the system. I handle accounting, invoicing, receipts reconciliation and ongoing support.

  3. Where it stands

    Supplier batch posted; customer invoices delivered. Receipt reconciliation and corrections continue; handover is not yet complete.

One system. Four connected layers.

Follow purchasing, billing, accounting and engineering in sequence. Bring a layer forward to explore its records and decisions.

Where does the cost of stock come from?

Supplier documents, item records and accounting rules meet here. Checks connect the original purchase to stock costs and the eventual posting.

Explore the full process (new tab)

Supplier posting has its own approval. It does not authorise customer billing; the confirmed posting result covers the reviewed September batch.

The full view includes search, connected paths, presentation mode and export tools.

Read the map in plain English

Choose a part to see its purpose, its connections and supporting detail.

Capture and check supplier documents

Supplier documentsInvoices and source pages

Supplier invoices and supporting documents provide the original quantities and costs. I keep their links to the extracted records.

Read the supporting detail
Extract invoice linesText first; AI fallback

The invoice pipeline extracts text deterministically, with AI assistance for scanned documents. A separate controller structures the result for checking.

Read the supporting detail
Check source coverageTotals, duplicates, gaps

I check document coverage, line quantities and values, duplicate flags and unusual records before using the extracted data. Agreement between two outputs is not enough.

Read the supporting detail
Resolve exceptionsUncertain records stay open

Missing lines, uncertain extraction and cost differences remain visible for investigation. They do not become accepted purchases simply because a file was generated.

Read the supporting detail

Account for the stock

Item & component recordsWhat the purchase contains

Item and component records help distinguish stock, assembly and delivery costs. Their accounting treatment must be agreed before the records are used.

Read the supporting detail
Apply finance rulesVisible workbook logic

Workbook tables and formulas apply the treatment of inventory, cost of sales, components and delivery. Python prepares and checks the data without becoming a second money engine.

Read the supporting detail
Stock quantities & costsReconciled to purchases

The costed stock records must reconcile to their source purchases. Import checks distinguish rows saved in the workbook from figures recalculated afterwards.

Read the supporting detail
Replenishment historyFeeds the billing basis

Replenishment records connect supplied quantities to stock and customer billing. This is a shared input to route B, with separate billing decisions.

Read the supporting detail

Approve and confirm posting

Approve supplier importHuman release decision

I prepare the supplier import and supporting checks. Posting to Business Central needs explicit approval for that package.

Read the supporting detail
Read back postingsConfirm the actual result

I compare the reviewed supplier package with posted records. A prepared import and a posted transaction are different events; the September evidence confirms that batch only.

Read the supporting detail

Which stock position did we bill, and what happened afterwards?

The web crawl captures reports. A selected stock position meets replenishment and earlier billing history, then supports a checked invoice, delivery and payment reconciliation.

Explore the full process (new tab)

This map combines operating work and implemented controls. Earlier cycles use their own frozen files. Receipt reconciliation, corrections and development continue.

The full view includes search, connected paths, presentation mode and export tools.

Read the map in plain English

Choose a part to see its purpose, its connections and supporting detail.

Capture reports and select the billing basis

Crawl stock reportsReport IDs and saved PDFs

The web crawl collects the report list, report rows and supporting PDFs. Its record distinguishes new, changed, unchanged and missing reports, so an incomplete capture cannot silently stand in for a complete one.

Read the supporting detail
Crawl & CSV Gen_IDCrawl ID and CSV Gen_ID

A report ID identifies a report, not an unchanged version of its contents. The crawl generation identifies a captured set and links to its predecessor. The exported count CSV has its own Gen_ID, linked back to that crawl generation.

Read the supporting detail
Select the stock positionReport, version and period

The billing basis binds the selected stock report to its captured generation and billing period. Operations confirms stock information; the selection must account for report changes and missing evidence.

Read the supporting detail
Hold affected billingChanged counts or gaps

Changed counts, missing evidence and unresolved differences can hold affected billing for review. A familiar report ID does not make changed report contents safe to reuse.

Read the supporting detail

Calculate, approve and issue

Opening stock & suppliesDated replenishment records

Opening stock and replenishment history establish what was available. Stock counts then support the consumption calculation, with timing and exclusions checked for the selected position.

Read the supporting detail
Calculate the next billWorkbook finance rules

The workbook brings together the selected stock position, eligible supplies and earlier billed quantities. This distinguishes total consumption from what remains to bill and keeps exceptions visible.

Read the supporting detail
Approve & issue invoicesSales invoice and reports

After the relevant checks and approval, I issue customer sales invoices with supporting reports. Preparing a pack, issuing an invoice and confirming delivery are recorded as distinct events.

Read the supporting detail

Preserve the basis and issued documents

Earlier billing basisPreserved at invoice issue

Billing History preserves the stock and supply basis recorded when a supported cycle was billed. Later count edits must not rewrite it. Earlier cycles without that record retain their own frozen evidence files.

Read the supporting detail
Issued documentsCycle, invoice and revision

Issued invoice lines, supporting packs and recorded basis allow a bill to be traced back to its cycle and inputs. Credits and reissues need their own evidence and links to the document they correct.

Read the supporting detail

Reconcile payments and follow up

Match customer receiptsPaid, outstanding, unmatched

I reconcile bank receipts and allocations to the issued-invoice register. Unmatched cash, money held on account and outstanding invoice balances remain visible for follow-up.

Read the supporting detail
Bank receipt recordsPayment and allocation

The payment record keeps each bank credit and its allocation to invoices or money held on account. An invoice delivery record does not prove that a payment was received.

Read the supporting detail
Resolve differencesCredits require approval

I investigate billing and payment differences and prepare corrections for review. Approved credits or reissues preserve the link to the original invoice; a proposed correction is not a completed one.

Read the supporting detail

Can I explain a figure from source to invoice to receipt?

The accounting view keeps today’s stock position, the basis of issued invoices and customer cash separate, then reconciles their relationships.

Explore the full process (new tab)

A matching total does not prove a complete population. Missing historical evidence is reported as unmeasured, not replaced with zero or reconstructed as if it were original.

The full view includes search, connected paths, presentation mode and export tools.

Read the map in plain English

Choose a part to see its purpose, its connections and supporting detail.

Explain the current accounting position

Source populationPurchases, counts, supplies

I start with the source purchases, replenishments and stock reports, including their coverage and captured versions. A reconciliation must account for missing records as well as matching amounts.

Read the supporting detail
Accounting treatmentInventory, cost and timing

Finance determines the treatment of stock, cost of sales, components and delivery. Quantity, cost and billing timing must be explained separately; an accounting classification is not a release approval.

Read the supporting detail
Reconcile the positionQuantities and values

I compare stock and consumption quantities, costs and billed figures against their supporting records. Current calculations and issued history are compared without overwriting either one.

Read the supporting detail
Explain the differenceChecked, open or unmeasured

Customer and management reporting separates checked figures from unresolved differences and missing evidence. I identify the action or confirmation needed rather than presenting every difference as a completed correction.

Read the supporting detail

Prove what an issued invoice was based on

Frozen cycle evidenceThe records available then

Earlier billing cycles are traced to their retained packs and recorded basis. A new extract cannot be backdated and presented as the original evidence for an old invoice.

Read the supporting detail
Invoice basisStock and supply position

The recorded invoice basis explains which stock position and supply history supported a bill. Where a recorded basis is absent or diverges from the issued lines, the gap remains explicit.

Read the supporting detail
Issued lines & registerCredits and replacements

Invoice lines and the register must agree on the issued document and its status. Superseded invoices, credits and reissues need to be identified when explaining the billed position.

Read the supporting detail
Evidence of each eventPrepared, posted, delivered

A generated pack does not prove delivery, and a delivery record does not prove payment. I keep evidence for each event separate when reporting what has actually happened.

Read the supporting detail

Establish the payment position

Bank creditsCash received

Bank credits are the source for received cash. Their value dates, amounts and allocations support the payment position rather than an assumption based on invoice status.

Read the supporting detail
Payment reconciliationAllocation and balance

Payment allocations are checked against issued invoices. Outstanding balances, unallocated receipts and money held on account are different positions and need different follow-up.

Read the supporting detail

How do the crawler, workbook and checks work together?

I build and maintain the collection tools, workbook integration and checks. Each part has a defined job, with recorded inputs and review before a change reaches the operation.

Explore the full process (new tab)

This shows implementation responsibilities and practices, not a claim that every control is fully deployed. Development continues and handover to another operator is incomplete.

The full view includes search, connected paths, presentation mode and export tools.

Read the map in plain English

Choose a part to see its purpose, its connections and supporting detail.

Acquire and version the external records

Report portalExternal records can change

The report portal is an external source. The collection process must handle changes, missing reports and incomplete retrieval rather than assuming that the newest download is usable.

Read the supporting detail
Crawler & evidence checksCensus, rows and PDFs

The crawler records the report population, extracted rows and PDF links. Validation checks completeness and changes before captured data is accepted for billing use.

Read the supporting detail
Versioned capture storeLinked generations

The capture store retains generations linked to their predecessors and checks their report-to-PDF relationships. Workbook-facing count exports carry a Gen_ID linked to the crawl generation.

Read the supporting detail

Stage inputs and calculate in the workbook

Supplier documentsSeparate acquisition path

Supplier invoices enter through a separate extraction pipeline. Text extraction and AI assistance feed deterministic structuring and checks before finance uses the records.

Read the supporting detail
Python staging toolsPrepare, validate, orchestrate

Python coordinates acquisition, staging and validation. Power Query and VBA support workbook loading and interaction; the financial rules remain in workbook tables and formulas.

Read the supporting detail
Native finance workbookVisible rules and tables

The workbook owns the finance calculations and recalculates with changed inputs. Staged data, saved rows and recalculated figures are different states and require different checks.

Read the supporting detail
Saved results & logsFiles are checked again

Saved workbook results and generated packs are checked after the operation. Run records retain the inputs and state needed to investigate a failure or explain an output later.

Read the supporting detail

Test changes and control their release

Finance requirementsAcceptance before changes

I define the accounting rules, expected result and refusal conditions before changing the tools. Claude Code and Codex assist development and review; I retain responsibility.

Read the supporting detail
Tests & re-derivationCopies and saved readback

I test on copies, exercise failure cases, re-derive key figures and check saved results. Tests include incomplete captures, ambiguous history and mismatches between records and issued documents.

Read the supporting detail
Separate reviewChallenge the evidence

A separate AI review challenges the implementation and its evidence. Passing tests or an AI review does not authorise workbook promotion, posting or customer delivery.

Read the supporting detail
Approve & maintainApproval, recovery, runbooks

A person authorises the relevant release. Backups, run records and runbooks support recovery and recurring operation; I continue to maintain them alongside billing and operational support.

Read the supporting detail

Results and evidence

Supplier postings confirmed in Business Central.

3 September 2026: every invoice in the reviewed supplier batch was posted. Amounts and line counts matched the prepared package. This check covers that batch only.

Customer invoices and supporting reports delivered.

7 September 2026: delivery confirmed for the customer invoice pack, control workbook and consumption reports. Later corrections are tracked separately.

Updated consumption and difference reports checked.

1 October 2026: updated consumption and difference reports matched saved invoice records. Held items and corrections remained under review. This record confirms checking, not delivery.

Explore the detail: my role, approach and source notes

What the work involves

Establish the cost of stock

I turn supplier documents into structured records, resolve item and component differences, and define how stock, assembly and delivery costs are treated. The resulting records support inventory and cost-of-sales checks and controlled preparation for Business Central.

Issue customer sales invoices

I connect replenishment history and stock counts to each billing cycle, check eligible records, and prepare and issue customer sales invoices with supporting reports after approval. Changed counts and unresolved exceptions are held for review. Supplier imports follow a separate release process.

Explain the numbers to customers and management

I prepare consumption, cost and difference reports to answer specific questions. When a report is challenged, I trace it to the underlying stock, replenishment and invoice records and explain what needs correcting or confirming.

Reconcile receipts and resolve differences

After invoices are issued, I reconcile customer receipts to invoices, identify unmatched payments and outstanding balances, and investigate differences. I also prepare correction schedules and action lists for Operations, linked to the source records. Proposed credits and reissues stay separate from confirmed corrections.

Keep the operation running and checkable

I maintain the data collection, workbook controls, validation routines and runbooks alongside the recurring work. Reconciliations and a separate AI review help challenge the results; they do not replace a second human operator. Transferring routine operation remains work in progress.

Source notes

One accountable owner across finance, systems and operation.

I am the sole hands-on owner of the design, build and operation of this system. I set the finance requirements, build and test the tools, issue sales invoices, reconcile customer receipts and handle reporting and exceptions. Operations provides and confirms stock information; financial release and corrections require explicit approval. I use Claude Code and Codex to assist development and review, while retaining responsibility for the work.

Earlier supplier-import evidence: July 2026.

At the 6 July 2026 supplier-import checkpoint, 391 invoices worth EUR 827k were prepared for Business Central, with 100% of the value accounted for. Posting required approval at that stage; these are historical supplier-batch figures, not customer-billing totals.

Built a controlled pipeline to remove several hundred hours of annual reconciliation.

Used AI to extract invoice data, checked it against defined rules and held posting for human approval.

Business impact

Finance can trace purchases into stock, stock into sales invoices, and invoices into customer receipts, with differences and outstanding balances visible for follow-up.

How I did it

  1. 01

    Started with the accounting treatment and the records needed to support it. Kept financial rules in visible workbook formulas and tables so changes recalculate with the data.

  2. 02

    Used Python for collection, transformation and checks, and AI assistance for difficult document extraction, coding and review. Uncertain records go to review.

  3. 03

    Tested changes on copies, re-derived key figures and checked saved outputs before approved release. Kept run records so a billing result can be traced back to its inputs.

Tools and working context

A marine supply operation with stock held across vessels and a multi-tier supplier network. The work grew from feasibility analysis and supplier-cost reconciliation into recurring customer billing, reporting and operational support. Client and vessel identities are withheld.

Tools
Excel · Power Query · Python · VBA · Business Central · Claude Code · Codex
Business area
Stock and costing · Customer billing · Operational reporting
Skill type
Finance · Automation · AI

Why I made these choices

  • Separated supplier cost accounting from customer billing. The records connect, but a checked supplier batch does not prove a customer invoice is ready to issue.
  • Kept business rules visible to finance and used automated checks to stop incomplete or inconsistent records from passing silently.
  • Kept release decisions with a person. AI assistance and passing tests do not authorise posting, customer delivery or financial corrections.

Skills used

  • Prompt engineering AI & Automation Strong
  • Agentic workflow design AI & Automation Strong
  • Cost-aware model routing AI & Automation Applied
  • Python Data & Reporting Foundational

Full skill evidence →

What I learned

  • The work continues after an invoice is produced: changed source records, customer questions and corrections need the same care as the original billing run.
  • Sole ownership makes decisions direct, but creates dependency on one person. Clear inputs, runbooks and a tested handover matter as much as the build.

What comes next

  • Complete outstanding correction and billing work, with each release checked against its own source records and approvals.
  • Make routine operation transferable through clear responsibilities, runbooks and an observed run by another operator.

← All case studies · Discuss this work →