CREATE TABLE [dbo].[labours] (
   [order_number] [int] NOT NULL,
   [order_position] [int] NOT NULL,
   [order_position_line] [int] NOT NULL,
   [subsidiary] [int] NULL,
   [is_invoiced] [smallint] NULL,
   [invoice_type] [int] NULL,
   [invoice_number] [int] NULL,
   [employee_no] [int] NULL,
   [mechanic_no] [int] NULL,
   [labour_operation_id] [varchar](100) NULL,
   [is_nominal] [smallint] NULL,
   [time_units] [numeric](11,2) NULL,
   [net_price_in_order] [numeric](11,2) NULL,
   [rebate_percent] [numeric](9,6) NULL,
   [goodwill_percent] [numeric](9,6) NULL,
   [charge_type] [int] NULL,
   [text_line] [varchar](255) NULL,
   [usage_value] [numeric](11,2) NULL,
   [negative_flag] [varchar](10) NULL,
   [labour_type] [varchar](10) NULL,
   [client_db] [varchar](20) NOT NULL

   ,CONSTRAINT [labours$0] PRIMARY KEY CLUSTERED ([order_number], [order_position], [order_position_line], [client_db])
)

CREATE NONCLUSTERED INDEX [labours_invoice_type_invoice_number_index] ON [dbo].[labours] ([invoice_type], [invoice_number]) INCLUDE ([time_units], [charge_type])
CREATE NONCLUSTERED INDEX [labours_invoice_type_time_units_index] ON [dbo].[labours] ([invoice_type], [time_units]) INCLUDE ([invoice_number], [charge_type])

GO
