All tables
tables · table

pohdramnd

The pohdramnd table serves as the historical header repository for Sales Purchase Order Amendments. It stores snapshots of customer purchase orders whenever a revision (amendment) occurs. Each record tracks specific changes to dispatch addresses, payment terms, and validity periods, uniquely identified by the combination of the Purchase Order Number (PONO) and the Amendment Number (amndno).

Row count
2,163
Last entry
2099-10-23
Source
tables

Columns

22
ColumnTypeNullableMeaning
indexintegerNOPrimary key/Identity
compcodestringYESCompany Identifier
PONOstringYESCustomer Purchase Order Number
custcodestringYESUnique identifier for the Customer
POdatedatetimeYESOriginal date of the Purchase Order
desp_address1stringYESDispatch Address Line 1
desp_address2stringYESDispatch Address Line 2
desp_address3stringYESDispatch Address Line 3
mode_paymentstringYESPayment Terms/Method
credit_daysintegerYESDays allowed for payment
Desp_thrustringYESDelivery/Dispatch Mode
DestinationstringYESGoods Destination City
chapterstringYESHSN or Excise Chapter reference
lockedstringYESStatus flag for the record
amndnointegerYESAmendment sequence number
amnddatedatetimeYESDate the amendment was recorded
validuptodatetimeYESPO Expiry Date
wefdatedatetimeYES"With Effect From" Date
oanonumberYESOrder Acceptance Number
oadatedatetimeYESOrder Acceptance Date
remarksstringYESGeneral comments or change notes
ConsigneestringYESReceiving party name

Full documentation

### 1) Overview
 The `pohdramnd` table serves as the historical header repository for **Sales Purchase Order Amendments**. It stores snapshots of customer purchase orders whenever a revision (amendment) occurs. Each record tracks specific changes to dispatch addresses, payment terms, and validity periods, uniquely identified by the combination of the Purchase Order Number (`PONO`) and the Amendment Number (`amndno`).
 
 ### 2) Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | NO | Primary key/Identity | | PK for the row |
 | **compcode** | string | YES | Company Identifier | e.g., "DAS" | Filter, Join key |
 | **PONO** | string | YES | Customer Purchase Order Number | e.g., "1112000562" | Join key to details |
 | **custcode** | string | YES | Unique identifier for the Customer | e.g., "LLIPL" | Join to `cust` table |
 | **POdate** | datetime | YES | Original date of the Purchase Order | | Reporting |
 | **desp_address1** | string | YES | Dispatch Address Line 1 | | Address display |
 | **desp_address2** | string | YES | Dispatch Address Line 2 | | Address display |
 | **desp_address3** | string | YES | Dispatch Address Line 3 | | Address display |
 | **mode_payment** | string | YES | Payment Terms/Method | | Financial reporting |
 | **credit_days** | integer | YES | Days allowed for payment | | Credit control |
 | **Desp_thru** | string | YES | Delivery/Dispatch Mode | | Logistics |
 | **Destination** | string | YES | Goods Destination City | | Shipping logic |
 | **chapter** | string | YES | HSN or Excise Chapter reference | | Join to `chapter` table |
 | **locked** | string | YES | Status flag for the record | 'Y', 'N' | Process locking |
 | **amndno** | integer | YES | Amendment sequence number | 0, 1, 2... | Join/Version control |
 | **amnddate** | datetime | YES | Date the amendment was recorded | | Audit trail |
 | **validupto** | datetime | YES | PO Expiry Date | | Expiry checking |
 | **wefdate** | datetime | YES | "With Effect From" Date | | Pricing/Terms validity |
 | **oano** | number | YES | Order Acceptance Number | | Join to `oahdr` |
 | **oadate** | datetime | YES | Order Acceptance Date | | Transaction audit |
 | **remarks** | string | YES | General comments or change notes | | Documentation |
 | **Consignee** | string | YES | Receiving party name | | Shipping logic |
 
 ### 3) Relationships & Join Map
 
 #### Parent Tables
 * **cust**: Join via `compcode` and `custcode` to retrieve customer master details (name, GST, city).
 * **chapter**: Join via `compcode` and `chapter` to identify tax or excise categories.
 * **oahdr**: Join via `compcode` and `oano` to link the amendment back to the internal Order Acceptance.
 
 #### Child/Related Tables
 * **podtlamnd**: Join via `compcode`, `PONO`, `custcode`, and `amndno`. This is the primary child table containing the specific items (line items) associated with this header amendment.
 * **pohdr**: Join via `compcode` and `PONO` to compare amendment data against the current/latest PO header.
 
 #### Join Logic (Authoritative)
 ```sql
 -- Retrieving Amended Header and amended line items
 SELECT *
 FROM dbo.pohdramnd h
 INNER JOIN dbo.podtlamnd d 
  ON h.compcode = d.compcode 
  AND h.PONO = d.pono 
  AND h.amndno = d.amndno 
  AND h.custcode = d.custcode;
 
 -- Retrieving Customer Information for an amendment
 SELECT h.PONO, c.custname
 FROM dbo.pohdramnd h
 INNER JOIN dbo.cust c 
  ON h.compcode = c.compcode 
  AND h.custcode = c.custcode;
 ```