Update Purchase Price Daily (GBP Conversion)
Automatically updates inventory purchase prices based on Purchase Order costs, converts all values into GBP, and ensures accurate financial reporting.
Overview
The RIS-SM-2064 – Update Purchase Price Daily (GBP Conversion) macro automatically updates inventory purchase prices from purchase orders and converts costs into GBP. It ensures standardized, accurate cost data across the system.
In simple terms:
Get PO cost → Convert to GBP → Update inventory purchase price → Mark PO as processed
Purpose
This macro:
-
Reads purchase order costs
-
Converts them into GBP
-
Updates inventory purchase prices
-
Marks each purchase order as processed
👉 Ensures consistent, multi-currency inventory costing automatically.
When It Runs
Used for financial reporting and inventory accuracy.
Typically runs:
-
Scheduled execution daily (recommended overnight)
-
During low system usage periods
-
In multi-currency supplier environments
-
To maintain accurate cost reporting
Parameters
None. Fully automated scheduled macro.
Internal Configuration Settings:
-
BaseCurrency: GBP → All costs converted to GBP
-
FetchPurchaseOrdersOfLastHours: -365 → Fetch last 365 days of POs
-
EpName: IsPurchasePriceUpdated → Prevent reprocessing
-
API Limit: 250 per minute → Prevent API throttling
The macro reads PO costs, converts them to GBP, updates inventory, and ensures each PO is processed only once.
Process Flow Step-by-Step
Start Macro
Log start message and load currency conversion rates.
Get Currency Rates
Call GetCurrencyConversionRates and store currency-to-rate mapping.
Fetch Purchase Orders
Retrieve purchase orders from the last 365 days. Extract PO ID and currency.
Skip Already Processed POs
Check extended property IsPurchasePriceUpdated. Skip if exists; otherwise continue.
Get Purchase Order Items
For each PO, fetch:
-
StockItemId
-
Cost
-
Quantity
Convert Cost to GBP
If PO currency is not GBP, convert using stored rate.
Normalize Cost Per Unit
If quantity > 1, calculate unit cost = total cost ÷ quantity.
Update Inventory Purchase Price
Call UpdateInventoryItemField to update purchase price in GBP.
Handle API Rate Limiting
Limit updates to 250 per minute. Wait if exceeded before continuing.
Track Success
Count successful updates. Skip marking PO if not all items updated.
Mark PO as Processed
Add extended property:
-
Name: IsPurchasePriceUpdated
-
Value: True
Logging
Log currency conversions, updates, success/failure, extended property updates, and errors.
Final Result
-
Inventory purchase prices updated in GBP
-
Multi-currency costs normalized
-
Each purchase order processed only once
-
API limits handled safely
-
Accurate cost data ready for reporting
Usefulness
This macro is highly beneficial for:
-
Supporting multi-currency environments
-
Ensuring accurate inventory costing
-
Automating updates with no manual effort
-
Preventing duplicate updates
-
Improving financial reporting and margin analysis
-
Safe execution with API rate control
Important Notes
-
Processes only unprocessed purchase orders
-
Depends on accurate currency conversion rates
-
Handles large data volumes with API rate limiting
-
Extended property prevents duplicate processing
-
Best executed during scheduled low-load periods
Example Scenario
Key Insight
Automating currency conversion and purchase price updates ensures consistent, accurate inventory costing—critical for businesses handling multiple currencies and high-volume purchase operations.
Last updated today
Built with Documentation.AI