Sub Globals
Private edtTonnen As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
If(edtTonnen.IsInitialized==False) Then edtTonnen.Initialize("")
IME.Initialize("IME")
IME.SetCustomFilter(edtTonnen, edtTonnen.INPUT_TYPE_NUMBERS, "0123456789.")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_KeyPress(KeyCode As Int) As Boolean
End Sub
Sub Start
Activity.LoadLayout("Formulier.bal")
End Sub
Sub ShowEntry(EntryIndex As Int)
Dim Cursor1 As Cursor
If (Mode = "Add") Then
edtTonnen.Text = ""
Else
edtTonnen.RequestFocus
End If
Else
'read the entry with the given ID
Cursor1 = Main.SQL1.ExecQuery("SELECT * FROM "&Main.DBWerktijden&" WHERE ROWID = "&EntryIndex)
Cursor1.Position = 0
edtTonnen.Text = Cursor1.GetString("Tonnen")
Cursor1.Close 'close the cursor, we don't it anymore
End If
End Sub
Sub AddEntry
Dim Query As String
If(Opdrachtgever.Text&edtLaadplaats.Text&ATLaad.Text&VTLaad.Text&edtAard.Text&edtLosplaats.Text&ATLos.Text&VTLos.Text&edtTonnen.Text&edtM3.Text&edtVrachten.Text<>"") Then
If(edtTonnen.Text.Trim=="") Then edtTonnen.Text="0.0"
If(edtM3.Text.Trim=="") Then edtM3.Text="0.0"
If(edtVrachten.Text.Trim=="") Then edtVrachten.Text="0"
Log(edtTonnen.Text) 'ERROR PART
Log(edtM3.Text) 'WORKS FINE
Log(edtVrachten.Text) 'WORKS FINE
Query = "INSERT INTO "&Main.DBWerktijden&" VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
Main.SQL1.ExecNonQuery2(Query, Array As String(ActiveROWID,Opdrachtgever.Text,edtLaadplaats.Text,ATLaad.Text,VTLaad.Text,edtAard.Text,edtLosplaats.Text,ATLos.Text,VTLos.Text,edtTonnen.Text,edtM3.Text,edtVrachten.Text,""))
Main.SQL1.ExecNonQuery("UPDATE ["&(Main.DBTonnen)&"] SET [WerktijdID] = "&Main.SQL1.ExecQuerySingleResult("SELECT last_insert_rowid();")&" WHERE WerktijdID=0")
ToastMessageShow("Invoer verwerkt", False) ' confirmation for the user
End If
End Sub
Sub edtM3_TextChanged (Old As String, New As String)
If (New <> "") Then
edtTonnen.Text=""
edtTonnen.Enabled=False
Else
edtTonnen.Enabled=True
edtVrachten.Text=""
End If
End Sub
Sub ControleRit As Boolean
If(edtTonnen.Text.Trim=="") Then edtTonnen.Text="0.0"
Log(edtTonnen.Text) 'ERROR PART
End Sub