object fReport: TfReport
  Left = 541
  Top = 325
  BorderStyle = bsDialog
  Caption = #1054#1090#1095#1077#1090#1099
  ClientHeight = 160
  ClientWidth = 339
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poMainFormCenter
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object GroupBox1: TGroupBox
    Left = 184
    Top = 0
    Width = 155
    Height = 121
    Align = alRight
    Caption = #1055#1077#1088#1080#1086#1076
    TabOrder = 0
    object Label1: TLabel
      Left = 10
      Top = 24
      Width = 7
      Height = 13
      Caption = #1057
    end
    object Label2: TLabel
      Left = 10
      Top = 70
      Width = 13
      Height = 13
      Caption = #1055#1086
    end
    object dtpFrom: TDateTimePicker
      Left = 6
      Top = 43
      Width = 139
      Height = 21
      Date = 43001.939812592590000000
      Time = 43001.939812592590000000
      TabOrder = 0
    end
    object dtpTo: TDateTimePicker
      Left = 6
      Top = 89
      Width = 139
      Height = 21
      Date = 43001.939812592590000000
      Time = 43001.939812592590000000
      TabOrder = 1
    end
  end
  object Panel1: TPanel
    Left = 0
    Top = 121
    Width = 339
    Height = 39
    Align = alBottom
    BevelOuter = bvNone
    TabOrder = 1
    ExplicitWidth = 337
    object Button1: TButton
      Left = 120
      Top = 6
      Width = 105
      Height = 25
      Caption = #1057#1092#1086#1088#1084#1080#1088#1086#1074#1072#1090#1100
      TabOrder = 0
      OnClick = Button1Click
    end
  end
  object RadioGroup1: TRadioGroup
    Left = 0
    Top = 0
    Width = 184
    Height = 121
    Align = alClient
    Caption = #1042#1080#1076' '#1086#1090#1095#1077#1090#1072
    ItemIndex = 0
    Items.Strings = (
      #1050#1072#1089#1089#1072
      #1047#1072#1088#1087#1083#1072#1090#1072)
    TabOrder = 2
    ExplicitWidth = 180
  end
  object kassaReport: TfrxDBDataset
    UserName = 'kassaReport'
    CloseDataSource = False
    DataSet = qKassa
    BCDToCurrency = False
    Left = 48
    Top = 27
  end
  object frxKassaReport: TfrxReport
    Version = '4.12.13'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 41671.852381041700000000
    ReportOptions.LastChange = 43003.449532696760000000
    ScriptLanguage = 'PascalScript'
    ScriptText.Strings = (
      ''
      ''
      ''
      ''
      ''
      'begin'
      ''
      'end.')
    OnGetValue = frxKassaReportGetValue
    Left = 88
    Top = 24
    Datasets = <
      item
        DataSet = kassaReport
        DataSetName = 'kassaReport'
      end>
    Variables = <>
    Style = <
      item
        Name = 'Title'
        Color = clGray
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWhite
        Font.Height = -16
        Font.Name = 'Arial'
        Font.Style = [fsBold]
      end
      item
        Name = 'Header'
        Color = clNone
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clMaroon
        Font.Height = -13
        Font.Name = 'Arial'
        Font.Style = [fsBold]
      end
      item
        Name = 'Group header'
        Color = 16053492
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clMaroon
        Font.Height = -13
        Font.Name = 'Arial'
        Font.Style = [fsBold]
      end
      item
        Name = 'Data'
        Color = clNone
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Arial'
        Font.Style = []
      end
      item
        Name = 'Group footer'
        Color = clNone
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Arial'
        Font.Style = [fsBold]
      end
      item
        Name = 'Header line'
        Color = clNone
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Arial'
        Font.Style = []
        Frame.Typ = [ftBottom]
        Frame.Width = 2.000000000000000000
      end>
    object Data: TfrxDataPage
      Height = 1000.000000000000000000
      Width = 1000.000000000000000000
    end
    object Page1: TfrxReportPage
      PaperWidth = 210.000000000000000000
      PaperHeight = 297.000000000000000000
      PaperSize = 9
      LeftMargin = 10.000000000000000000
      RightMargin = 10.000000000000000000
      TopMargin = 10.000000000000000000
      BottomMargin = 10.000000000000000000
      object ReportTitle1: TfrxReportTitle
        Height = 56.692950000000000000
        Top = 18.897650000000000000
        Width = 718.110700000000000000
        object Memo1: TfrxMemoView
          Align = baWidth
          Width = 718.110700000000000000
          Height = 22.677180000000000000
          ShowHint = False
          AutoWidth = True
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -21
          Font.Name = 'Cuprum'
          Font.Style = [fsBold]
          GapX = 5.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1054#1090#1095#1077#1090' '#1087#1086' '#1082#1072#1089#1089#1077' '#1079#1072' '#1087#1077#1088#1080#1086#1076' '#1089' [dateFrom] '#1087#1086' [dateTo]')
          ParentFont = False
          VAlign = vaCenter
        end
      end
      object PageHeader1: TfrxPageHeader
        Height = 26.456710000000000000
        Top = 98.267780000000000000
        Width = 718.110700000000000000
        object Memo3: TfrxMemoView
          Left = 34.015770000000000000
          Top = 3.779530000000000000
          Width = 75.590551180000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 1.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1042#1099#1076#1072#1085)
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo4: TfrxMemoView
          Left = 480.377952760000000000
          Top = 3.779530000000000000
          Width = 79.370078740000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 1.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1052#1072#1090#1077#1088#1080#1072#1083#1099)
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo5: TfrxMemoView
          Left = 559.748031500000000000
          Top = 3.779530000000000000
          Width = 79.370078740000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 1.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1056#1072#1073#1086#1090#1072)
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo6: TfrxMemoView
          Left = 639.118110240000000000
          Top = 3.779530000000000000
          Width = 79.370078740000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 5.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1048#1090#1086#1075#1086)
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo8: TfrxMemoView
          Left = 109.606233310000000000
          Top = 3.779530000000000000
          Width = 291.023622047244100000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 1.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1059#1089#1090#1088#1086#1081#1089#1090#1074#1086)
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo10: TfrxMemoView
          Top = 3.779530000000000000
          Width = 34.015748030000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 1.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '#')
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo7: TfrxMemoView
          Left = 400.630180000000000000
          Top = 3.779530000000000000
          Width = 79.370078740000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 1.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            #1047#1072#1090#1088#1072#1090#1099)
          ParentFont = False
          VAlign = vaCenter
        end
      end
      object MasterData1: TfrxMasterData
        Height = 18.897650000000000000
        Top = 185.196970000000000000
        Width = 718.110700000000000000
        DataSet = kassaReport
        DataSetName = 'kassaReport'
        RowCount = 0
        object ReportColumn1: TfrxMemoView
          Left = 480.377952760000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataSet = kassaReport
          DataSetName = 'kassaReport'
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[kassaReport."sm_total" #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
        object ReportColumn2: TfrxMemoView
          Left = 559.748031500000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataSet = kassaReport
          DataSetName = 'kassaReport'
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[kassaReport."w_total" #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo2: TfrxMemoView
          Left = 109.606370000000000000
          Width = 291.023622050000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataSet = kassaReport
          DataSetName = 'kassaReport'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          Memo.UTF8W = (
            '[kassaReport."brand"] [kassaReport."model"]')
          ParentFont = False
          VAlign = vaCenter
        end
        object Reportpricework: TfrxMemoView
          Left = 639.020100000000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataSetName = 'Report'
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            
              '[(StrToFloat(<kassaReport."sm_total">)+StrToFloat(<kassaReport."' +
              'w_total">)-StrToFloat(<kassaReport."sm_buyTotal">)) #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
        object ReportdateEnd: TfrxMemoView
          Left = 34.015748030000000000
          Width = 75.590551180000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataSet = kassaReport
          DataSetName = 'kassaReport'
          DisplayFormat.FormatStr = 'mm.dd.yyyy'
          DisplayFormat.Kind = fkDateTime
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[FormatDateTime('#39'dd-mm-yyyy'#39',<kassaReport."date_end">)]')
          ParentFont = False
          VAlign = vaCenter
        end
        object Reportrecord_count: TfrxMemoView
          Width = 34.015748030000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataField = 'id'
          DataSet = kassaReport
          DataSetName = 'kassaReport'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[kassaReport."id"]')
          ParentFont = False
          VAlign = vaCenter
        end
        object Memo9: TfrxMemoView
          Left = 400.630180000000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DataSet = kassaReport
          DataSetName = 'kassaReport'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[kassaReport."sm_buyTotal" #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
      end
      object PageFooter1: TfrxPageFooter
        Height = 26.456710000000000000
        Top = 404.409710000000000000
        Width = 718.110700000000000000
        object Memo17: TfrxMemoView
          Align = baRight
          Top = 1.000000000000000000
          Width = 718.110700000000000000
          Height = 22.677180000000000000
          ShowHint = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftTop]
          Frame.Width = 1.500000000000000000
          GapX = 3.000000000000000000
          HAlign = haRight
          Memo.UTF8W = (
            #1057#1090#1088#1072#1085#1080#1094#1072' [Page#]')
          ParentFont = False
          VAlign = vaCenter
        end
      end
      object ReportSummary1: TfrxReportSummary
        Height = 117.165430000000000000
        Top = 264.567100000000000000
        Width = 718.110700000000000000
        object Memo14: TfrxMemoView
          Top = 7.559060000000000000
          Width = 400.629921259842500000
          Height = 18.897650000000000000
          ShowHint = False
          DataSetName = 'Report'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haRight
          Memo.UTF8W = (
            #1048#1090#1086#1075#1086' '#1087#1086' '#1082#1072#1089#1089#1077':')
          ParentFont = False
          VAlign = vaCenter
        end
        object SysMemo7: TfrxSysMemoView
          Left = 480.377952760000000000
          Top = 7.559060000000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[SUM(StrToFloat(<kassaReport."sm_total">),MasterData1) #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
        object SysMemo8: TfrxSysMemoView
          Left = 559.748031500000000000
          Top = 7.559060000000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            '[SUM(StrToFloat(<kassaReport."w_total">),MasterData1) #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
        object SysMemo9: TfrxSysMemoView
          Left = 639.118110240000000000
          Top = 7.559060000000000000
          Width = 79.370130000000000000
          Height = 18.897650000000000000
          ShowHint = False
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = [fsBold]
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            
              '[SUM(StrToFloat(<kassaReport."sm_total">)+StrToFloat(<kassaRepor' +
              't."w_total">)-StrToFloat(<kassaReport."sm_buyTotal">),MasterData' +
              '1) #n%2,2m]')
          ParentFont = False
          VAlign = vaCenter
        end
        object SysMemo1: TfrxSysMemoView
          Left = 400.630180000000000000
          Top = 7.559060000000000000
          Width = 79.370078740000000000
          Height = 18.897650000000000000
          ShowHint = False
          DisplayFormat.FormatStr = '%g'
          DisplayFormat.Kind = fkNumeric
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
          GapX = 3.000000000000000000
          HAlign = haCenter
          Memo.UTF8W = (
            
              '[SUM(StrToFloat(<kassaReport."sm_buyTotal">),MasterData1) #n%2,2' +
              'm]')
          ParentFont = False
          VAlign = vaCenter
        end
      end
    end
  end
  object qKassa: TADOQuery
    Connection = DM.Conn
    CursorType = ctStatic
    Parameters = <
      item
        Name = 'dfrom'
        DataType = ftString
        Size = 19
        Value = '2017-09-01 00:00:00'
      end
      item
        Name = 'dto'
        DataType = ftString
        Size = 19
        Value = '2017-09-01 23:59:59'
      end>
    SQL.Strings = (
      'SELECT'
      '  t1.*,'
      
        '  IF(SUM(sm.quantity*sm.buyPrice) IS NULL,0,SUM(sm.quantity*sm.b' +
        'uyPrice)) AS sm_buyTotal,'
      
        '  IF(SUM(sm.quantity*sm.price) IS NULL,0,SUM(sm.quantity*sm.pric' +
        'e)) AS sm_total'
      'FROM'
      '  ('
      '    SELECT'
      '      m.id,'
      '      m.date_end,'
      '      b.name AS brand,'
      '      m.model,'
      '      SUM(w.quantity*w.price) AS w_total'
      '    FROM main AS m'
      '    LEFT JOIN brand AS b ON b.id=m.brand_id'
      '    LEFT JOIN works AS w ON w.main_id=m.id'
      '    GROUP BY m.id'
      '  ) AS t1'
      'LEFT JOIN'
      '  ('
      '    SELECT'
      '      sm.quantity,'
      '      sm.buyPrice,'
      '      sm.price,'
      '      s.main_id AS main_id'
      '    FROM stockmove AS sm'
      '    LEFT JOIN stock AS s ON sm.stock_id=s.id'
      '    GROUP BY s.main_id'
      '  ) sm ON sm.main_id=t1.id'
      
        'WHERE date_end BETWEEN STR_TO_DATE(:dfrom, '#39'%Y-%m-%d %H:%i:%s'#39') ' +
        'AND STR_TO_DATE(:dto, '#39'%Y-%m-%d %H:%i:%s'#39')'
      'GROUP BY t1.id')
    Left = 128
    Top = 24
    object qKassaid: TIntegerField
      FieldName = 'id'
    end
    object qKassadate_end: TDateTimeField
      FieldName = 'date_end'
    end
    object qKassabrand: TWideStringField
      FieldName = 'brand'
      Size = 250
    end
    object qKassamodel: TWideStringField
      FieldName = 'model'
      Size = 150
    end
    object qKassaw_total: TFloatField
      FieldName = 'w_total'
    end
    object qKassasm_buyTotal: TFloatField
      FieldName = 'sm_buyTotal'
      ReadOnly = True
    end
    object qKassasm_total: TFloatField
      FieldName = 'sm_total'
      ReadOnly = True
    end
  end
end
