parameters p_cis_kred, p_datum, p_snidane, p_pocet_s, p_obed, p_pocet_o, p_vecere, p_pocet_v, slspart_a, slspart_b, slspart_c, p_firma

*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  

sele objednano
locate for datum = m.p_datum .and. cis_kred = m.p_cis_kred
if found()
  repl s with m.p_snidane, pocet_s with m.p_pocet_s ;
       o with m.p_obed,    pocet_o with m.p_pocet_o ;
       v with m.p_vecere,  pocet_v with m.p_pocet_v
else
  insert into (fn_objednano) (datum, cis_kred,    s,    o,    v,       pocet_s,     pocet_o,     pocet_v) values ;
      (m.p_datum, m.p_cis_kred, m.p_snidane, m.p_obed, m.p_vecere, m.p_pocet_s, m.p_pocet_o, m.p_pocet_v)
endif

sele objednano
if m.p_snidane = "6"
  repl pocet_s with 0, s with ""
endif

if m.p_obed = "6"
  repl pocet_o with 0, o with ""
endif

if m.p_vecere = "6"
  repl pocet_v with 0, v with ""
endif

repl kdy_objed with strtr(time(), ":", ""), objednal with m.gcuser_id
