Wäre es möglich, dass du den Code ein wenig kommentierst? Blicke nicht so direkt durch.
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <ComboConstants.au3>
#include <GuiListView.au3>
#include <StaticConstants.au3>
Global $ProjektDB = @scriptdir & "\projektdb.txt" ;Datenbank und Variablen
Global $UserDB = @scriptdir & "\userdb.txt"
Global $ProjektUserDB = @scriptdir & "\projektuserdb.txt"
Global $AllDB = @scriptdir & "\alldb.txt"
Global $StundenDB = @scriptdir & "\stundendb.txt"
Global $nProjekt = 0
Global $nUser = 0
Global $aAdd = 0
Global $cItem = 0
Global $dItem = 0
Global $eItem = 0
Global $fItem = 0
Global $UserFileLoad = 0
Global $u = -1
Global $StundenStunden = 0
#Region ### START Koda GUI section ### Form=C:\Users\Maurice\Documents\Projektdatenbank\GUIMain.kxf ;MainGUI
$GUIMain = GUICreate("Projektdatenbank", 840, 438, 192, 124)
$ProjektList = GUICtrlCreateListView("Projekt|Benutzer|Stunden|Stunden seit letzter Abrechnung", 8, 40, 820, 321) ;Listview
Global $nLVHandle = GUICtrlGetHandle($ProjektList) ;Listview-Handle
_GUICtrlListView_SetColumn($nLVHandle, 0, "Projekt", 150, 0) ;1.Spalte
_GUICtrlListView_SetColumn($nLVHandle, 1, "Benutzer", 400, 0) ;2.Spalte
_GUICtrlListView_SetColumn($nLVHandle, 2, "Stunden", 70, 0) ;3.Spalte
_GUICtrlListView_SetColumn($nLVHandle, 3, "Stunden seit letzter Abrechnung", 195, 0) ;4. Spalte
Global $bNew = GUICtrlCreateButton("Neues Projekt", 24, 376, 107, 33)
GUICtrlSetCursor (-1, 0)
Global $bUserNew = GUICtrlCreateButton("Neuer Benutzer", 160, 376, 107, 33)
GUICtrlSetCursor (-1, 0)
Global $bAdd = GUICtrlCreateButton("Benutzer hinzufügen", 296, 376, 107, 33)
GUICtrlSetCursor (-1, 0)
Global $bWork = GUICtrlCreateButton("Leistung hinzufügen", 432, 376, 107, 33)
GUICtrlSetCursor (-1, 0)
Global $bReset = GUICtrlCreateButton("Stunden Reset", 570, 376, 107, 33)
GUICtrlSetCursor (-1, 0)
Global $bStunden = GUICtrlCreateButton("Stundenauflistung", 710, 376, 107, 33)
GUICtrlSetCursor (-1, 0)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Neues Projekt GUI
Global $GUINew = GUICreate("Neues Projekt anlegen", 255, 95, -1, -1)
Global $ButtonOkNew = GUICtrlCreateButton("&OK", 30, 64, 75, 25)
Global $ButtonCancelNew = GUICtrlCreateButton("Abbrechen", 143, 64, 75, 25)
Global $LabelNew = GUICtrlCreateLabel("Projektname", 8, 4, 109, 28, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
Global $InputNew = GUICtrlCreateInput("", 8, 32, 233, 21)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Neuer Benutzer GUI
Global $GUIUserNew = GUICreate("Neuen Benutzer anlegen", 255, 95, -1, -1)
Global $ButtonOkUserNew = GUICtrlCreateButton("&OK", 30, 64, 75, 25)
Global $ButtonCancelUserNew = GUICtrlCreateButton("Abbrechen", 143, 64, 75, 25)
Global $LabelUserNew = GUICtrlCreateLabel("Benutzername", 8, 4, 109, 28, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
Global $InputUserNew = GUICtrlCreateInput("", 8, 32, 233, 21)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Benutzer hinzufügen GUI
$GUIAdd = GUICreate("Benutzer zu Projekt hinzufügen", 380, 131, 302, 218)
$ComboProjektAdd = GUICtrlCreateCombo("", 32, 48, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$LabelProjektAdd = GUICtrlCreateLabel("Projekt", 32, 16, 61, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$LabelUserAdd = GUICtrlCreateLabel("Benutzer", 224, 16, 79, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$ButtonOkAdd = GUICtrlCreateButton("OK", 80, 88, 75, 25)
$ButtonCancelAdd = GUICtrlCreateButton("Abbrechen", 232, 88, 75, 25)
$ComboUserAdd = GUICtrlCreateCombo("", 216, 48, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Leistung hinzufügen GUI
$GUIWork = GUICreate("Leistung zu Projekt hinzufügen", 585, 143, 302, 218)
$ComboProjektWork = GUICtrlCreateCombo("", 32, 48, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$LabelProjektWork = GUICtrlCreateLabel("Projekt", 32, 16, 61, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$LabelUserWork = GUICtrlCreateLabel("Benutzer", 224, 16, 79, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$ButtonOkWork = GUICtrlCreateButton("OK", 200, 88, 75, 25)
$ButtonCancelWork = GUICtrlCreateButton("Abbrechen", 304, 88, 75, 25)
$ComboUserWork = GUICtrlCreateCombo("", 216, 48, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$InputWork = GUICtrlCreateInput("", 408, 48, 121, 21)
$LabelStundenWork = GUICtrlCreateLabel("Arbeitsstunden", 408, 16, 130, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Hinweis GUI
$HinweisNew = GUICreate("Hinweis", 219, 90, 321, 218)
$LabelHinweisNew = GUICtrlCreateLabel("Projekt wurde erfolgreich erstellt", 16, 16, 193, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$ButtonHinweisNew = GUICtrlCreateButton("Ok", 72, 48, 75, 25)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Hinweis GUI
$HinweisUserNew = GUICreate("Hinweis", 219, 90, 321, 218)
$LabelHinweisUserNew = GUICtrlCreateLabel("Benutzer wurde erfolgreich erstellt", 16, 16, 193, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$ButtonHinweisUserNew = GUICtrlCreateButton("Ok", 72, 48, 75, 25)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Hinweis GUI
$HinweisAdd = GUICreate("Hinweis", 219, 90, 321, 218)
$LabelHinweisAdd = GUICtrlCreateLabel("Benutzer wurde erfolgreich hinzugefügt", 16, 16, 240, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$ButtonHinweisAdd = GUICtrlCreateButton("Ok", 72, 48, 75, 25)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Hinweis GUI
$HinweisWork = GUICreate("Hinweis", 219, 90, 321, 218)
$LabelHinweisWork = GUICtrlCreateLabel("Leistung wurde erfolgreich hinzugefügt", 16, 16, 240, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$ButtonHinweisWork = GUICtrlCreateButton("Ok", 72, 48, 75, 25)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Error GUI
$ErrorForm = GUICreate("ErrorForm", 276, 125, 192, 124)
$bError = GUICtrlCreateButton("OK", 96, 80, 75, 25)
$eLabel1 = GUICtrlCreateLabel("Leistung hinzufügen fehlgeschlagen. Benutzer", 0, 16, 273, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$eLabel2 = GUICtrlCreateLabel("ist nicht Mitglied des Projektes.", 40, 48, 186, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form= ;Stundenauflistung GUI
$GUIStunden = GUICreate("Stundenauflistung", 402, 195, 192, 124)
$ComboUserStunden = GUICtrlCreateCombo("", 24, 24, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$ComboProjektStunden = GUICtrlCreateCombo("", 232, 24, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$OutputLabel = GUICtrlCreateLabel("", 24, 64, 356, 68)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$bStundenBerechnen = GUICtrlCreateButton("Arbeitsstunden anzeigen", 32, 144, 139, 25)
$bStundenAbbrechen = GUICtrlCreateButton("Abbrechen", 232, 144, 139, 25)
#EndRegion ### END Koda GUI section ###
_GUICtrlListView_RegisterSortCallBack ($ProjektList) ;ListView Sortierungsvorraussetzung
GUISetState (@SW_SHOW, $GUIMain) ;Main GUI anzeigen
If FileExists ($AllDB) Then AllLoad() ;DatenBank ins Listview laden
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg [0]
Case $ProjektList ;sortieren
_GUICtrlListView_SortItems ($nLVHandle, GUICtrlGetState($ProjektList))
Case $bNew ;neues Projekt anlegen
WinSetTitle ($GUINew, "", "Neues Projekt")
GUISetState (@SW_SHOW, $GUINew)
GUISetState (@SW_HIDE, $GUIMain)
Case $bUserNew ;neuer Benutzer
WinSetTitle ($GUIUserNew, "", "Neuer Benutzer")
GUISetState (@SW_Show, $GUIUserNew)
GUISetState (@SW_HIDE, $GUIMain)
Case $bAdd ;Benutzer einem Projekt hinzufügen
WinSetTitle ($GUIAdd, "", "Benutzer hinzufügen")
GUISetState (@SW_SHOW, $GUIAdd)
GUISetState (@SW_HIDE, $GUIMain)
GUICtrlSetData($ComboProjektAdd, "")
$ProjektFileLoad = FileOpen($ProjektDB) ;Projekte aus ProjektDB in Combobox laden
Local $sAdd = "", $i = 0
Do
$i += 1
$sAdd &= FileReadLine($ProjektFileLoad, $i) & "|"
Until @Error <> 0
GUICtrlSetData($ComboProjektAdd, $sAdd)
FileClose($ProjektFileLoad)
GUICtrlSetData($ComboUserAdd, "")
$UserFileLoad = FileOpen($UserDB) ;User aus UserDB in Combobox laden
Local $tAdd = "", $i = 0
Do
$i += 1
$tAdd &= FileReadLine($UserFileLoad, $i) & "|"
Until @Error <> 0
GUICtrlSetData($ComboUserAdd, $tAdd)
FileClose($UserFileLoad)
Case $bWork ;Leistung hinzufügen
WinSetTitle ($GUIWork, "", "Leistung hinzufügen")
GUISetState (@SW_SHOW, $GUIWork)
GUISetState (@SW_HIDE, $GUIMain)
GUICtrlSetData($ComboProjektWork, "")
$ProjektFileLoad2 = FileOpen($ProjektDB) ;Projekte aus ProjektDB in Combobox laden
Local $uAdd = "", $i = 0
Do
$i += 1
$uAdd &= FileReadLine($ProjektFileLoad2, $i) & "|"
Until @Error <> 0
GUICtrlSetData($ComboProjektWork, $uAdd)
FileClose($ProjektFileLoad2)
GUICtrlSetData($ComboUserWork, "")
$UserFileLoad2 = FileOpen($UserDB) ;User aus UserDB in Combobox laden
Local $vAdd = "", $i = 0
Do
$i += 1
$vAdd &= FileReadLine($UserFileLoad2, $i) & "|"
Until @Error <> 0
GUICtrlSetData($ComboUserWork, $vAdd)
FileClose($UserFileLoad2)
Case $bReset
Reset()
Case $ButtonOkNew ;Neues Projekt Button Funktionsstart
NeuesProjekt()
Case $ButtonOkUserNew ;Neues Benutzer Button Funktionsstart
NeuerUser()
Case $ButtonOkAdd ;Benutzer hinzufügen Button Funktionsstart
UserAdd()
Case $ButtonOkWork ;Arbeit hinzufügen Button Funktionsstart
WorkAdd()
Case $bError ;Errorhinweis wahrgenommen
GUISetState (@SW_HIDE, $ErrorForm)
GUISetState (@SW_SHOW, $GUIWork)
WinActivate ($GUIWork)
Case $bStunden ;Stundenauflistung
WinSetTitle ($GUIStunden, "", "Stundenauflistung")
GUISetState (@SW_HIDE, $GUIMain)
GUISetState (@SW_SHOW, $GUIStunden)
WinActivate ($GUIStunden)
GUICtrlSetData($ComboProjektStunden, "")
$ProjektFileLoad3 = FileOpen($ProjektDB) ;Projekte aus ProjektDB in Combobox laden
Local $wAdd = "", $i = 0
Do
$i += 1
$wAdd &= FileReadLine($ProjektFileLoad3, $i) & "|"
Until @Error <> 0
GUICtrlSetData($ComboProjektStunden, "Alle" & "|" & $wAdd)
FileClose($ProjektFileLoad3)
GUICtrlSetData($ComboUserStunden, "")
$UserFileLoad3 = FileOpen($UserDB) ;User aus UserDB in Combobox laden
Local $xAdd = "", $i = 0
Do
$i += 1
$xAdd &= FileReadLine($UserFileLoad3, $i) & "|"
Until @Error <> 0
GUICtrlSetData($ComboUserStunden, "Alle" & "|" & $xAdd)
FileClose($UserFileLoad3)
Case $bStundenBerechnen
Stunden()
Case $GUI_EVENT_CLOSE, $ButtonCancelNew, $ButtonCancelUserNew, $ButtonCancelAdd, $ButtonCancelWork, $ButtonHinweisNew, $ButtonHinweisUserNew, $ButtonHinweisAdd, $ButtonHinweisWork, $bStundenAbbrechen ;Schließen
Switch $nMSG[1]
Case $GUIMain
If MSGBox(32+4, "Beenden", "Wollen sie das Programm wirklich beenden?") = 6 Then End()
Case $GUINew
GUISetState (@SW_HIDE, $GUINew)
GUISetState (@SW_SHOW, $GUIMain)
WinActivate ($GUIMain)
Case $GUIUserNew
GUISetState (@SW_HIDE, $GUIUserNew)
GUISetState (@SW_SHOW, $GUIMain)
WinActivate ($GUIMain)
Case $GUIAdd
GUISetState (@SW_HIDE, $GUIAdd)
GUISetState (@SW_SHOW, $GUIMain)
WinActivate ($GUIMain)
Case $GUIWork
GUISetState (@SW_HIDE, $GUIWork)
GUISetState (@SW_SHOW, $GUIMain)
WinActivate ($GUIMain)
Case $HinweisNew
GUISetState (@SW_HIDE, $HinweisNew)
GUISetState (@SW_SHOW, $GUINew)
WinActivate ($GUINew)
Case $HinweisUserNew
GUISetState (@SW_HIDE, $HinweisUserNew)
GUISetState (@SW_SHOW, $GUIUserNew)
WinActivate ($GUIUserNew)
Case $HinweisAdd
GUISetState (@SW_HIDE, $HinweisAdd)
GUISetState (@SW_SHOW, $GUIAdd)
WinActivate ($GUIAdd)
Case $HinweisWork
GUISetState (@SW_HIDE, $HinweisWork)
GUISetState (@SW_SHOW, $GUIWork)
WinActivate ($GUIWork)
Case $GUIStunden
GUISetState (@SW_HIDE, $GUIStunden)
GUISetState (@SW_SHOW, $GUIMain)
WinActivate ($GUIMain)
EndSwitch
EndSwitch
WEnd
Func NeuesProjekt() ;Funktion Neues Projekt
$nProjekt = GUICtrlRead ($InputNew)
GUISetState (@SW_HIDE, $GUINew)
GUISetState (@SW_SHOW, $HinweisNew)
GUICtrlSetData ($InputNew, "")
ProjektSave()
EndFunc
Func NeuerUser() ;Funktion Neuer Benutzer
$nUser = GUICtrlRead ($InputUserNew)
GUISetState (@SW_HIDE, $GUIUserNew)
GUISetState (@SW_SHOW, $HinweisUserNew)
GUICtrlSetData ($InputUserNew, "")
UserSave()
EndFunc
Func UserAdd() ;Funktion Benutzer hinzufügen
$aProjekt = GUICtrlRead ($ComboProjektAdd)
$aUser = GUICtrlRead ($ComboUserAdd)
$aAdd = $aProjekt & "|" & $aUser
GUISetState (@SW_HIDE, $GUIAdd)
GUISetState (@SW_SHOW, $HinweisAdd)
AddSave()
EndFunc
Func WorkAdd() ;Funktion Leistung hinzufügen
$wProjekt = GUICtrlRead ($ComboProjektWork)
$wUser = GUICtrlRead ($ComboUserWork)
$wStunden = GUICtrlRead ($InputWork)
$ProjektUserFileLoad = FileOpen($ProjektUserDB) ;Test ob User Projekt zugewiesen wurde
Local $i = 0
Local $o = 0
Do
$i += 1
$iLine = FileReadLine($ProjektUserFileLoad, $i)
If $iLine = $wProjekt & "|" & $wUser Then
$o = 1
EndIf
Until @Error <> 0
If $o=1 Then ;Wenn zu gewiesen, dann
FileClose($UserFileLoad2) ;in StundenDB schreiben
$StundenFileLoad = FileOpen($StundenDB, 1)
FileWriteLine($StundenFileLoad, $wUser & "|" & $wProjekt & "|" & $wStunden)
FileClose($StundenFileLoad)
Local $j = -1
Local $k = 0
$ItemCount = _GUICtrlListView_GetItemCount($nLVHandle)
Do ;Schleife zum Testen ob Projekt/User im Projekt exisitiert
$j += 1
$Itemtext = _GUICtrlListView_GetItemText ($nLVHandle, $j, 0)
$Itemtext2 = _GUICtrlListView_GetItemText ($nLVHandle, $j, 1)
$Itemtext3 = _GUICtrlListView_GetItemText ($nLVHandle ,$j, 2)
If $Itemtext = $wProjekt And StringInStr($Itemtext2, $wUser) <> 0 Then ;Wenn Projekt und User im Projekt schon existieren, dann
_GUICtrlListView_SetItemText ($nLVHandle, $j, $Itemtext3 + $wStunden, 2)
_GUICtrlListView_SetItemText ($nLVHandle, $j, $Itemtext3 + $wStunden, 3)
$k = 1
ElseIf $ItemText = $wProjekt And StringInStr($Itemtext2, $wUser) = 0 Then ;Wenn nur Projekt existiert, dann
_GUICtrlListView_SetItemText ($nLVHandle, $j, $Itemtext2 & ", " & $wUser, 1)
_GUICtrlListView_SetItemText ($nLVHandle, $j, $Itemtext3 + $wStunden, 2)
_GUICtrlListView_SetItemText ($nLVHandle, $j, $Itemtext3 + $wStunden, 3)
$k = 1
EndIf
Until $j = $Itemcount
If $k = 0 Then ;Wenn weder noch, dann neuer Eintrag
_GUICtrlListView_AddItem ($nLVHandle, "", $ItemCount)
_GUICtrlListView_SetItemText ($nLVHandle, $ItemCount, $wProjekt, 0)
_GUICtrlListView_SetItemText ($nLVHandle, $ItemCount, $wUser, 1)
_GUICtrlListView_SetItemText ($nLVHandle, $ItemCount, $wStunden, 2)
_GUICtrlListView_SetItemText ($nLVHandle, $ItemCount, $wStunden, 3)
EndIf
GUISetState (@SW_HIDE, $GUIWork)
GUISetState (@SW_SHOW, $HinweisWork)
Else
GUISetState (@SW_HIDE, $GUIWork)
GUISetState (@SW_SHOW, $ErrorForm)
EndIf
WorkSave()
EndFunc
Func ProjektSave() ;Funktion Projekte speichern
$ProjektFile = FileOpen ($ProjektDB, 1)
FileWriteLine ($ProjektFile, $nProjekt)
FileClose ($ProjektFile)
EndFunc
Func UserSave() ;Funktion Benutzer speichern
$UserFile = FileOpen ($UserDB, 1)
FileWriteLine ($Userfile, $nUser)
FileClose ($UserFile)
EndFunc
Func AddSave() ;Funktion ProjekteBenutzer speichern
$AddFile = FileOpen ($ProjektUserDB, 1)
FileWriteLine ($AddFile, $aAdd)
FileClose ($AddFile)
EndFunc
Func WorkSave() ;Funktion Leistung speichern
Local $iCount = _GUICtrlListView_GetItemCount($nLVHandle) - 1
Local $WorkFile = FileOpen ($AllDB, 2)
For $1=0 To $iCount
$sItem = _GUICtrlListView_GetItemTextString ($nLVHandle, $1)
FileWriteLine($WorkFile, $sItem)
Next
FileClose($WorkFile)
EndFunc
Func AllLoad() ;Funktion Datenbank ins Listview laden
Local $WorkFileLoad = FileOpen ($AllDB, 0)
_GUICtrlListView_BeginUpdate($nLVHandle)
While True
$bItem = FileReadLine ($WorkFileLoad)
If @error Then ExitLoop
GUICtrlCreateListViewItem ($bItem, $ProjektList)
WEnd
_GUICtrlListView_EndUpdate($nLVHandle)
FileClose ($WorkFileLoad)
EndFunc
Func Reset() ;Stundenzahl zurücksetzen
$u = _GUICtrlListView_GetSelectionMark ($nLVHandle)
_GUICtrlListView_SetItemText ($nLVHandle, $u, 0, 3)
EndFunc
Func Stunden() ;Stundendetails auflisten
$StundenFileLoad2 = FileOpen ($StundenDB)
$StundenLines = _FileCountLines ($StundenDB)
$StundenUser = GUICtrlRead ($ComboUserStunden)
$StundenProjekt = GUICtrlRead ($ComboProjektStunden)
If $StundenUser = "Alle" And $StundenProjekt = "Alle" Then ;Wenn Alle User + Alle Projekte ausgewählt wurden, dann (Stunden insg.)
Local $i = 0
Local $StundenStunden = 0
Do
$i += 1
$iLine = FileReadLine($StundenFileLoad2, $i)
$iSplit = StringSplit($iLine, "|")
$StundenStunden = $StundenStunden + $iSplit[3]
Until $i = $StundenLines
GUICtrlSetData($OutputLabel, "Insgesamt wurden " & $StundenStunden & " Stunden gearbeitet")
ElseIf $StundenUser <> "Alle" And $StundenProjekt = "Alle" Then ;Wenn Alle Projekte eines Users ausgewählt wurden, dann (Stunden eines Users insg.)
Local $i = 0
Local $StundenStunden = 0
Do
$i += 1
$iLine = FileReadLine($StundenFileLoad2, $i)
$iSplit = StringSplit($iLine, "|")
If $iSplit[1] = $StundenUser Then
$StundenStunden = $StundenStunden + $iSplit[3]
EndIf
Until $i = $StundenLines
GUICtrlSetData($OutputLabel, "Benutzer " & $StundenUser & " hat insgesamt " & $StundenStunden & " Stunden gearbeitet.")
ElseIf $StundenUser = "Alle" And $StundenProjekt <> "Alle" Then ;Wenn alle User eines Projektes ausgewählt wurden, dann (Stunden eines Projektes insg.)
Local $i = 0
Local $StundenStunden = 0
Do
$i += 1
$iLine = FileReadLine($StundenFileLoad2, $i)
$iSplit = StringSplit($iLine, "|")
If $iSplit[2] = $StundenProjekt Then
$StundenStunden = $StundenStunden + $iSplit[3]
EndIf
Until $i = $StundenLines
GUICtrlSetData($OutputLabel, "Für Projekt " & $StundenProjekt & " wurden insgesamt " & $StundenStunden & " Stunden gearbeitet.")
Else ;Wenn ein spezifischer User und ein spezifisches Projekt ausgewählt wurden, dann (Stunden eines Users an einem Projekt)
Local $i = 0
Local $StundenStunden = 0
Do
$i += 1
$iLine = FileReadLine($StundenFileLoad2, $i)
$iSplit = StringSplit($iLine, "|")
If $iSplit[1] = $StundenUser And $iSplit[2] = $StundenProjekt Then
$StundenStunden = $StundenStunden + $iSplit[3]
EndIf
Until $i = $StundenLines
GUICtrlSetData($OutputLabel, "Benutzer " & $StundenUser & " hat " & $StundenStunden & " Stunden an Projekt " & $StundenProjekt & " gearbeitet.")
EndIf
FileClose($StundenFileLoad2)
EndFunc
Func End() ;Schließen
WorkSave()
_GUICtrlListView_UnRegisterSortCallBack ($nLVHandle)
Exit
EndFunc
Laufen tut auf jeden fall mal alles. Bissjen schlanker könnte es aber ruhig sein ;)