Table: Billing_Decision
Columns
Name | Type | Constraints | Description
billing_decision_KEY | int | NOT NULL | AUTO-INCREMENT: Database assigned primary key for this table
update__staff_KEY | int | NOT NULL |
update_date | datetime | NOT NULL |
create_date | datetime | NOT NULL |
billing_decision_guid | uniqueidentifier | NOT NULL | A unique key for this row generated in detail billing otherwise by the database.
invoice_KEY | int | NOT NULL | The Invoice this billing apears on.
sheet_entry_KEY | int | NOT NULL | The Sheet Entry this billing is for.
ledger_entry_KEY | int | NOT NULL | The Invoice this billing apears on (same as invoice_KEY column of Billing_Decision.)
bill_amount | decimal (9, 2) | NOT NULL | Amount billed for this invoice.
adjustment | decimal (9, 2) | NOT NULL | Adjustment (a negative adjustment is a write down).
units_closed | decimal (9, 2) | NOT NULL | Sheet Entry units closed out by this billing. wip_closed = bill_amount - adjustment.
surcharge | decimal (9, 2) | NOT NULL | Surcharge applied to this item, calculated before discount (surcharge rate x bill_amount).
discount | decimal (9, 2) | NOT NULL | Discount applied to this item.
sales_tax | decimal (9, 2) | NOT NULL | Sum of Billing_Decision_Taxing_Authority.amount for this Billing_Decision for Taxing_Authority records of sales tax.
service_tax | decimal (9, 2) | NOT NULL | Sum of Billing_Decision_Taxing_Authority.amount for this Billing_Decision for Taxing_Authority records of type service tax.
invoiced | decimal (9, 2) | NOT NULL | Total amount that this Billing_Decision is invoiced, including taxes and discounts, if this Billing_Decision is billable. This is always calculated even it the Billing_Decision is non-billable.
recurring_bill | bit | NOT NULL | When set to 1 will indicate that this billing decision is from a recurring bill engagement. Billing decisions that existed prior to Practice CS 2011.2 will not be marked as recurring bill.

Primary key
Name | Columns | Description
PK_Billing_Decision$sheet_entry_KEY$ledger_entry_KEY | sheet_entry_KEY, ledger_entry_KEY | CLUSTERED
Unique constraints
Name | Columns | Description
UK_Billing_Decision__billing_decision_guid | billing_decision_guid |
UK_Billing_Decision__billing_decision_KEY | billing_decision_KEY |
UK_Billing_Decision__invoice_KEY__sheet_entry_KEY | invoice_KEY, sheet_entry_KEY |
UK_Billing_Decision__ledger_entry_KEY__sheet_entry_KEY | ledger_entry_KEY, sheet_entry_KEY |
Indexes
Name | Columns | Description
IX_Billing_Decision$invoice_KEY$sheet_entry_KEY$billing_decision_KEY$bill_amount$adjustment | invoice_KEY, sheet_entry_KEY, billing_decision_KEY, bill_amount, adjustment |
IX_Billing_Decision$ledger_entry_KEY@adjustment@bill_amount@discount@sheet_entry_KEY@surcharge@units_closed | ledger_entry_KEY, adjustment, bill_amount, discount, sheet_entry_KEY, surcharge, units_closed | An index by ledger_entry_KEY that covers adjustment, bill_amount, discount, sheet_entry_KEY, surcharge, units_closed. About 50% of queries access Billing_Decision by ledger_entry_KEY and 50% by sheet_entry_KEY.
IX_Billing_Decision$sheet_entry_KEY$bill_amount$adjustment | sheet_entry_KEY, bill_amount, adjustment |

Foreign keys
Name | Columns | Referenced table | Description
FK_Billing_Decision__Invoice__invoice_KEY | invoice_KEY | Invoice |
FK_Billing_Decision__Invoice__ledger_entry_KEY | ledger_entry_KEY | Invoice |
FK_Billing_Decision__Sheet_Entry__sheet_entry_KEY | sheet_entry_KEY | Sheet_Entry |

Incoming foreign keys
Name | Columns | Referencing table | Description
FK_Billing_Decision_Collection__Billing_Decision__sheet_entry_KEY__ledger_entry_KEY | sheet_entry_KEY, ledger_entry_KEY | Billing_Decision_Collection | on delete cascade;
FK_Billing_Decision_Taxing_Authority__Billing_Decision__billing_decision_KEY | billing_decision_KEY | Billing_Decision_Taxing_Authority |
FK_Billing_Decision_Taxing_Authority__Billing_Decision__sheet_entry_KEY__ledger_entry_KEY | sheet_entry_KEY, ledger_entry_KEY | Billing_Decision_Taxing_Authority |