Skip to main content
Version: v1.0.0(int)

W116: Generate PO PDF

Renders a printable PO document and returns the PDF bytes. Triggered from Purchase Order Detail, "Export PDF". Composes header, items, vendor and billing contact, ship-to location, and the org's branding (logo, address) into a generic CPG template; no per-template Anthem code lives here.

Steps

  1. Hydrate everything Get Detail returns. Run W113 to load PO header, items, vendor, location, and referenced catalog rows.

  2. Load the vendor billing contact. Call Vendors.getById and Contacts.listByEntity('vendor', vendorId) to pull the primary billing contact.

  3. Load the org branding bundle. Call OrganizationSettings.get for the logo reference (resolves to a Documents row), billing address, and any per-org branding values.

  4. Render the PDF. Feed the generic CPG template with the data above. The template is shape-only; org settings provide every value.

  5. Return the PDF bytes. The L4 layer streams them to the client.

Returns

The PDF bytes for the rendered PO.

Business rules

  • No Anthem-specific values in code. The template is generic; everything that differs between orgs lives in organization_settings.
  • Logo is optional. If the org has not set a logo, the template renders without one rather than failing.

Errors

  • NotFoundError. The PO was not found.