Documentation/EHI_Export/docs/tables/drug_sales.html
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments |
|---|---|---|---|---|---|---|---|---|
| sale_id | INT | 10 | √ | null |
|
|
The unique identifier for this record
| | drug_id | INT | 10 | | | null |
|
| drugs.drug_id | Defined in XML | R |
|
The id of the drug that was sold to the patient. 0 if the record is not dispensed to a patient
| | inventory_id | INT | 10 | | | null |
|
| | | prescription_id | INT | 10 | | | 0 |
|
| | | pid | BIGINT | 19 | | | 0 |
|
| patient_data.pid | Defined in XML | R |
|
The internal patient identifier
| | encounter | INT | 10 | | | 0 |
|
| form_encounter.encounter | Defined in XML | R |
|
The patient encounter which resulted in this drug being sold to the patient.
| | user | VARCHAR | 255 | √ | | NULL |
|
| | | sale_date | DATE | 10 | | | null |
|
|
The date the sale occurred on
| | quantity | INT | 10 | | | 0 |
|
|
The number of items sold of the drug
| | fee | DECIMAL | 12,2 | | | 0.00 |
|
|
The total price of the sale for the drug that was sold to the patient
| | billed | BOOLEAN | 3 | | | 0 |
|
|
indicates if the sale is posted to accounting
| | xfer_inventory_id | INT | 10 | | | 0 |
|
| | | distributor_id | BIGINT | 19 | | | 0 |
|
|
UNUSED - will be removed in the future
| | notes | VARCHAR | 255 | | | '' |
|
| | | bill_date | DATETIME | 19 | √ | | NULL |
|
| | | pricelevel | VARCHAR | 31 | √ | | '' |
|
| | | selector | VARCHAR | 255 | √ | | '' |
|
|
references drug_templates.selector
| | trans_type | TINYINT | 3 | | | 1 |
|
|
1=sale, 2=purchase, 3=return, 4=transfer, 5=adjustment
| | chargecat | VARCHAR | 31 | √ | | '' |
|
| | | uuid | BINARY | 16 | √ | | NULL |
|
|
UUID for this drug sales record, for data exchange purposes
| | pharmacy_supply_type | VARCHAR | 50 | √ | | NULL |
|
| list_options.option_id | Defined in XML | R |
|
fk to list_options.option_id WHERE list_options.list_id=‘act_pharmacy_supply_type’
| | last_updated | DATETIME | 19 | | | current_timestamp() |
|
| | | date_created | DATETIME | 19 | | | current_timestamp() |
|
| | | updated_by | BIGINT | 19 | √ | | NULL |
|
| users.id | Defined in XML | R |
|
The id of the user that last updated this record
| | created_by | BIGINT | 19 | √ | | NULL |
|
| users.id | Defined in XML | R |
|
The id of the user that initially created this record
|
| Constraint Name | Type | Sort | Column(s) |
|---|---|---|---|
| PRIMARY | Primary key | Asc | sale_id |
| uuid_unique | Must be unique | Asc | uuid |