*     minula prumerna cena se ulozi do spdan, do serial_no graficke zvyrazneni rozdilu po deseti procentech

IF FILE(m.gccen_path + "prumerne_ceny.dbf")
     SELECT 0
     USE (m.gccen_path + "prumerne_ceny") orde c_karty
     SELECT doklad
     GO TOP 
     IF datum_dokl > DATE() - 33
         SET RELATION TO c_karty INTO prumerne_ceny
         REPLACE ALL spdan WITH prumerne_ceny.cena_vazen
         DO pozavirej WITH "prumerne_ceny"

         SCAN
            IF spdan # 0
            pomer_cen = cena / spdan
                DO CASE 
                CASE m.pomer_cen < 0.7
                    REPLACE serial_no WITH "<<< " + STR(spdan, 7,1)
                CASE m.pomer_cen < 0.8
                    REPLACE serial_no WITH " << " + STR(spdan, 7,1)
                CASE m.pomer_cen < 0.9
                    REPLACE serial_no WITH "  < " + STR(spdan, 7,1)

                CASE m.pomer_cen > 1.3
                    REPLACE serial_no WITH "    " + STR(spdan, 7,1) + " >>>"
                CASE m.pomer_cen > 1.2
                    REPLACE serial_no WITH "    " + STR(spdan, 7,1) + " >>"
                CASE m.pomer_cen > 1.1
                    REPLACE serial_no WITH "    " + STR(spdan, 7,1) + " >"

                OTHERWISE 
                    REPLACE serial_no WITH ""
                ENDCASE 
            ENDIF 
         ENDSCAN 
    ENDIF 
ENDIF 
