Table: Invoice
Columns
Name | Type | Constraints | Description
ledger_entry_KEY | int | NOT NULL |
invoice_KEY | int | NOT NULL | Database assigned primary key for this table
update__staff_KEY | int | NOT NULL |
update_date | datetime | NOT NULL |
create_date | datetime | NOT NULL |
row_version | timestamp | NOT NULL |
report_definition_KEY | int | NOT NULL | Key to an Invoice Report Definition record.
printed | bit | NOT NULL | Indicates if this Invoice has been printed.
due_date | smalldatetime | NOT NULL | Due date
billed_date | smalldatetime | NOT NULL | Date this invoice was saved.
billed__staff_KEY | int | NOT NULL | Key of the Staff who billed this invoice.
invoice_format | nvarchar (-1) | NOT NULL | The uncompressed invoice format containing a copy of the invoice Report Definition and composed field values.
time_amount_billed | decimal (17, 2) | NOT NULL | Denormalized
time_amount_adjusted | decimal (17, 2) | NOT NULL | Denormalized
expense_amount_billed | decimal (17, 2) | NOT NULL | Denormalized
expense_amount_adjusted | decimal (17, 2) | NOT NULL | Denormalized
progress_amount_billed | decimal (17, 2) | NOT NULL | Denormalized
surcharge | decimal (17, 2) | NOT NULL | Denormalized
discount | decimal (17, 2) | NOT NULL | The discount amount on this invoice (always 0 or negative.)
sales_tax | decimal (17, 2) | NOT NULL | Denormalized
service_tax | decimal (17, 2) | NOT NULL | Denormalized
positive_invoiced | decimal (17, 2) | NOT NULL | Sum of Billing_Decision.invoiced for this invoice where Billing_Decision.invoiced > 0.
negative_invoiced | decimal (17, 2) | NOT NULL | Sum of Billing_Decision.invoiced for this invoice where Billing_Decision.invoiced < 0.
positive_nonprogress_invoiced | decimal (17, 2) | NOT NULL | Sum of Billing_Decision.invoiced for this invoice where Billing_Decision.invoiced > 0 and the Billing_Decision is not progress or progress relief.
negative_nonprogress_invoiced | decimal (17, 2) | NOT NULL | Sum of Billing_Decision.invoiced for this invoice where Billing_Decision.invoiced < 0 and the Billing_Decision is not progress or progress relief.
positive_progress_invoiced | decimal (17, 2) | NOT NULL | Sum of Billing_Decision.invoiced for this invoice where Billing_Decision.invoiced > 0 and the Billing_Decision is progress or progress relief.
negative_progress_invoiced | decimal (17, 2) | NOT NULL | Sum of Billing_Decision.invoiced for this invoice where Billing_Decision.invoiced < 0 and the Billing_Decision is progress or progress relief.
invoice_format_compressed | varbinary (-1) |  | The compressed invoice format containing a copy of the invoice Report Definition and composed field values.
invoice_format_storage_style_KEY | int | NOT NULL | Key of the Invoice Format Storage Style that indicates how the invoice format is stored.

Primary key
Name | Columns | Description
PK_Invoice$ledger_entry_KEY | ledger_entry_KEY | CLUSTERED
Unique constraints
Name | Columns | Description
UK_Invoice__invoice_KEY | invoice_KEY | DEPRECATED. With a new primary key, the invoice table must have a unique constraint to replace it.
Indexes
Name | Columns | Description
IX_Invoice$billed__staff_KEY | billed__staff_KEY | Index supports foreign key FK_Invoice__Staff__billed__staff_KEY
IX_Invoice$invoice_format_storage_style_KEY | invoice_format_storage_style_KEY | Index supports foreign key FK_Invoice__Invoice_Format_Storage_Style__invoice_format_storage_style_KEY
IX_Invoice$report_definition_KEY | report_definition_KEY | Index supports foreign key FK_Invoice__Report_Definition__report_definition_KEY

Foreign keys
Name | Columns | Referenced table | Description
FK_Invoice__Invoice_Format_Storage_Style__invoice_format_storage_style_KEY | invoice_format_storage_style_KEY | Invoice_Format_Storage_Style |
FK_Invoice__Ledger_Entry__invoice_KEY | invoice_KEY | Ledger_Entry |
FK_Invoice__Ledger_Entry__ledger_entry_KEY | ledger_entry_KEY | Ledger_Entry |
FK_Invoice__Report_Definition__report_definition_KEY | report_definition_KEY | Report_Definition |
FK_Invoice__Staff__billed__staff_KEY | billed__staff_KEY | Staff |

Incoming foreign keys
Name | Columns | Referencing table | Description
FK_Integration_Invoice__Invoice__invoice_KEY | invoice_KEY | Integration_Invoice | on delete cascade;
FK_Invoice_Office__Invoice__ledger_entry_KEY | ledger_entry_KEY | Invoice_Office | on delete cascade;
FK_Online_Invoice__Invoice__ledger_entry_KEY | ledger_entry_KEY | Online_Invoice | on delete cascade;
FK_Report_Definition_Update_List__Invoice__invoice_KEY | invoice_KEY | Report_Definition_Update_List | on delete cascade;
FK_Billing_Decision__Invoice__invoice_KEY | invoice_KEY | Billing_Decision |
FK_Billing_Decision__Invoice__ledger_entry_KEY | ledger_entry_KEY | Billing_Decision |
FK_Billing_Decision_Collection__Invoice__from__ledger_entry_KEY | from__ledger_entry_KEY | Billing_Decision_Collection | on delete cascade;
FK_Billing_Decision_Tax_Collection__Invoice__from__ledger_entry_KEY | from__ledger_entry_KEY | Billing_Decision_Tax_Collection | on delete cascade;