filt_kas = ""

SELECT u_cis, text_sleva, uzaverka, stul, cas_atrib ;
       WHERE BETWEEN(uzaverka + id_kas, datsk1, datsk2) AND id_kas = m.filt_kas AND LEFT(text_sleva, 1) = "@" ;
       FROM (m.fn_sk_fin) INTO TABLE (m.gcpri_path + "pp")
SELECT SUBST(text_sleva, 2, 7) AS u_cis ;
       FROM (m.gcpri_path + "pp") INTO TABLE (m.gcpri_path + "ppp")
SELECT pp
APPEND FROM (m.gcpri_path + "ppp")

SELECT id_kas, u_cis, nazev, mnozstvi, prachy, cen_hlad, " " AS flag, ;
       "   " AS autor, SPACE(12) AS uzaverka, SPACE(7) AS u_cis_2, SPACE(15) AS text_sleva, ;
       000000000.00 AS cena_celk, 000000000.00 AS cena_slev, 000000000.00 AS sleva_abs, 00.0 AS stul ;
       WHERE u_cis IN (SELECT u_cis FROM (m.gcpri_path+"pp")) ;
       FROM (m.fn_sk_pol) INTO TABLE (m.gcpri_path + "pol")

SELE sk_fin
SET ORDE TO u_cis
SELE pol
SET RELA TO u_cis INTO sk_fin
REPL ALL autor WITH sk_fin.autor, text_sleva WITH sk_fin.text_sleva, uzaverka WITH sk_fin.uzaverka, stul WITH sk_fin.stul, ;
     cena_celk WITH sk_fin.cena_celk, sleva_abs WITH sk_fin.sleva_abs, cena_slev WITH sk_fin.cena_slev ;
     u_cis_2 WITH IIF("@" $ text_sleva, SUBST(text_sleva, 2), u_cis), flag WITH IIF("@" $ text_sleva, "*", "")
INDEX ON u_cis_2 + u_cis TAG uu

DO pr_report WITH "sk_storn"
DO pozavirej WITH "pp, ppp, pol"