VERSION 5.00
Begin {78E93846-85FD-11D0-8487-00A0C90DC8A9} ReportKellnerBericht 
   BorderStyle     =   1  'Fest Einfach
   Caption         =   "Bericht"
   ClientHeight    =   6720
   ClientLeft      =   90
   ClientTop       =   285
   ClientWidth     =   4725
   MaxButton       =   0   'False
   MinButton       =   0   'False
   _ExtentX        =   8334
   _ExtentY        =   11853
   _Version        =   393216
   _DesignerVersion=   100684101
   ReportWidth     =   3815
   BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   GridX           =   5
   GridY           =   5
   LeftMargin      =   200
   RightMargin     =   50
   BottomMargin    =   200
   _Settings       =   31
   NumSections     =   3
   SectionCode0    =   1
   BeginProperty Section0 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Bereich4"
      Object.Height          =   2520
      NumControls     =   4
      ItemType0       =   7
      BeginProperty Item0 {1C13A8E5-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Symbol1"
         Object.Width           =   3795
         Object.Height          =   1065
         SizeMode        =   2
      EndProperty
      ItemType1       =   3
      BeginProperty Item1 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblTagesumsatz"
         Object.Top             =   1474
         Object.Width           =   3795
         Object.Height          =   390
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Kellnerbericht"
         Alignment       =   2
      EndProperty
      ItemType2       =   3
      BeginProperty Item2 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblDatum"
         Object.Top             =   2041
         Object.Width           =   3795
         Object.Height          =   225
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Datum"
         Alignment       =   2
      EndProperty
      ItemType3       =   3
      BeginProperty Item3 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblAdresse"
         Object.Top             =   1134
         Object.Width           =   3795
         Object.Height          =   225
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Adresse"
         CanGrow         =   -1  'True
         Alignment       =   2
      EndProperty
   EndProperty
   SectionCode1    =   4
   BeginProperty Section1 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Bereich1"
      Object.Height          =   1470
      NumControls     =   8
      ItemType0       =   4
      BeginProperty Item0 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtOffen"
         Object.Left            =   2670
         Object.Top             =   375
         Object.Width           =   1125
         Object.Height          =   240
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Alignment       =   1
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   1
            Format          =   "#####0.00"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1031
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType1       =   3
      BeginProperty Item1 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblOffen"
         Object.Left            =   165
         Object.Top             =   375
         Object.Width           =   2070
         Object.Height          =   240
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Offene Rechnungen"
      EndProperty
      ItemType2       =   3
      BeginProperty Item2 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblKassiert"
         Object.Left            =   160
         Object.Top             =   615
         Object.Width           =   1545
         Object.Height          =   240
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Kassiert"
      EndProperty
      ItemType3       =   4
      BeginProperty Item3 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtKassiert"
         Object.Left            =   2700
         Object.Top             =   615
         Object.Width           =   1110
         Object.Height          =   240
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Alignment       =   1
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   1
            Format          =   "#####0.00"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1031
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType4       =   4
      BeginProperty Item4 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtKellner"
         Object.Left            =   1155
         Object.Top             =   75
         Object.Width           =   2055
         Object.Height          =   300
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1031
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType5       =   3
      BeginProperty Item5 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblKellner"
         Object.Top             =   75
         Object.Width           =   930
         Object.Height          =   300
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Bezeichnung1"
      EndProperty
      ItemType6       =   3
      BeginProperty Item6 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblStorno"
         Object.Left            =   160
         Object.Top             =   1035
         Object.Width           =   795
         Object.Height          =   240
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Stornos"
      EndProperty
      ItemType7       =   4
      BeginProperty Item7 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtStorno"
         Object.Left            =   1140
         Object.Top             =   1005
         Object.Width           =   1110
         Object.Height          =   240
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Alignment       =   1
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1031
            SubFormatType   =   0
         EndProperty
      EndProperty
   EndProperty
   SectionCode2    =   8
   BeginProperty Section2 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Bereich5"
      Object.Height          =   825
      NumControls     =   3
      ItemType0       =   3
      BeginProperty Item0 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblTotal"
         Object.Top             =   240
         Object.Width           =   930
         Object.Height          =   330
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "TOTAL"
      EndProperty
      ItemType1       =   3
      BeginProperty Item1 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblSummeBrutto"
         Object.Left            =   2175
         Object.Top             =   240
         Object.Width           =   1635
         Object.Height          =   330
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Bezeichnung1"
         Alignment       =   1
      EndProperty
      ItemType2       =   5
      BeginProperty Item2 {1C13A8E3-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Linie1"
         Object.Top             =   150
         Object.Width           =   3795
      EndProperty
   EndProperty
End
Attribute VB_Name = "ReportKellnerBericht"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub DataReport_Initialize()
Call frmBerichte.BerichtePositionieren(ReportKellnerBericht)
End Sub
Sub BerichtAlleKellner(VarDatum1, VarDatum2)
Dim objConn As ADODB.Connection
Dim rsOffeneTische As ADODB.Recordset
Dim rsRechnungsuebersicht As ADODB.Recordset
Dim rsBerichte As ADODB.Recordset
Dim rsKellner As ADODB.Recordset
Dim rsAktuel As ADODB.Recordset
Dim rsStorno As ADODB.Recordset


Dim strPath As String

Set objConn = New ADODB.Connection
Set rsOffeneTische = New ADODB.Recordset
Set rsRechnungsuebersicht = New ADODB.Recordset
Set rsBerichte = New ADODB.Recordset
Set rsKellner = New ADODB.Recordset
Set rsAktuel = New ADODB.Recordset
Set rsStorno = New ADODB.Recordset
 
  
  
  On Error GoTo err_Handler

  strPath = App.Path
  If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"


  With objConn
    .Provider = "Microsoft Jet 4.0 OLE DB Provider"
    .Properties("Jet OLEDB:Database Password") = VarPasswordDatenbank
    .ConnectionString = "Data Source=" & VarDatenbank
    .CursorLocation = adUseClient
    .Open
  End With
  
   'Tabelle OffeneTische öffnen
   With rsOffeneTische
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select Kellner,Sum(GPREIS) AS SummeBruttoOffen from OffeneTische Where Datum >= #" & Format$(VarDatum1, "mm-dd-yyyy") & "# and  Datum <= #" & Format$(VarDatum2, "mm-dd-yyyy") & "# GROUP BY Kellner"
   End With


  With rsRechnungsuebersicht
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select Mitarbeiter,Sum(BAR) As SummeBAR, Sum(KARTE) As SummeKARTE, Sum(GUTSCHEIN) As SummeGUTSCHEIN from Rechnungsuebersicht Where Datum >= #" & Format$(VarDatum1, "mm-dd-yyyy") & "# and  Datum <= #" & Format$(VarDatum2, "mm-dd-yyyy") & "# GROUP BY Mitarbeiter"
  End With

  With rsStorno
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select Kellner,Sum(GPREIS) As SummeStorno from Stornos Where Datum >= #" & Format$(VarDatum1, "mm-dd-yyyy") & "# and  Datum <= #" & Format$(VarDatum2, "mm-dd-yyyy") & "# GROUP BY Kellner"
  End With
  
  With rsBerichte
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select *from AktuellesBericht"
   End With
 
   With rsKellner
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select *from Kellner"
   End With
 
 

 For I = 1 To rsBerichte.RecordCount
    rsBerichte.Delete
    rsBerichte.MoveNext
 Next I
 
 
 
 While Not rsKellner.EOF
    rsBerichte.AddNew
    rsBerichte.Fields("Kellner").Value = rsKellner.Fields("Mitarbeiter").Value
    rsKellner.MoveNext
 Wend
 rsBerichte.Update
 rsBerichte.Requery
 
 While Not rsOffeneTische.EOF
    For I = 1 To rsBerichte.RecordCount
     rsBerichte.AbsolutePosition = I
     If rsBerichte.Fields("Kellner").Value = rsOffeneTische.Fields("Kellner").Value Then
        rsBerichte.Fields("Offen").Value = Format(rsOffeneTische.Fields("SummeBruttoOffen").Value, "####0.#0")
     End If
    rsBerichte.MoveNext
    Next I
    rsOffeneTische.MoveNext
 Wend

 While Not rsRechnungsuebersicht.EOF = True
      
    For I = 1 To rsBerichte.RecordCount
     rsBerichte.AbsolutePosition = I
     If rsRechnungsuebersicht("Mitarbeiter").Value = rsBerichte.Fields("Kellner").Value Then
        rsBerichte.Fields("Kassiert").Value = Format(rsRechnungsuebersicht.Fields("SummeBAR").Value _
                                            + rsRechnungsuebersicht.Fields("SummeKARTE").Value _
                                            + rsRechnungsuebersicht.Fields("SummeGUTSCHEIN").Value, "####0.#0")
     End If
     rsBerichte.MoveNext
     Next I
     rsRechnungsuebersicht.MoveNext
 Wend

 While Not rsStorno.EOF
             
    For I = 1 To rsBerichte.RecordCount
     rsBerichte.AbsolutePosition = I
     
     If rsStorno("Kellner").Value = rsBerichte.Fields("Kellner").Value Then
        rsBerichte.Fields("Stornos").Value = Format(-rsStorno.Fields("SummeStorno").Value, "####0.#0")
     End If
     rsBerichte.MoveNext
     Next I
     rsStorno.MoveNext
 Wend
  
  
  
  With rsAktuel
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select sum(Offen) as Summe1, sum(Kassiert) as Summe2 from AktuellesBericht"
  End With

   
  If IsNull(rsAktuel.Fields("Summe1").Value) And IsNull(rsAktuel.Fields("Summe2").Value) Then
   k1 = 0
   k2 = 0
  ElseIf IsNull(rsAktuel.Fields("Summe1").Value) And Not IsNull(rsAktuel.Fields("Summe2").Value) Then
   k1 = 0
   k2 = CDbl(rsAktuel.Fields("Summe2").Value)
  ElseIf IsNull(rsAktuel.Fields("Summe2").Value) And Not IsNull(rsAktuel.Fields("Summe1").Value) Then
   k1 = CDbl(rsAktuel.Fields("Summe1").Value)
   k2 = 0
  Else
   k1 = CDbl(rsAktuel.Fields("Summe1").Value)
   k2 = CDbl(rsAktuel.Fields("Summe2").Value)
 End If
 
 VarBrutto = k1 + k2
 
 VarNetto = Format(VarBrutto / 1.19, "#####0.#0")
 VarMwSt = Format((VarBrutto - VarNetto), "#####0.#0")
 

 Set ReportKellnerBericht.DataSource = rsBerichte
Set Me.Sections("Bereich4").Controls("Symbol1").Picture = LoadPicture(App.Path & "\Logos\Logo_Lokal.emf")

   Me.Sections("Bereich4").Controls("lblAdresse").Caption = "Gutenbergstr. 20 - 67346 Speyer - Tel:74611"
   ReportKellnerBericht.Sections("Bereich4").Controls("lblTagesumsatz").Caption = "Kellnerbericht"

   If VarDatum1 = VarDatum2 Then
   ReportKellnerBericht.Sections("Bereich4").Controls("lblDatum").Caption = VarDatum1
   Else
   ReportKellnerBericht.Sections("Bereich4").Controls("lblDatum").Caption = "von " & VarDatum1 & " bis " & VarDatum2
   End If
   

 
 ReportKellnerBericht.Sections("Bereich1").Controls("lblKellner").Caption = "Kellner :"
 ReportKellnerBericht.Sections("Bereich1").Controls("txtKellner").DataField = rsBerichte.Fields("Kellner").Name
 
 ReportKellnerBericht.Sections("Bereich1").Controls("txtOffen").DataField = rsBerichte.Fields("Offen").Name
 ReportKellnerBericht.Sections("Bereich1").Controls("txtKassiert").DataField = rsBerichte.Fields("Kassiert").Name
 ReportKellnerBericht.Sections("Bereich1").Controls("txtStorno").DataField = rsBerichte.Fields("Stornos").Name

 ReportKellnerBericht.Sections("Bereich5").Controls("lblSummeBrutto").Caption = Format(VarBrutto, "Currency")


  ReportKellnerBericht.Show 1
  
  'Call SetDefaultPrinter("Star TSP100 Cutter (TSP143)")
  'Me.PrintReport



Set objConn = Nothing
Set rsOffeneTische = Nothing
Set rsRechnungsuebersicht = Nothing
Set rsBerichte = Nothing
Set rsKellner = Nothing
Set rsAktuel = Nothing
Set rsStorno = Nothing

exit_Sub:
  On Error GoTo 0

Set objConn = Nothing
Set rsOffeneTische = Nothing
Set rsRechnungsuebersicht = Nothing
Set rsBerichte = Nothing
Set rsKellner = Nothing
Set rsAktuel = Nothing
Set rsStorno = Nothing
 
  Exit Sub

err_Handler:
    MsgBox "Fehlernummer " & Err.Number & Chr$(13) & Error$(Err), _
            vbCritical, "Fehler"
    
  Resume exit_Sub

Set objConn = Nothing
Set rsOffeneTische = Nothing
Set rsRechnungsuebersicht = Nothing
Set rsBerichte = Nothing
Set rsKellner = Nothing
Set rsAktuel = Nothing
Set rsStorno = Nothing

End Sub
Sub BerichtEinKellner(VarEinKellner, VarDatum1, VarDatum2)
Dim objConn As ADODB.Connection
Dim rsOffeneTische As ADODB.Recordset
Dim rsRechnungsuebersicht As ADODB.Recordset
Dim rsBerichte As ADODB.Recordset
Dim rsKellner As ADODB.Recordset
Dim rsAktuel As ADODB.Recordset
Dim rsStorno As ADODB.Recordset

Dim strPath As String

Set objConn = New ADODB.Connection
Set rsOffeneTische = New ADODB.Recordset
Set rsRechnungsuebersicht = New ADODB.Recordset
Set rsBerichte = New ADODB.Recordset
Set rsKellner = New ADODB.Recordset
Set rsAktuel = New ADODB.Recordset
Set rsStorno = New ADODB.Recordset
 
  
  
  On Error GoTo err_Handler

  strPath = App.Path
  If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"


  With objConn
    .Provider = "Microsoft Jet 4.0 OLE DB Provider"
    .Properties("Jet OLEDB:Database Password") = VarPasswordDatenbank
    .ConnectionString = "Data Source=" & VarDatenbank
    .CursorLocation = adUseClient
    .Open
  End With
  
   'Tabelle OffeneTische öffnen
   With rsOffeneTische
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select Kellner,Sum(GPREIS) AS SummeBruttoOffen from OffeneTische Where Datum >= #" & Format$(VarDatum1, "mm-dd-yyyy") & "# and  Datum <= #" & Format$(VarDatum2, "mm-dd-yyyy") & "# and Kellner = '" & VarEinKellner & "' GROUP BY Kellner"
   End With

  With rsRechnungsuebersicht
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select Mitarbeiter,Sum(BAR) As SummeBAR, Sum(KARTE) As SummeKARTE, Sum(GUTSCHEIN) As SummeGUTSCHEIN from Rechnungsuebersicht Where Datum >= #" & Format$(VarDatum1, "mm-dd-yyyy") & "# and  Datum <= #" & Format$(VarDatum2, "mm-dd-yyyy") & "# GROUP BY Mitarbeiter"
   End With

  With rsStorno
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select Kellner,Sum(GPREIS) As SummeStorno from Stornos Where Datum >= #" & Format$(VarDatum1, "mm-dd-yyyy") & "# and  Datum <= #" & Format$(VarDatum2, "mm-dd-yyyy") & "# and Kellner = '" & VarEinKellner & "' GROUP BY Kellner"
   End With
  
  
   
  
  
  With rsBerichte
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select *from AktuellesBericht"
   End With
 
   With rsKellner
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select *from Kellner"
   End With
 
 

 For I = 1 To rsBerichte.RecordCount
 rsBerichte.Delete
 rsBerichte.MoveNext
 Next I
 
 
 
rsBerichte.AddNew
rsBerichte.Fields("Kellner").Value = VarEinKellner
 rsBerichte.Update
 rsBerichte.Requery
 

 While Not rsOffeneTische.EOF
    For I = 1 To rsBerichte.RecordCount
     rsBerichte.AbsolutePosition = I
     If rsBerichte.Fields("Kellner").Value = rsOffeneTische.Fields("Kellner").Value Then
        rsBerichte.Fields("Offen").Value = Format(rsOffeneTische.Fields("SummeBruttoOffen").Value, "####0.#0")
     End If
    rsBerichte.MoveNext
    Next I
    rsOffeneTische.MoveNext
 Wend

 While Not rsRechnungsuebersicht.EOF
             
    For I = 1 To rsBerichte.RecordCount
     rsBerichte.AbsolutePosition = I
     If rsRechnungsuebersicht("Mitarbeiter").Value = rsBerichte.Fields("Kellner").Value Then
        rsBerichte.Fields("Kassiert").Value = Format(rsRechnungsuebersicht.Fields("SummeBAR").Value _
                                            + rsRechnungsuebersicht.Fields("SummeKARTE").Value _
                                            + rsRechnungsuebersicht.Fields("SummeGUTSCHEIN").Value, "####0.#0")
     End If
     rsBerichte.MoveNext
     Next I
     rsRechnungsuebersicht.MoveNext
 Wend


 While Not rsStorno.EOF
             
    For I = 1 To rsBerichte.RecordCount
     rsBerichte.AbsolutePosition = I
     
     If rsStorno("Kellner").Value = rsBerichte.Fields("Kellner").Value Then
        rsBerichte.Fields("Stornos").Value = Format(-rsStorno.Fields("SummeStorno").Value, "####0.#0")
     End If
     rsBerichte.MoveNext
     Next I
     rsStorno.MoveNext
 Wend
  
 
  
  
  
  With rsAktuel
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     .Open "Select sum(Offen) as Summe1, sum(Kassiert) as Summe2 from AktuellesBericht"
  End With
 
  If IsNull(rsAktuel.Fields("Summe1").Value) And IsNull(rsAktuel.Fields("Summe2").Value) Then
   k1 = 0
   k2 = 0
  ElseIf IsNull(rsAktuel.Fields("Summe1").Value) And Not IsNull(rsAktuel.Fields("Summe2").Value) Then
   k1 = 0
   k2 = CDbl(rsAktuel.Fields("Summe2").Value)
  ElseIf IsNull(rsAktuel.Fields("Summe2").Value) And Not IsNull(rsAktuel.Fields("Summe1").Value) Then
   k1 = CDbl(rsAktuel.Fields("Summe1").Value)
   k2 = 0
  Else
   k1 = CDbl(rsAktuel.Fields("Summe1").Value)
   k2 = CDbl(rsAktuel.Fields("Summe2").Value)
 End If
 
 VarBrutto = k1 + k2
 
 VarNetto = Format(VarBrutto / 1.19, "#####0.#0")
 VarMwSt = Format((VarBrutto - VarNetto), "#####0.#0")
 

 Set ReportKellnerBericht.DataSource = rsBerichte
 Set Me.Sections("Bereich4").Controls("Symbol1").Picture = LoadPicture(App.Path & "\Logos\Logo_Lokal.emf")

   ReportKellnerBericht.Sections("Bereich4").Controls("lblAdresse").Caption = "Gutenbergstr. 20 - 67346 Speyer - Tel:74611"
   ReportKellnerBericht.Sections("Bereich4").Controls("lblTagesumsatz").Caption = "Kellnerbericht"

   If VarDatum1 = VarDatum2 Then
   ReportKellnerBericht.Sections("Bereich4").Controls("lblDatum").Caption = VarDatum1
   Else
   ReportKellnerBericht.Sections("Bereich4").Controls("lblDatum").Caption = "von " & VarDatum1 & " bis " & VarDatum2
   End If
   

 
 ReportKellnerBericht.Sections("Bereich1").Controls("lblKellner").Caption = "Kellner :"
 ReportKellnerBericht.Sections("Bereich1").Controls("txtKellner").DataField = rsBerichte.Fields("Kellner").Name
 
 ReportKellnerBericht.Sections("Bereich1").Controls("txtOffen").DataField = rsBerichte.Fields("Offen").Name
 ReportKellnerBericht.Sections("Bereich1").Controls("txtKassiert").DataField = rsBerichte.Fields("Kassiert").Name
 ReportKellnerBericht.Sections("Bereich1").Controls("txtStorno").DataField = rsBerichte.Fields("Stornos").Name

 ReportKellnerBericht.Sections("Bereich5").Controls("lblSummeBrutto").Caption = Format(VarBrutto, "Currency")


  'If frmBerichte.Visible = True Then
   ReportKellnerBericht.Show 1
  'Else
   'ReportKellnerBericht.PrintReport
  'End If


Set objConn = Nothing
Set rsOffeneTische = Nothing
Set rsRechnungsuebersicht = Nothing
Set rsBerichte = Nothing
Set rsKellner = Nothing
Set rsAktuel = Nothing
Set rsStorno = Nothing
exit_Sub:
  
  On Error GoTo 0

Set objConn = Nothing
Set rsOffeneTische = Nothing
Set rsRechnungsuebersicht = Nothing
Set rsBerichte = Nothing
Set rsKellner = Nothing
Set rsAktuel = Nothing
Set rsStorno = Nothing
  
  Exit Sub

err_Handler:
    MsgBox "Fehlernummer " & Err.Number & Chr$(13) & Error$(Err), _
            vbCritical, "Fehler"
    
  Resume exit_Sub

Set objConn = Nothing
Set rsOffeneTische = Nothing
Set rsRechnungsuebersicht = Nothing
Set rsBerichte = Nothing
Set rsKellner = Nothing
Set rsAktuel = Nothing
Set rsStorno = Nothing
End Sub

