VERSION 5.00
Begin {78E93846-85FD-11D0-8487-00A0C90DC8A9} ReportStornozettel 
   Caption         =   "Bon"
   ClientHeight    =   8490
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   10860
   _ExtentX        =   19156
   _ExtentY        =   14975
   _Version        =   393216
   _DesignerVersion=   100684101
   ReportWidth     =   3825
   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           =   1
   GridY           =   1
   BottomMargin    =   200
   _Settings       =   23
   NumSections     =   3
   SectionCode0    =   1
   BeginProperty Section0 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Bereich4"
      Object.Height          =   1515
      NumControls     =   4
      ItemType0       =   3
      BeginProperty Item0 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblDruckerstation"
         Object.Width           =   3800
         Object.Height          =   330
         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         =   "BonDrucker"
         Alignment       =   2
      EndProperty
      ItemType1       =   3
      BeginProperty Item1 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblDatum"
         Object.Top             =   345
         Object.Width           =   3800
         Object.Height          =   225
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "Datum"
         Alignment       =   2
      EndProperty
      ItemType2       =   3
      BeginProperty Item2 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblStationUNDTisch"
         Object.Top             =   1155
         Object.Width           =   3800
         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         =   "StationUNDTisch"
         Alignment       =   2
      EndProperty
      ItemType3       =   3
      BeginProperty Item3 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "lblKellner"
         Object.Top             =   585
         Object.Width           =   3800
         Object.Height          =   225
         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         =   "Kellner"
         Alignment       =   2
      EndProperty
   EndProperty
   SectionCode1    =   4
   BeginProperty Section1 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Bereich1"
      Object.Height          =   840
      NumControls     =   5
      ItemType0       =   4
      BeginProperty Item0 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtGericht"
         Object.Left            =   1185
         Object.Width           =   1935
         Object.Height          =   225
         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
         CanGrow         =   -1  'True
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1031
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType1       =   4
      BeginProperty Item1 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtSummeMenge"
         Object.Top             =   15
         Object.Width           =   360
         Object.Height          =   225
         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
         Alignment       =   1
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1031
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType2       =   4
      BeginProperty Item2 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtSummeEPREIS"
         Object.Left            =   2910
         Object.Width           =   870
         Object.Height          =   225
         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
      ItemType3       =   5
      BeginProperty Item3 {1C13A8E3-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Linie1"
         Object.Left            =   30
         Object.Top             =   300
         Object.Width           =   3360
      EndProperty
      ItemType4       =   4
      BeginProperty Item4 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "txtPLU"
         Object.Left            =   585
         Object.Width           =   465
         Object.Height          =   225
         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
         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          =   525
      NumControls     =   1
      ItemType0       =   3
      BeginProperty Item0 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Bezeichnung1"
         Object.Left            =   30
         Object.Top             =   225
         Object.Width           =   3795
         Object.Height          =   210
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   16777215
         Object.Caption         =   "*"
         Alignment       =   2
      EndProperty
   EndProperty
End
Attribute VB_Name = "ReportStornozettel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Sub Stornozettel(VarDrucker, VarBon)
Dim objConn As ADODB.Connection
Dim rsStorno As ADODB.Recordset
Dim strPath As String

Set objConn = New ADODB.Connection
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 rsStorno
     .ActiveConnection = objConn
     .CursorLocation = adUseClient
     .LockType = adLockOptimistic
     '.Open "Select Gericht,EPREIS As Einzelpreis,Sum(Menge) AS SummeMenge,Sum(Menge)*EPREIS As SummeBrutto from TischNeuesGericht Where Station = '" & VarStation & "' and Kellner='" & VarKellner & "' and Tisch='" & VarTisch & "' and Drucker='" & VarDrucker & "' Group by Gericht,EPREIS "
      .Open "Select *from StornosTemporaer Where Station = '" & VarStation & "' and Tisch='" & VarTisch & "' and Bondrucker='" & VarDrucker & "' ORDER BY IDWG,RegID,ID"
   End With

 If rsStorno.EOF = True Then GoTo 10
While Not rsStorno.EOF
  If rsStorno.Fields("Gericht").Value = "Speise" Or rsStorno.Fields("Gericht").Value = "Getränke" Then
  'rsStorno.Fields("Gericht").Value = Format(rsStorno.Fields("EPREIS").Value, "#####0.00")
  End If
 rsStorno.MoveNext
Wend

Set ReportStornozettel.DataSource = rsStorno
 
 
   ReportStornozettel.Sections("Bereich4").Controls("lblDruckerstation").Caption = VarBon
   ReportStornozettel.Sections("Bereich4").Controls("lblDatum").Caption = Now
   ReportStornozettel.Sections("Bereich4").Controls("lblStationUNDTisch").Caption = VarStation & "  -  " & "Tisch: " & VarTisch
   ReportStornozettel.Sections("Bereich4").Controls("lblKellner").Caption = "Kellner: " & VarKellner
   
   ReportStornozettel.Sections("Bereich1").Controls("txtSummeMenge").DataField = rsStorno.Fields("Menge_Text").Name
   ReportStornozettel.Sections("Bereich1").Controls("txtPLU").DataField = rsStorno.Fields("PLU").Name
   ReportStornozettel.Sections("Bereich1").Controls("txtGericht").DataField = rsStorno.Fields("Gericht").Name
   ReportStornozettel.Sections("Bereich1").Controls("txtSummeEPREIS").DataField = rsStorno.Fields("GPREIS").Name

 'Me.Show
 Me.PrintReport

10 Set objConn = Nothing
   Set rsStorno = Nothing


exit_Sub:
  On Error GoTo 0

Set rsStorno = Nothing
Set objConn = Nothing
  
  Exit Sub

err_Handler:
    MsgBox "Fehlernummer " & Err.Number & Chr$(13) & Error$(Err), _
            vbCritical, "Fehler"
    
  Resume exit_Sub

Set rsStorno = Nothing
Set objConn = Nothing

End Sub

