' clear existing selection
tblNalogiNovi.ClearSelection
' clear all existing rows
tblNalogiNovi.ClearRows
Query = $"select wo.WoID as wo,
jo.JobID as job,
jo.Title as title,
jo.StatusName as statusname,
jo.CustomerName as customer,
wo.Lenght as dolzina,
wo.Width as sirina,
wo.ProductName as productname,
wo.MaterialName as materialname
from DiLiteWorkOrders wo inner join DiLiteJobs jo on jo.JobID = wo.JobID
where not exists(select * from DiLiteTransactions ac where ac.WoID = wo.WoId) and
(exists(select * from DiLiteTasks tk where tk.WorkOrderID = wo.WoId and (lower(tk.Operation) = lower('${IzbranaOperacija}') or lower('${IzbranaOperacija}') = 'vse operacije')))
order by wo desc"$
Dim rs As ResultSet = comDb.SqlLite.ExecQuery(Query)
' while records existing
Do While rs.NextRow
Dim Kvadratura As String = rs.GetString("dolzina") & "x" & rs.GetString("sirina")
tblNalogiNovi.AddRow(Array As Object(rs.GetInt("job"), rs.GetInt("wo"), rs.GetString("title"), rs.GetString("statusname"), rs.GetString("customer"), rs.GetString("dolzina"), rs.getstring("sirina"), Kvadratura, rs.GetString("productname"), rs.GetString("materialname")), True)
Loop
If rs.RowCount <> 0 Then tblNalogiNovi.Invalidate
rs.Close
' color odd lines
Dim Num As Int = 1
For x = 0 To tblNalogiNovi.RowCount - 1
If Num Mod 2 == 0 Then
tblNalogiNovi.SetRowCustomize(x, xui.Color_Black, B4XPages.MainPage.ColorLG, xui.CreateDefaultFont(15))
End If
Num = Num + 1
Next