All tables
tables · table

pohdr

The pohdr table serves as the Purchase Order Header (often functioning as a Sales Order header in this ERP context) for customer-facing transactions. It stores high-level administrative details, shipment addresses, payment terms, and amendment tracking for orders received from customers.

Row count
915
Last entry
2026-12-20
Source
tables

Columns

20
ColumnTypeNullableMeaning
compcodestringNoUnique identifier for the company/branch.
PONOstringNoCustomer Purchase Order Number.
custcodestringNoUnique identifier for the customer.
POdatedatetimeYesThe date the Purchase Order was issued by the customer.
lockedstringYesFinalization status of the PO.
amndnointegerNoAmendment/Revision number for the PO.
amnddatedatetimeYesThe date of the last amendment.
oanonumberYesInternal Order Acceptance Number.
oadatedatetimeYesInternal Order Acceptance Date.
currencystringYesTransaction currency for the order.
credit_daysintegerYesNumber of days allowed for payment.
mode_paymentstringYesDefined method of payment.
desp_thrustringYesMode of dispatch or transport provider.
ConsigneestringYesThe party to whom the goods are being sent.
validuptodatetimeYesExpiry date of the PO terms.
wefdatedatetimeYes"With Effect From" date for terms/pricing.
useraddstringYesUsername of the creator.
addtimestringYesTimestamp of record creation.
usermodstringYesUsername of the last modifier.
modtimestringYesTimestamp of last modification.

Full documentation

### 1) Overview
 The `pohdr` table serves as the **Purchase Order Header** (often functioning as a Sales Order header in this ERP context) for customer-facing transactions. It stores high-level administrative details, shipment addresses, payment terms, and amendment tracking for orders received from customers.
 
 Key functional aspects include:
 * **Version Control:** Uses `amndno` (Amendment Number) to track revisions of a single `PONO`.
 * **Status Management:** Employs the `locked` flag to indicate whether an order is finalized.
 * **External Integration:** Links internal Order Acceptance numbers (`oano`) to customer Purchase Orders (`PONO`).
 
 ### 2) Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **compcode** | string | No | Unique identifier for the company/branch. | e.g., "DAS" | Primary Join Key |
 | **PONO** | string | No | Customer Purchase Order Number. | | Primary Business Key |
 | **custcode** | string | No | Unique identifier for the customer. | e.g., "NAEL", "BIL" | Join Key to `cust` table |
 | **POdate** | datetime | Yes | The date the Purchase Order was issued by the customer. | | Filter/Reporting |
 | **locked** | string | Yes | Finalization status of the PO. | 'Y' (Locked), 'N' (Unlocked) | Filter for Active Rates |
 | **amndno** | integer | No | Amendment/Revision number for the PO. | 0 for original | Version Tracking |
 | **amnddate** | datetime | Yes | The date of the last amendment. | | Tracking |
 | **oano** | number | Yes | Internal Order Acceptance Number. | | Join to `oadtl` |
 | **oadate** | datetime | Yes | Internal Order Acceptance Date. | | Tracking |
 | **currency** | string | Yes | Transaction currency for the order. | e.g., "INR", "USD" | Financial Reporting |
 | **credit_days** | integer | Yes | Number of days allowed for payment. | | Terms Calculation |
 | **mode_payment** | string | Yes | Defined method of payment. | | Reference |
 | **desp_thru** | string | Yes | Mode of dispatch or transport provider. | | Logistics |
 | **Consignee** | string | Yes | The party to whom the goods are being sent. | | Shipping |
 | **validupto** | datetime | Yes | Expiry date of the PO terms. | | Validation |
 | **wefdate** | datetime | Yes | "With Effect From" date for terms/pricing. | | Pricing Logic |
 | **useradd** | string | Yes | Username of the creator. | | Audit |
 | **addtime** | string | Yes | Timestamp of record creation. | | Audit |
 | **usermod** | string | Yes | Username of the last modifier. | | Audit |
 | **modtime** | string | Yes | Timestamp of last modification. | | Audit |
 
 ### 3) Relationships & Join Map
 
 The `pohdr` table acts as a central hub for sales/customer order processing.
 
 #### Primary Joins (Strictly based on SCHEMA_MAP):
 * **podtl (PO Details):** Joins via `(pono, custcode, compcode)`. This is the most common join to retrieve line items for a header.
 * **cust (Customer Master):** Joins via `(custcode, compcode)` to retrieve customer names and credit profiles.
 * **pohdramnd (PO Amendment History):** Joins via `(pono, custcode, compcode)` to track previous versions of headers.
 * **oadtl (Order Acceptance Details):** Joins via `(oano, compcode)` (Likely, as oano is the internal link).
 * **debithdr (Debit Notes):** Joins via `(pono, compcode)` (Likely, per `AgainstPONo` in `Debithdr`).
 
 #### Reference Context:
 * **Price Extraction:** Used in `FGStock` and `PPC_COPQ` procedures to determine the valid rate for an item by joining `pohdr` -> `podtl` -> `saleitemmas` where `pohdr.locked = 'N'`.
 * **Balance Tracking:** Used in `viewsobalance` to calculate outstanding quantities against customer invoices.