Get a purchase order

distru-get-purchase-orderRead

Gets one purchase order (a purchase from a supplier) by ID: header detail with supplier, owner, intake, billing and supplier locations, amount paid and the matched compliance manifest number.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
idstringYesResolve via distru-search-purchase-orders.
includeOrderItemsbooleanNoLine quantity, receivedQuantity and price (cost per unit) are in product.unitType; receivedQuantity is 0 before PARTIALLY_RECEIVED and equals quantity once COMPLETED; a line has a package only once the purchase is matched to a compliance transfer.
includeOrderChargesbooleanNoCharges, discounts and taxes.
includePaymentsbooleanNoNon-voided payments, oldest paymentDate first; they sum to paid. Their ids work with distru-get-purchase-payment and distru-void-purchase-payment. paymentMethod null when the method was deleted. Their QuickBooks fields read as on distru-get-purchase-payment.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresenceDescription
purchaseOrderobjectNull or absent
purchaseOrder.idstringAlways
purchaseOrder.customFieldsobject[]Always
purchaseOrder.customFields[].customFieldobjectAlways
purchaseOrder.customFields[].customField.idstringAlways
purchaseOrder.customFields[].customField.namestringAlways
purchaseOrder.customFields[].customField.fieldTypeenum
CHECKBOXDATEDROPDOWNTEXT
Always
purchaseOrder.customFields[].valuestringCan be null
purchaseOrder.purchaseNumberstringAlways
purchaseOrder.statusenum
COMPLETEDDELIVERINGDRAFTPARTIALLY_RECEIVEDPENDINGPROCESSING
Always
purchaseOrder.paymentStatusenum
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
Always
purchaseOrder.totalstringAlways
purchaseOrder.totalChargesstringAlways
purchaseOrder.paidstringAlways
purchaseOrder.orderDatestringCan be null
purchaseOrder.dueDatestringCan be null
purchaseOrder.createdDatestringAlways
purchaseOrder.updatedDatestringAlways
purchaseOrder.descriptionstringCan be null
purchaseOrder.urlstringAlways
purchaseOrder.supplierobjectNull or absent
purchaseOrder.supplier.idstringAlways
purchaseOrder.supplier.namestringNull or absent
purchaseOrder.ownerobjectCan be null
purchaseOrder.owner.idstringAlways
purchaseOrder.owner.profileobjectAlways
purchaseOrder.owner.profile.fullNamestringAlways
purchaseOrder.intakeLocationobjectCan be null
purchaseOrder.intakeLocation.idstringAlways
purchaseOrder.intakeLocation.namestringAlways
purchaseOrder.intakeLocation.addressstringAlways
purchaseOrder.billingLocationobjectCan be null
purchaseOrder.billingLocation.idstringAlways
purchaseOrder.billingLocation.namestringAlways
purchaseOrder.billingLocation.addressstringAlways
purchaseOrder.supplierLocationobjectCan be null
purchaseOrder.supplierLocation.idstringAlways
purchaseOrder.supplierLocation.namestringAlways
purchaseOrder.supplierLocation.addressstringAlways
purchaseOrder.qbBillIdstringCan be null
purchaseOrder.qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be null
purchaseOrder.orderItemsobject[]Can be absent
purchaseOrder.orderItems[].idstringAlways
purchaseOrder.orderItems[].quantitystringAlways
purchaseOrder.orderItems[].receivedQuantitystringCan be null
purchaseOrder.orderItems[].pricestringAlways
purchaseOrder.orderItems[].productobjectAlways
purchaseOrder.orderItems[].product.idstringAlways
purchaseOrder.orderItems[].product.namestringAlways
purchaseOrder.orderItems[].product.unitTypeobjectAlways
purchaseOrder.orderItems[].product.unitType.idstringAlways
purchaseOrder.orderItems[].product.unitType.namestringAlways
purchaseOrder.orderItems[].batchobjectCan be null
purchaseOrder.orderItems[].batch.idstringAlways
purchaseOrder.orderItems[].batch.namestringAlways
purchaseOrder.orderItems[].locationobjectCan be null
purchaseOrder.orderItems[].location.idstringAlways
purchaseOrder.orderItems[].location.namestringAlways
purchaseOrder.orderItems[].packageobjectCan be null
purchaseOrder.orderItems[].package.idstringAlways
purchaseOrder.orderItems[].package.metrcLabelstringAlways
purchaseOrder.orderChargesobject[]Can be absent
purchaseOrder.orderCharges[].idstringAlways
purchaseOrder.orderCharges[].namestringAlways
purchaseOrder.orderCharges[].typestringAlways
purchaseOrder.orderCharges[].unitTypestringAlways
purchaseOrder.orderCharges[].percentstringCan be null
purchaseOrder.orderCharges[].pricestringAlways
purchaseOrder.orderCharges[].isTaxbooleanAlways
purchaseOrder.paymentsobject[]Can be absent
purchaseOrder.payments[].idstringAlways
purchaseOrder.payments[].paymentNumberstringAlways
purchaseOrder.payments[].paymentDatestringAlways
purchaseOrder.payments[].statusenum
POSTEDVOIDED
AlwaysVOIDED payments no longer count toward paid.
purchaseOrder.payments[].voidedAtstringCan be null
purchaseOrder.payments[].amountstringAlwaysDollars, as recorded; a void leaves it unchanged.
purchaseOrder.payments[].paymentMethodobjectCan be nullNull once the method is deleted.
purchaseOrder.payments[].paymentMethod.idstringAlways
purchaseOrder.payments[].paymentMethod.namestringAlways
purchaseOrder.payments[].notestringCan be null
purchaseOrder.payments[].qbPaymentAccountstringCan be nullFull name of the QuickBooks Bank or Credit Card account the payment was made from. Null when it has none or the account is not in the QuickBooks cache.
purchaseOrder.payments[].qbBillPaymentIdstringCan be nullIts QuickBooks bill payment ID.
purchaseOrder.payments[].qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be nullNull unless the company's QuickBooks module is on and connected. PENDING and ERROR are its latest sync's outcome and win over the rest. A payment syncs only once its purchase has a QuickBooks bill and purchase payment sync is on, so NOT_SYNCED is normal before that.
purchaseOrder.payments[].insertedAtstringAlways
purchaseOrder.payments[].updatedAtstringAlwaysAlso moves on a void.
purchaseOrder.complianceManifestNumberstringCan be nullManifest number of the matched compliance transfer; null when unmatched.
What the AI reads

Gets one purchase order (a purchase from a supplier) by ID: header detail with supplier, owner, intake, billing and supplier locations, amount paid and the matched compliance manifest number. Line items, charges and payments are left out unless you pass includeOrderItems, includeOrderCharges or includePayments. Use for a specific purchase after resolving its ID via distru-search-purchase-orders; to browse purchases use distru-search-purchase-orders; for payments across purchases, distru-search-purchase-payments. intakeLocation is where the inventory is received into; supplierLocation is where the items ship from, null when unset or when the supplier uses Distru itself. A soft-deleted location is null. description is the purchase notes. paid is the sum of the non-voided payments. complianceManifestNumber is null when unmatched. Drafts are returned too (status DRAFT) and may lack supplier, locations, dates and lines. qbBillId is its QuickBooks bill ID. qbSyncStatus is null unless the company's QuickBooks module is on and connected; PENDING and ERROR are its latest sync's outcome and win over the rest; DELETED_IN_QBO = the bill was deleted in QuickBooks; NOT_SYNCED = it has no QuickBooks bill. Bill payment syncs don't count. qbSyncStatus ERROR: distru-search-quickbooks-activities with purchaseOrderIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't. Null if no purchase matches the ID; a permission error if the caller can't view it.