Appearance
dbo.PrimeAccountsPayableInvoices
Info Generated by
scripts/Generate-DataDictionary.ps1- do not edit by hand. Edit descriptions inschemas/tables/dbo.PrimeAccountsPayableInvoices.jsonand regenerate.
Columns
| # | Column | Type | Nullable | Flags | Description |
|---|---|---|---|---|---|
| 1 | AccountsPayableInvoiceId | uniqueidentifier | no | Foreign key to primeAccountsPayableInvoices | |
| 2 | Type | nvarchar(100) | no | Category/type classification of this record | |
| 3 | JobId | uniqueidentifier | yes | Foreign key to primeJobs | |
| 4 | InvoiceNumber | nvarchar(100) | yes | Invoice number/reference | |
| 5 | WorkOrderId | uniqueidentifier | yes | Foreign key to primeWorkOrders | |
| 6 | WorkOrderAssignedId | uniqueidentifier | yes | Foreign key to primeUsers/primeContacts - who the work order is assigned to | |
| 7 | AccountsPayableInvoiceStatus | nvarchar(50) | yes | Status of the accounts-payable invoice | |
| 8 | AccountNumber | nvarchar(50) | yes | Accounting system account number | |
| 9 | ItemCode | nvarchar(100) | yes | Item/product code | |
| 10 | Amount | decimal(18,4) | yes | Monetary amount | |
| 11 | Tax | decimal(18,4) | yes | Tax amount | |
| 12 | TaxTotal | decimal(18,4) | yes | Total tax amount | |
| 13 | InvoicedDate | date | yes | Date the invoice was issued | |
| 14 | DueDate | date | yes | Date this item is due | |
| 15 | AttachmentId | uniqueidentifier | yes | Foreign key to primeAttachment | |
| 16 | ApprovalStatus | nvarchar(50) | yes | Approval status of this record | |
| 17 | ApprovalNote | nvarchar(MAX) | yes | Free-text note explaining the approval decision | |
| 18 | ApprovedBy | nvarchar(255) | yes | User who approved this record | |
| 19 | ApprovedAt | datetime2(7) | yes | Timestamp this record was approved | |
| 20 | ReserveItemIdsJson | nvarchar(MAX) | yes | JSON array of reserve item identifiers related to this record | |
| 21 | CreatedAt | datetime2(7) | yes | Timestamp the record was created | |
| 22 | CreatedBy | nvarchar(255) | yes | User/system that created the record | |
| 23 | UpdatedAt | datetime2(7) | yes | Timestamp the record was last updated | |
| 24 | UpdatedBy | nvarchar(255) | yes | User/system that last updated the record | |
| 25 | IsSynced | bit | no | Flag indicating whether this record has been synced with Prime Ecosystem | |
| 26 | FinalInvoice | bit | no | Flag indicating this is the final invoice for the job | |
| 27 | Version | bigint | yes | Optimistic-concurrency row version number |
Indexes
| Name | Type | Unique | PK | Key columns | Included | Filter |
|---|---|---|---|---|---|---|
| PK_PrimeAccountsPayableInvoices | CLUSTERED | yes | yes | AccountsPayableInvoiceId | ||
| IX_Accountpayable_workorder | NONCLUSTERED | InvoiceNumber, Amount, AccountsPayableInvoiceStatus | AccountsPayableInvoiceId, AttachmentId, JobId, WorkOrderAssignedId, WorkOrderId | |||
| IX_PrimeAPInvoices_JobId | NONCLUSTERED | JobId | AccountsPayableInvoiceStatus, Amount, ApprovalStatus, DueDate, InvoicedDate, InvoiceNumber, TaxTotal | |||
| IX_PrimeAPInvoices_WorkOrderId | NONCLUSTERED | WorkOrderId | AccountsPayableInvoiceStatus, Amount, TaxTotal, WorkOrderAssignedId |
Relationships (inferred)
| From | To | Confidence |
|---|---|---|
| dbo.PrimeAccountsPayableInvoices.WorkOrderId | dbo.primeWorkOrders.id | high |
Referenced by
Procedures: dbo.spEthQueueAccountsPayableInvoices, dbo.spPrimeUpsertAccountsPayableInvoice

