SQL_DDV = "SELECT A.DDV, Sum(A.Kolicina) AS KOL, Avg(A.Ed_Cena) AS Cena, tblTarifi.Koeficient," _ & " [kol]*[Cena] AS VUkupno," & "(SELECT Sum([kolicina]*[Ed_cena]) AS suma" _ & " FROM tblSmetki INNER JOIN tblsmetki_stavki ON tblSmetki.ID_Smetka = tblsmetki_stavki.Smetka_Br" _ & " WHERE tblSmetki.ID_Smetka=" & SmetkaBroj & ") AS Suma" & ", Avg(tblSmetki.Rabat) AS Rab," _ & " [suma]-" & Rabat & " AS Za_Naplatu, [Suma]/[VUkupno] AS Procenat," _ & " [Za_Naplatu]/[procenat] AS N_Sa_Pdv, [N_Sa_Pdv]/[Koeficient] AS N_Bez_PDV, [N_Sa_PDV]-[N_Bez_Pdv] AS PDV_Iznos" _ & " FROM tblTarifi INNER JOIN (tblSmetki INNER JOIN tblsmetki_stavki AS A ON tblSmetki.ID_Smetka = A.Smetka_Br) ON tblTarifi.Tarifa = A.DDV" _ & " WHERE tblSmetki.ID_Smetka=" & SmetkaBroj _ & " GROUP BY A.DDV, tblTarifi.Koeficient"