SALESORDERITEMFEE
                                        Links a fee with a sales order item  
                                        Primary Key
                                        
                                            
                                                
                                                    | Primary Key | Field Type | 
                                            
                                            
                                                
                                                    | ID | uniqueidentifier | 
                                            
                                        
                                        Fields
                                        
                                            
                                                
                                                    | Field | Field Type | Null | Notes | Description | 
                                            
                                            
                                                
                                                    | TYPECODE | tinyint |  | Default = 0 | The type of fee the item represents | 
                                                
                                                    | APPLIESTOCODE | tinyint |  | Default = 0 | The application type of fee | 
                                                
                                                    | DATEADDED | datetime |  | Default = getdate() | Indicates the date this record was added. | 
                                                
                                                    | DATECHANGED | datetime |  | Default = getdate() | Indicates the date this record was last changed. | 
                                                
                                                    | TS | timestamp |  |  | Timestamp. | 
                                                
                                                    | TSLONG | bigint (Computed) | yes | CONVERT(bigint, TS) | Numeric representation of the timestamp. | 
                                                
                                                    | APPLIESTO | nvarchar(5) (Computed) | yes | CASE [APPLIESTOCODE] WHEN 0 THEN N'Order' WHEN 1 THEN N'Item' END | Provides a translation for the 'APPLIESTOCODE' field. | 
                                                
                                                    | TYPE | nvarchar(15) (Computed) | yes | CASE [TYPECODE] WHEN 0 THEN N'Delivery Method' WHEN 1 THEN N'Sales Method' WHEN 2 THEN N'Program' WHEN 3 THEN N'Rate Scale' END | Provides a translation for the 'TYPECODE' field. | 
                                                
                                                    | FEENAME | nvarchar(100) |  | Default = '' | Name of fee at time of sale. | 
                                            
                                        
                                        Foreign Keys
                                        
                                            
                                                
                                                    | Foreign Key | Field Type | Null | Notes | Description | 
                                            
                                            
                                                
                                                    | ID | uniqueidentifier |  | SALESORDERITEM.ID | Primary Key. | 
                                                
                                                    | SALESORDERITEMID | uniqueidentifier | yes | SALESORDERITEM.ID | Sales order item the fee belongs to | 
                                                
                                                    | FEEID | uniqueidentifier | yes | FEE.ID | The fee used for this sales order item | 
                                                
                                                    | ADDEDBYID | uniqueidentifier |  | CHANGEAGENT.ID | FK to CHANGEAGENT. | 
                                                
                                                    | CHANGEDBYID | uniqueidentifier |  | CHANGEAGENT.ID | FK to CHANGEAGENT. | 
                                            
                                        
                                        Indexes
                                        
                                            
                                                
                                                    | Index Name | Fields | Unique | Primary | Clustered | 
                                            
                                            
                                                
                                                    | IX_SALESORDERITEMFEE_DATEADDED | DATEADDED |  |  | yes | 
                                                
                                                    | IX_SALESORDERITEMFEE_DATECHANGED | DATECHANGED |  |  |  | 
                                                
                                                    | IX_SALESORDERITEMFEE_SALESORDERITEMID | SALESORDERITEMID |  |  |  | 
                                                
                                                    | PK_SALESORDERITEMFEE | ID | yes | yes |  | 
                                            
                                        
                                        Triggers
                                        
                                        Referenced by