Create Purchase
Create and manage purchase orders from suppliers.
Purchase orders in MediFlux formalize your inventory procurement requests to suppliers. A well-managed purchase order process ensures accurate inventory records, clear supplier communication, and proper accounting of your pharmacy's expenses.
This guide covers creating purchase orders manually. For automated reorder suggestions, see the Purchases overview.
Creating a Purchase Order
Select a Supplier
Start by choosing the supplier you want to order from. MediFlux displays the supplier's payment terms, lead time, minimum order value, and your recent order history with them.
const po = await fetch("https://api.mediflux.io/v1/purchase-orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer your-api-key",
},
body: JSON.stringify({
supplier_id: "sup_pharmadist_001",
location_id: "loc_xyz789",
expected_delivery: "2024-02-01",
notes: "Monthly restock order",
}),
});
const poData = await po.json();
console.log("PO created:", poData.po_number);
// Output: PO created: PO-2024-0089Add Line Items
Add products to the purchase order. MediFlux shows current stock levels, reorder points, and suggested quantities for each item based on sales velocity.
await fetch(`https://api.mediflux.io/v1/purchase-orders/${poData.id}/items`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer your-api-key",
},
body: JSON.stringify({
items: [
{
product_id: "prod_amoxicillin_500",
quantity: 200,
unit_cost: 12.50,
supplier_sku: "AMX-500-200CT",
},
{
product_id: "prod_ibuprofen_200",
quantity: 500,
unit_cost: 3.75,
supplier_sku: "IBU-200-100CT",
},
{
product_id: "prod_bandages_medium",
quantity: 100,
unit_cost: 2.10,
supplier_sku: "BND-MED-50PK",
},
],
}),
});MediFlux tracks supplier-specific SKUs separately from your internal product codes. This prevents confusion when different suppliers use different codes for the same product.
Review and Submit
Review the purchase order summary, including line items, total cost, and expected delivery date. Once confirmed, submit the order to your supplier.
const submission = await fetch(
`https://api.mediflux.io/v1/purchase-orders/${poData.id}/submit`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer your-api-key",
},
body: JSON.stringify({
send_method: "email",
send_to: "orders@pharmadist.example.com",
message: "Please confirm receipt of this order.",
}),
}
);MediFlux generates a professional PDF purchase order and sends it to the supplier via your chosen delivery method (email, EDI, or fax).
Receive Inventory
When the shipment arrives, record the received quantities against the purchase order. MediFlux supports partial receiving for split shipments.
await fetch(
`https://api.mediflux.io/v1/purchase-orders/${poData.id}/receive`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer your-api-key",
},
body: JSON.stringify({
received_by: "usr_warehouse_01",
items: [
{
product_id: "prod_amoxicillin_500",
quantity_received: 200,
batch_number: "BATCH-AMX-2024-0156",
expiry_date: "2026-01-15",
condition: "good",
},
{
product_id: "prod_ibuprofen_200",
quantity_received: 480,
batch_number: "BATCH-IBU-2024-0891",
expiry_date: "2025-11-30",
condition: "good",
discrepancy_note: "20 units short — supplier notified",
},
{
product_id: "prod_bandages_medium",
quantity_received: 100,
batch_number: "BATCH-BND-2024-0234",
expiry_date: "2027-06-01",
condition: "good",
},
],
}),
}
);Always verify batch numbers and expiry dates during receiving. MediFlux uses this information for batch-level tracking, expiry alerts, and recall management.
Purchase Order Statuses
A purchase order progresses through the following statuses:
Accounting Integration
When inventory is received against a purchase order, MediFlux automatically creates the corresponding accounting entries:
Debit: Inventory Asset $4,697.50
Credit: Accounts Payable $4,697.50When the supplier invoice is paid:
Debit: Accounts Payable $4,697.50
Credit: Cash / Bank Account $4,697.50This automatic double-entry bookkeeping ensures your financial records always reflect the true state of your inventory and liabilities without manual journal entries.