VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
Begin VB.Form frmStationen 
   AutoRedraw      =   -1  'True
   BorderStyle     =   0  'Kein
   Caption         =   "Form1"
   ClientHeight    =   4305
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   7005
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   OLEDropMode     =   1  'Manuell
   ScaleHeight     =   4305
   ScaleWidth      =   7005
   ShowInTaskbar   =   0   'False
   Begin TabDlg.SSTab SSTabStationen 
      Height          =   3612
      Left            =   624
      TabIndex        =   0
      Top             =   120
      Width           =   6132
      _ExtentX        =   10795
      _ExtentY        =   6376
      _Version        =   393216
      Style           =   1
      Tabs            =   2
      TabsPerRow      =   2
      TabHeight       =   706
      TabCaption(0)   =   "Stationen"
      TabPicture(0)   =   "frmStationen.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "ListViewStationen"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).ControlCount=   1
      TabCaption(1)   =   "Stationsdetails"
      TabPicture(1)   =   "frmStationen.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "picLokal"
      Tab(1).ControlCount=   1
      Begin MSComctlLib.ListView ListViewStationen 
         Height          =   1095
         Left            =   2580
         TabIndex        =   1
         Top             =   780
         Width           =   1515
         _ExtentX        =   2672
         _ExtentY        =   1931
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         NumItems        =   0
      End
      Begin VB.PictureBox picLokal 
         Appearance      =   0  '2D
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   1635
         Left            =   -72810
         ScaleHeight     =   1605
         ScaleWidth      =   3195
         TabIndex        =   2
         Top             =   660
         Width           =   3225
         Begin VB.PictureBox picTisch 
            Appearance      =   0  '2D
            BackColor       =   &H00FF00FF&
            ForeColor       =   &H80000008&
            Height          =   435
            Index           =   0
            Left            =   0
            ScaleHeight     =   405
            ScaleWidth      =   825
            TabIndex        =   4
            Top             =   0
            Visible         =   0   'False
            Width           =   855
         End
         Begin VB.Image imgLokal 
            Appearance      =   0  '2D
            Height          =   1185
            Left            =   0
            Stretch         =   -1  'True
            Top             =   0
            Width           =   2100
         End
         Begin VB.Label lblmarkierung 
            BackColor       =   &H80000002&
            Height          =   165
            Left            =   360
            TabIndex        =   3
            Top             =   1170
            Width           =   165
         End
      End
   End
End
Attribute VB_Name = "frmStationen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim VarSeite, VarX, VarY

Private Sub Form_Load()
'frmStationen.SSTabStationen.Tab = 0
Call mdlVerwalltung.StationenPos
Call ListeFuelen
End Sub
'------------------- Ereignisse von imglokalTisch Steuerelement  ------------
'-------------------------------------------------------------------
Private Sub imgLokal_DragDrop(Source As Control, X As Single, Y As Single)
Source.Left = X - VarX
Source.Top = Y - VarY
End Sub

'------------------- Ereignisse von PicTisch Steuerelement  ------------
'-------------------------------------------------------------------
Private Sub picTisch_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
VarX = X
VarY = Y

If MousePointer <> 0 Then Exit Sub
picTisch(Index).Drag 1
End Sub

Private Sub picTisch_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Refresh


If Button = 1 And MousePointer <> 0 Then
    Select Case VarSeite
    Case 3
        If X > 200 And X < 5000 Then
            If Y > 0 And Y < picTisch(Index).Height Then
                picTisch(Index).Width = X
            Else
                MousePointer = 0
            End If
        End If
    Case 4
        If Y > 200 And Y < 5000 Then
            If X > 0 And X < picTisch(Index).Width Then
                picTisch(Index).Height = Y
            Else
                MousePointer = 0
            End If
        End If
    End Select
 Else
    If X > picTisch(Index).Width - 100 And X < picTisch(Index).Width - 80 Then
   
        MousePointer = 9
        VarSeite = 3
    ElseIf Y > picTisch(Index).Height - 100 And Y < picTisch(Index).Height - 80 Then
        MousePointer = 7
        VarSeite = 4
    Else
        MousePointer = 0
    End If
End If

frmStationen.picTisch(Index).Cls
frmStationen.picTisch(Index).CurrentX = (frmStationen.picTisch(Index).Width - frmStationen.picTisch(Index).TextWidth(frmStationen.picTisch(Index).Tag)) / 2
frmStationen.picTisch(Index).CurrentY = (frmStationen.picTisch(Index).Height - frmStationen.picTisch(Index).TextHeight(frmStationen.picTisch(Index).Tag)) / 2
frmStationen.picTisch(Index).Print frmStationen.picTisch(Index).Tag
End Sub

Private Sub picTisch_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
MousePointer = 0
Call frmStationen.TabellePicTischSpeichern(picTisch(Index).Tag, Index)
End Sub
Private Sub picTisch_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Source.Left = picTisch(Index).Left + X - VarX
Source.Top = picTisch(Index).Top + Y - VarY
picTisch(Index).ZOrder 1
Call frmStationen.TabellePicTischSpeichern(picTisch(Index).Tag, Index)
End Sub


'---------Öffnen von TabellePicTisch und Speichern von Positionen---------
Sub TabellePicTischSpeichern(VarPicTischTag, VarIndex)
Dim objConn As ADODB.Connection
Dim rsTabellePicTisch As ADODB.Recordset
Set objConn = New ADODB.Connection
Set rsTabellePicTisch = New ADODB.Recordset


  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=" & strPath & "asql.mdb"
    .CursorLocation = adUseClient
    .Open
  End With
With rsTabellePicTisch
    .ActiveConnection = objConn
    .CursorLocation = adUseClient
    .LockType = adLockOptimistic
    .Open "Select *FROM TabellePicTisch Where Name = '" & VarPicTischTag & "' and Station = '" & VarStation & "'"
    '.Find ("Name='" & VarPicTischTag & "'")
End With

rsTabellePicTisch.Fields("Oben").Value = frmStationen.picTisch(VarIndex).Top
rsTabellePicTisch.Fields("Links").Value = frmStationen.picTisch(VarIndex).Left
rsTabellePicTisch.Fields("Hoehe").Value = frmStationen.picTisch(VarIndex).Height
rsTabellePicTisch.Fields("Breite").Value = frmStationen.picTisch(VarIndex).Width
rsTabellePicTisch.Update
frmStationen.picTisch(VarIndex).Cls
frmStationen.picTisch(VarIndex).CurrentX = (frmStationen.picTisch(VarIndex).Width - frmStationen.picTisch(VarIndex).TextWidth(frmStationen.picTisch(VarIndex).Tag)) / 2
frmStationen.picTisch(VarIndex).CurrentY = (frmStationen.picTisch(VarIndex).Height - frmStationen.picTisch(VarIndex).TextHeight(frmStationen.picTisch(VarIndex).Tag)) / 2
frmStationen.picTisch(VarIndex).Print frmStationen.picTisch(VarIndex).Tag

Set objConn = Nothing
Set rsTabellePicTisch = Nothing
End Sub

'------------------- ListviewStationen wird ausgefühlt ------------
'-------------------------------------------------------------------

Sub ListeFuelen()
Dim objConn As ADODB.Connection
Dim rsStationen As ADODB.Recordset
Set objConn = New ADODB.Connection
Set rsStationen = New ADODB.Recordset
Dim strPath As String



  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=" & strPath & "asql.mdb"
    .CursorLocation = adUseClient
    .Open
  End With


  With rsStationen
    .ActiveConnection = objConn
    .CursorLocation = adUseClient
    .LockType = adLockOptimistic
    .Open "Select *FROM Stationen"
    End With
   
    ' Hinzufügen der Spaltenköpfe. Die Breite der
   ' Spalten entspricht der Breite des Steuerelements
   ' dividiert durch die Anzahl der Spalten.
   ListViewStationen.ColumnHeaders.Add , , "Station", ListViewStationen.Width / 3
   ListViewStationen.ColumnHeaders.Add , , "offene Bestellungen", ListViewStationen.Width / 3, lvwColumnCenter
   ListViewStationen.ColumnHeaders.Add , , " abger. Tagesumsatz", ListViewStationen.Width / 3
   ' View-Eigenschaft auf ReportKellnerBericht setzen.
   ListViewStationen.View = lvwReport
   ListViewStationen.GridLines = True
   ListViewStationen.FullRowSelect = True
   
   ' Erstellen einer Variablen zum Hinzufügen
   ' von ListItem-Objekten.
   Dim itmX As ListItem

   ' Solange der aktuelle Datensatz nicht dem letzten
   ' Datensatz entspricht, werden weiter
   ' ListItem-Objekte hinzugefügt.
   ' Für Text des ListItem-Objekts wird das Feld
   ' "Author" verwendet.
   ' Für Unterelement 1 des ListItem-Objekts wird das
   ' Feld "AuthorID" verwendet.
   ' Für Unterelement 2 des ListItem-Objekts wird das
   ' Feld "Year Born" verwendet.
 
 'Datensätze hinzufügen...
   While Not rsStationen.EOF
      'Ein neues ListItem erstellen ("ID")
      Set itmX = frmStationen.ListViewStationen.ListItems.Add(, , rsStationen.Fields("Station").Value)   'Station
      itmX.Tag = itmX.Index
      'Unterelemente hinzufügen.
    ' (Es muss für JEDES Feld eine Überprüfung stattfinden (IsNull),
    '  ob gültige Daten vorhanden sind.)
    
    'Wenn alle Felder eines Datensatzes eingelesen werden
    ' sollen, dann ist es sinnvoll dies mit Hilfe einer
    ' Schleife zu erledigen...
      If Not IsNull(rsStationen.Fields("abger_Tagesumsatz").Value) Then
         itmX.SubItems(1) = rsStationen.Fields("abger_Tagesumsatz").Value
      End If

      ' Wenn das Feld "Year Born" ungleich Null ist,
      ' Unterelement 2 auf dieses Feld setzen.
      'If Not IsNull(DataEnvironment1.rsCommand4!offene_Bestellungen) Then
       '  itmX.SubItems(2) = DataEnvironment1.rsCommand4!offene_Bestellungen
      'End If
      rsStationen.MoveNext   ' Nächster Datensatz.
   Wend
 End Sub



'------------------- Ereignisse von SSTabStationen Steuerelement  ------------
'-------------------------------------------------------------------

Private Sub SSTabStationen_Click(PreviousTab As Integer)

'Bei öffnen des Registers wird die aktuelle Station abgelesen
'Weiter wird die Station geöffnet
VarStation = frmStationen.ListViewStationen.SelectedItem.Text
    Select Case frmStationen.ListViewStationen.SelectedItem.Index
        Case 1
        Set frmStationen.imgLokal.Picture = LoadPicture(App.Path & "\image\Gastraum.emf")
        Case 2
        Set frmStationen.imgLokal.Picture = LoadPicture(App.Path & "\image\Biergarten.emf")
        Case 3
        Set frmStationen.imgLokal.Picture = LoadPicture("")
    End Select
If frmStationen.SSTabStationen.Tab = 1 Then
 Call mdlDatenbanken.TabellePicTischAbfragen(frmStationen, VarStation)
 'Wenn Station existiert lblmarkierung positionieren
   If frmStationen.picTisch.UBound > 0 Then
     VarIndex = 1
     lblmarkierung.Left = frmStationen.picTisch(VarIndex).Left + frmStationen.picTisch(VarIndex).Width - lblmarkierung.Width / 3
     lblmarkierung.Top = picTisch(VarIndex).Top + picTisch(VarIndex).Height - lblmarkierung.Height / 3
     lblmarkierung.Visible = True
       Else 'Sonst ausblenden
     lblmarkierung.Visible = False
  End If
Else
 'frmStationen.SSTabStationen.Tab = 0
 'frmStationen.ListViewStationen.SetFocus
 frmStationen.ListViewStationen.SelectedItem.Text = VarStation
 'Set frmStationen.ListViewStationen.SelectedItem = frmStationen.ListViewStationen.ListItems(1)

End If

End Sub
