object DM: TDM
  OldCreateOrder = False
  Height = 213
  Width = 437
  object Conn: TADOConnection
    ConnectionString = 
      'Provider=MSDASQL.1;Password=000123;Persist Security Info=True;Us' +
      'er ID=root;Extended Properties="Driver=MySQL ODBC 5.3 Unicode Dr' +
      'iver;SERVER=127.0.0.1;UID=root;PWD=000123zxc;DATABASE=scbest;POR' +
      'T=3306;COLUMN_SIZE_S32=1";Initial Catalog=scbest'
    LoginPrompt = False
    Provider = 'MSDASQL.1'
    Left = 8
    Top = 8
  end
  object tUsers: TADOTable
    Connection = Conn
    CursorType = ctStatic
    TableName = 'users'
    Left = 8
    Top = 112
    object tUsersid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tUserslogin: TWideStringField
      FieldName = 'login'
      Size = 250
    end
    object tUsersname: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object tUserspassword: TWideStringField
      FieldName = 'password'
      Size = 250
    end
    object tUsersrights: TSmallintField
      FieldName = 'rights'
    end
  end
  object tFixPrice: TADOTable
    Connection = Conn
    CursorType = ctStatic
    TableName = 'fixprice'
    Left = 48
    Top = 112
    object tFixPriceid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tFixPricedeviceType_id: TIntegerField
      FieldName = 'deviceType_id'
    end
    object tFixPriceprice: TFloatField
      FieldName = 'price'
    end
    object tFixPricename: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object tFixPricedescription: TWideMemoField
      FieldName = 'description'
      BlobType = ftWideMemo
    end
    object tFixPricedeviceType: TStringField
      FieldKind = fkLookup
      FieldName = 'deviceType'
      LookupDataSet = tDevType
      LookupKeyFields = 'id'
      LookupResultField = 'name'
      KeyFields = 'deviceType_id'
      Size = 250
      Lookup = True
    end
  end
  object tDevType: TADOTable
    Connection = Conn
    CursorType = ctStatic
    TableName = 'devtype'
    Left = 128
    Top = 112
    object tDevTypeid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tDevTypename: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object tDevTypeparent_id: TIntegerField
      Alignment = taLeftJustify
      FieldName = 'parent_id'
    end
  end
  object tBrand: TADOTable
    Connection = Conn
    CursorType = ctStatic
    TableName = 'brand'
    Left = 216
    Top = 112
    object tBrandid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tBrandname: TWideStringField
      FieldName = 'name'
      Size = 250
    end
  end
  object tClient: TADOTable
    Connection = Conn
    CursorType = ctStatic
    TableName = 'client'
    Left = 256
    Top = 112
    object tClientid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tClientname: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object tClientaddress: TWideStringField
      FieldName = 'address'
      Size = 250
    end
    object tClientphone: TWideStringField
      FieldName = 'phone'
      Size = 100
    end
    object tClientphone2: TWideStringField
      FieldName = 'phone2'
      Size = 100
    end
    object tClientcomment: TWideMemoField
      FieldName = 'comment'
      BlobType = ftWideMemo
    end
  end
  object tConfig: TADOTable
    Connection = Conn
    CursorType = ctStatic
    TableName = 'config'
    Left = 296
    Top = 112
    object tConfigid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tConfigname: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object tConfiginn: TWideStringField
      FieldName = 'inn'
      Size = 50
    end
    object tConfigogrn: TWideStringField
      FieldName = 'ogrn'
      Size = 50
    end
    object tConfigaddress: TWideStringField
      FieldName = 'address'
      Size = 250
    end
    object tConfigphone: TWideStringField
      FieldName = 'phone'
      Size = 250
    end
    object tConfigsmsApi: TWideStringField
      FieldName = 'smsApi'
      Size = 250
    end
  end
  object tValue: TADOTable
    Connection = Conn
    CursorType = ctStatic
    IndexFieldNames = 'id'
    TableName = 'value'
    Left = 384
    Top = 16
    object tValueid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object tValuedeviceType_id: TIntegerField
      FieldName = 'deviceType_id'
    end
    object tValuevendor: TWideStringField
      FieldName = 'vendor'
      Size = 50
    end
    object tValuename: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object tValueisFolder: TSmallintField
      FieldName = 'isFolder'
    end
  end
  object qMain: TADOQuery
    Connection = Conn
    CursorType = ctStatic
    Parameters = <>
    SQL.Strings = (
      'SELECT'
      '  m.*,'
      '  dt.name AS devtype,'
      '  b.name AS brand,'
      '  c.name AS client,'
      '  c.address AS address,'
      '  c.phone AS phone,'
      '  c.phone2 AS phone2,'
      '  u.name AS user'
      'FROM main AS m'
      'LEFT JOIN users AS u ON m.user_id=u.id'
      'LEFT JOIN brand AS b ON m.brand_id=b.id'
      'LEFT JOIN devtype AS dt ON m.devtype_id=dt.id'
      'LEFT JOIN client AS c ON m.client_id=c.id'
      'WHERE'
      '1=1 AND 1=1'
      'ORDER BY id DESC')
    Left = 8
    Top = 56
    object qMainid: TAutoIncField
      FieldName = 'id'
      KeyFields = 'id'
      ReadOnly = True
    end
    object qMaindate: TDateTimeField
      FieldName = 'date'
    end
    object qMainbrand_id: TIntegerField
      FieldName = 'brand_id'
    end
    object qMaindevtype_id: TIntegerField
      FieldName = 'devtype_id'
    end
    object qMainstatus: TWideStringField
      FieldName = 'status'
      Size = 50
    end
    object qMainclient_id: TIntegerField
      FieldName = 'client_id'
    end
    object qMainmodel: TWideStringField
      FieldName = 'model'
      Size = 150
    end
    object qMainserial: TWideStringField
      FieldName = 'serial'
      Size = 150
    end
    object qMainuser_id: TIntegerField
      FieldName = 'user_id'
    end
    object qMaindate_end: TDateTimeField
      FieldName = 'date_end'
    end
    object qMaindefect: TWideMemoField
      FieldName = 'defect'
      BlobType = ftWideMemo
    end
    object qMaincomment: TWideMemoField
      FieldName = 'comment'
      BlobType = ftWideMemo
    end
    object qMainwarranty: TIntegerField
      Alignment = taLeftJustify
      FieldName = 'warranty'
    end
    object qMaindevtype: TWideStringField
      FieldName = 'devtype'
      Size = 250
    end
    object qMainbrand: TWideStringField
      FieldName = 'brand'
      Size = 250
    end
    object qMainclient: TWideStringField
      FieldName = 'client'
      Size = 250
    end
    object qMainaddress: TWideStringField
      FieldName = 'address'
      Size = 250
    end
    object qMainphone: TWideStringField
      FieldName = 'phone'
      Size = 100
    end
    object qMainphone2: TWideStringField
      FieldName = 'phone2'
      Size = 100
    end
    object qMainuser: TWideStringField
      FieldName = 'user'
      Size = 250
    end
  end
  object qStock: TADOQuery
    Connection = Conn
    CursorType = ctStatic
    Parameters = <>
    SQL.Strings = (
      'SELECT'
      's.*,'
      'IF(s.moveIn=1,'#39#1054#1087#1088#1080#1093#1086#1076#1086#1074#1072#1085#1080#1077#39','#39#1057#1087#1080#1089#1072#1085#1080#1077#39') AS move_in,'
      'u.name AS user'
      'FROM stock AS s'
      'LEFT JOIN users AS u ON s.user_id=u.id')
    Left = 384
    Top = 64
    object qStockid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object qStockdate: TDateField
      FieldName = 'date'
    end
    object qStockmoveIn: TSmallintField
      FieldName = 'moveIn'
    end
    object qStockmain_id: TIntegerField
      FieldName = 'main_id'
    end
    object qStockbase: TWideStringField
      FieldName = 'base'
      Size = 250
    end
    object qStockcomment: TWideMemoField
      FieldName = 'comment'
      BlobType = ftWideMemo
    end
    object qStockuser_id: TIntegerField
      FieldName = 'user_id'
    end
    object qStockmove_in: TWideStringField
      FieldName = 'move_in'
      ReadOnly = True
      Size = 13
    end
    object qStockuser: TWideStringField
      FieldName = 'user'
      Size = 250
    end
  end
  object qStockMove: TADOQuery
    Parameters = <>
    Left = 384
    Top = 120
  end
  object qRemove: TADOQuery
    Connection = Conn
    Parameters = <>
    Left = 200
    Top = 8
  end
  object qRequest: TADOQuery
    Connection = Conn
    Parameters = <>
    Left = 272
    Top = 8
  end
  object qDevType: TADOQuery
    Connection = Conn
    CursorType = ctStatic
    Parameters = <>
    SQL.Strings = (
      'SELECT * FROM `devtype` WHERE `parent_id` = 0')
    Left = 128
    Top = 48
    object qDevTypeid: TAutoIncField
      FieldName = 'id'
      ReadOnly = True
    end
    object qDevTypename: TWideStringField
      FieldName = 'name'
      Size = 250
    end
    object qDevTypeparent_id: TIntegerField
      FieldName = 'parent_id'
    end
  end
end
