*+▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
*+
*+    Source Module => F:\CLICK\RVM.PRG
*+
*+    Robot Video Manager versione 5.xx
*+    ---------------------------------
*+    -= Source Code =-
*+
*+    (c)1992-1996 Roberto Gaspari Software
*+    (c)1996-2000 Ciakware di Roberto Gaspari (www.ciakware.com)
*+
*+    Il codice sorgente può essere modificato o adattato ma non può essere
*+    utilizzato per altre applicazioni, non può essere modificato il copyright
*+    e non può essere distribuito a terzi senza il consenso di Ciakware.
*+
*+    Il contenuto di questo archivio è soggetto alle vigenti normative sul
*+    Copyright e sui Diritti di Autore.
*+
*+
*+    Functions: Procedure MAIN()
*+               Procedure FunKeys()
*+               Procedure Stuffer()
*+               Function XEsc()
*+               Procedure RetMaster()
*+               Procedure OverMan()
*+               Procedure KBUFFER()
*+               Function FBuffer()
*+               Procedure Vbuffer()
*+               Procedure ALTm()
*+               Procedure ALTj()
*+               Procedure Stuff42()
*+               Function BbFUN()
*+
*+       Tables: dbusearea(.F.,,"CWRVM.LAN",,if(.F. .or. .F.,!.F.,NIL),.F.)
*+
*+    Reformatted by Click! 2.03 on Jan-25-2000 at  1:16 pm
*+
*+▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure MAIN()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
proc MAIN


// M_FRAME("   ▐▐ ▌▌ ")
// M_FRAME("         ")
// SetBoxChars("   ▐▐ ▌▌ ")
// m_frame("┌─┐▐┘ └│ ")
// SetBoxChars("┌─╧▐┘ └│ ")
// m_frame("┌─╧▐┘ └│ ")
set color to W+/B
save screen to tscreen
clear screen
dbcloseall()
if conf_abMOU = "S" .and. Ismouse()
    Mouse(.T.)
    M_csrput(0,0)
else
    Mouse(.F.)
endif

scroll()
setpos(0,0)
ReadKill(.T.)
GetList := {}
if file("README.RVM")
    m_title(cw("PREMERE ESC PER TERMINARE"))
    m_View(0,0,LastRow(),79,"README.RVM")
    if !m_Query(cw("DESIDERI RILEGGERE AL PROSSIMO RIAVVIO"))
        ferase("README.RVM")
    endif
endif

private scelta
sh_bar := .F.

c1 := "W+/B,N/W"
c2 := "N/BG"
c3 := "N/G"
c4 := "GR+/B"
c5 := "W+*/R"
c6 := "GR+/N"

settavideo()

oretotalst := oretotalst+1
curr_color := setcolor(c1)
__SetFunction(7,chr(23))
set(8,"Off")
private tab[23]
private Pad[5]
private padd[5]
today   := date()
nol_ob  := "00000"
nol_oe  := "99999"
nol_cri := .T.
nolsat  := "*   "
nolabl  := " "
nolpdm  := 0
__MRestore("rvm",.T.)
CsrOff()
OnceIsVJ := .t.

PLSWAIT(.T.,cw("LETTURA DATI IN CORSO"))
CsrOff()
NOLAZ  := key_read("RAGIONE SOCIALE")
NOLNUM := key_read("CIRCUITO")
NOLCTT := key_read("CARDS")
if val(NOLCTT) < 30
    NOLCTT := "9999"
endif
PLSWAIT(.F.)

do while .t.
if !file("REGOK.RVM")
    actcode = "    "
    one_read("Codice di Attivazione per circuito: "+nolnum,"ACTCODE","@!")
    if actcode = "ÇÇÇÇ"
        exit
    endif
    if actcode <> left(txt2pdu(nolnum),4)
        msg("Errore codice")
        Border(0)
        VidReset()
        BlinkBit(.t.)
        quit
    endif
    writefile("REGOK.RVM",actcode)
    exit
else
    hdl = fopen("REGOK.RVM")
    actcode = freadline(hdl)
    fclose(hdl)
    if actcode <> left(txt2pdu(nolnum),4)
        msg("Errore codice")
        quit
    endif
    exit
endif
enddo

_demo := nolnum = "000000"

IF "*DEMO*" $ blisernum()
    _demo = .t.
    nolnum = "000000"
    nolaz  = "* DEMO VERSION *"
ENDIF


if !SlaveCPU
    __MSave("RVM","NOL*",.T.)
endif



if _demo
    cls(9,"█")
    MSG(10,"RVM *** DEMO *** ",;
               "─────────────────────────────────────────────────────────",;
               "■ "+cw("Questo prodotto è utilizzato in modalita' DIMOSTRATIVA."),;
               "  "+cw("Contattare il Servizio Tecnico Autorizzato Ciakware al numero:"),;
               "  "+cw("+39-348-7847480 per ulteriori informazioni.")," ",;
               "■ "+cw("Non è consentito utilizzare questo prodotto per"),;
               "  "+cw("applicazioni commerciali se non viene comprovato il"),;
               "  "+cw("suo acquisto dalla Licenza d'Uso e dalla relativa fattura d'acquisto."))
    SS_Implode(0,0,LastRow(),79,tscreen,22200)
    __Keyboard()
endif

cls(3,"░")

// IF !MultiMsgYN({"Attenzione:","────────────────────────────────────────────────────────","Questa versione è DIMOSTRATIVA e destinata per un utilizzo","esclusivo da parte dei betatester.","Si prega di segnalare i problemi rilevati al servizio di","assistenza Ciakware, "," ","■ Memoria RAM libera (protected mode): "+Alltrim(Transform(Memory(0)*1024,"@E ###,###,###"))+" bytes"," ","Se si vuole interrompere, premere CANCEL ora"},"Ok","Cancel")
//     Do Crepa
// ENDIF
// SS_Implode(0,0,LastRow(),79,tscreen,12200)
// Inkey(1)

dbferror := .F.
if !SlaveCPU .and. DoCheck .and. conf_abCHK = "S"
    do RVMq with cw("Integrità Archivi")
    PLSWAIT(.T.,cw("CONTROLLO ARCHIVI IN CORSO"))
    totdbf  := adir("*.DBF")
    errore  := .F.
    iserror := .F.
    if totdbf <> 0
        DECLARE DBFiles[totdbf]
        adir("*.DBF",dbfiles)
        for i := 1 to totdbf
            CsrOff()
            errore := .F.
            HELP25(DBFiles[i])
            hdl    := fopen(DBFiles[i])
            dbf_id := ITOH(FReadByte(hdl))
            dbf_an := FReadByte(hdl)
            dbf_ms := FReadByte(hdl)
            dbf_gi := FReadByte(hdl)
            dbf_tt := FReadLong(hdl)
            dbf_na := untrim(DBFiles[i],15)
            if dbf_id <> "03" .and. dbf_id <> "83" .and. DBFiles[i] <> "RVMSMX.dbf"
                Beep()
                errore   := .T.
                dbferror := .T.

                MSG(cw("ARCHIVIO ")+dbf_na,cw("ERRORE: DATABASE CORROTTO!"))
            endif
            fclose(hdl)
            if !errore .and. !"$" $ dbfiles[i] .and. !"-" $ dbfiles[i]
                USE (dbfiles[i]) ALIAS testdb EXCLUSIVE
                tot := lastrec()
                if tot <> dbF_tt
                    Beep()
                    dbferror := .T.

                    MSG(cw("ARCHIVIO: ")+dbf_na,cw("DIMENSIONE ERRATA!"),cw("ATTESI: ")+alltrim(str(dbf_tt)),cw("REALI : ")+alltrim(str(tot)))
                endif
                dbclosearea()
            endif
        next
    endif
    if dbferror
        MSG(cw("RISCONTRATI ERRORI SUGLI ARCHIVI DI GESTIONE"))
    endif
    PLSWAIT(.F.)
    __MXRelease("DBFILES")
endif

if !file(ID+"_LOG.OUT") .and. !SlaveCPU .and. DoCheck .and. !nointro
    M_data(16,3)
    M_data(22,1)
    M_Display(cw("PRECEDENTE USCITA NON CORRETTA: RICOSTRUIRE INDICI"),112)
    M_csroff()
else
    M_csroff()
    ferase((ID+"_LOG.OUT"))
endif

M_csroff()

old_col := setcolor()
EXTERNAL Help
EXTERNAL HELPMOD
EXTERNAL CTRLW

setkey(- 30,{| p,l,v | HHELP(p,l,v)})

if !NoKeyStat
    Clock24(0,70,27)
    Scrltext(0,30,"[SCROL]",25)
    Instext(0,37,"[INS]",25)
    Numtext(0,42,"[NUM]",25)
    Capstext(0,47,"[CAPS]",25)
    hotkeys(1)
    Keystat(.T.)
endif

forcekey   := .F.
forcemodem := .T.

if !file("USRINFO.CFG") .and. !_demo
    regutente()
    MSG(9999,cw("REGISTRAZIONE PRODOTTO"),;
                "─────────────────────────────────────────────────────────",;
                cw("La ringraziamo per avere compilato la scheda prodotto."),;
                cw("In seguito questi dati NON Le verranno piu` richiesti salvo"),;
                cw("il caso di variazione della Licenza di Utilizzo."))
endif
if file("USRINFO.CFG")
    __MRestore("USRINFO.CFG",.T.)
endif

// *: Conversione lettore da precedenti versioni :**

tipoletore := "                "
tipoletcom := 1
tipoletbau := 115200

if !file(id+"CARD.MEM")

    if right(gete("VJET"),1) = "I"
        tipoletore := "VIDEO JET (VideoBank)"
        tipoletcom := 1
        tipoletbau := 2400
    else
        tipoletore := "                "
        tipoletcom := 1
        tipoletbau := 115200
    endif

    do case
        case file(id+"bmKDE.mem")
            tipoletore := "KDE port 360h        "
            tipoletcom := 1
            tipoletbau := 9600

        case file(id+"bmMMW.mem")
            RESTORE from (id+"bmMMW") additive
            tipoletore := "OMRON MMW4 ROM MMW1  "
            tipoletcom := omron_com
            tipoletbau := omron_bau

        case file(id+"bmMKW.mem")
            RESTORE from (id+"bmMkW") additive
            tipoletore := "OMRON MMWx ROM Sicit "
            tipoletcom := omron_com
            tipoletbau := omron_bau

        case file(id+"bmNEU.mem")
            tipoletore := "NEURON port 360h     "
            tipoletcom := 1
            tipoletbau := 9600

        case file(id+"bmSP2.mem")
            RESTORE from (id+"bmsp2") additive
            tipoletore := "TMC SP2000 3 Heads   "
            tipoletcom := 1
            tipoletbau := 9600

        case file(id+"bmmw1.mem")
            RESTORE from (id+"bmmw1") additive
            tipoletore := "OMRON MMW4 ROM MMW1  "
            tipoletcom := mmw1_com
            tipoletbau := mmw1_bau

        case file(id+"bmVBS.mem")
            tipoletore := "OMRON MMW4 ROM VBSeek"
            tipoletcom := 1
            tipoletbau := 9600

    endcase
    save to (id+"CARD.MEM") all like tipolet*
endif

RESTORE from (id+"CARD") additive

/*
if len(BliDemDTE()) <> 0
    Msg("WARNING",;
                 "─────────────────────────────────────────────────────────────────",;
                 "This is an Alpha Version of RVM. You can utilize it sending",;
                 "reports to [email protected].",;
                 " ",;
                 "This version of RVM is not for final customers and works in",;
                 "debug mode.",;
                 " ",;
                 "This version will expire on "+dtoc(stoj(bliDemDTE())),;
                 " ",;
                 "■ Please contact Ciakware for upgrades.")
endif
*/

stopmenu = ""
IF !FILE("LOCKMENU.SMF")
    WriteFile("LOCKMENU.SMF","; RVM Lock Menu Item")
    WriteFile("LOCKMENU.SMF","; ------------------")
    WriteFile("LOCKMENU.SMF","; You can Lock option menu items putting in this file")
    WriteFile("LOCKMENU.SMF","; the exact menu item title in brackets.")
    WriteFile("LOCKMENU.SMF","; For example, [SCARICO DA RETURNING BOX] disables Rbox.")
ENDIF
IF FILE("LOCKmenu.SMF")
    hdl = FOpen("LOCKmenu.SMF")
    DO WHILE !feof(hdl)
        x = Alltrim(FreadLine(hdl))
        IF LEFT(x,1) = "["
            stopMenu = stopMenu + x
        ENDIF
    ENDDO
    FClose(hdl)
ENDIF


while .T.
    begin sequence
        IF mswversion() <> 0 .AND. !file("NOWINDOW.SMF")
            Reg_AX(5771)                            //168Bh
            Reg_BX(0)
            Interrupt("2F")
        ENDIF
        exitrvm := .f.
        do RVMq with "RVM "+_versione

        if conf_abNET = "S" .and. file("INLINK.DBF")
            while !NET_USE("INLINK",.T.,2)
            enddo
            while !eof()
                if VNET_dsk = "*"
                    PlsWait(.T.,cw("CHECK UNITA` DI RETE ")+alltrim(VNET_pat))
                    if !IsDIR(alltrim(VNET_pat))
                        __Keyboard()
                        MSG(cw("UNITA` DI RETE ")+"["+alltrim(VNET_pat)+"]"+cw("NON COLLEGATA!"))
                    endif
                    PLSWAIT(.F.)
                endif
                dbskip(1)
            enddo
        endif

        setkey(- 35,{| p,l,v | funkeys(p,l,v)})
        if file(ID+"FUN.mem")
            __MRestore((ID+"FUN"),.T.)
            setkey(- 20,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 21,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 22,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 23,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 24,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 25,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 26,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 27,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 28,{| p,l,v | Stuffer(p,l,v)})
            setkey(- 29,{| p,l,v | Stuffer(p,l,v)})
        endif
        setcursor(if(upper("Off") == "ON",1,0))
        dbcloseall()
        if diskspace(curdrive()) < 1500000
            M_data(22,1)
            M_DISPLAY(cw("ATTENZIONE!!! SPAZIO DISCO IN ESAURIMENTO!"),79)
            M_csroff()
        endif

        if forcekey = .F.
            incrXX := iif(LastRow() > 25,8,6)
            CWbox(4,iif(LastRow() > 25,7,5),41,LastRow() - 4,76,cw("SITUAZIONE SISTEMA"))

            if file(id+"EXTRA.smf")
                if NET_USE("RVMmov",.T.,2)
                    IncrXX := IncrXX+1
                    print(IncrXX,42,"■ "+cw("Movimenti     : ")+alltrim(str(lastrec())),79)
                    dbclosearea()
                endif

                if NET_USE("RVMcli",.T.,2)
                    IncrXX := IncrXX+1
                    print(IncrXX,42,"■ "+cw("Clienti       : ")+alltrim(str(lastrec())),79)
                    dbclosearea()
                endif

                if NET_USE("RVMS",.T.,2)
                    IncrXX := IncrXX+1
                    print(IncrXX,42,"■ "+cw("Prodotti      : ")+alltrim(str(lastrec())),79)
                    dbclosearea()
                endif

                if NET_USE("RVMric",.T.,2)
                    IncrXX := IncrXX+1
                    print(IncrXX,42,"■ "+cw("Ricariche     : ")+alltrim(str(lastrec())),79)
                    dbclosearea()
                endif

                if NET_USE("RVMDAYNL",.T.,2)
                    if !file("RVMDAYNL.NTX")
                        dbCreateIndex("RVMDAYNL","dtos(DAYDAT)",{|| dtos(DAYDAT)},if(.F.,.T.,NIL))
                    endif
                    if !.F.
                        ordlistclear()
                    end
                    ordlistadd("RVMDAYNL")
                    dbseek(dtos(date()),if(.F.,.T.,NIL))
                    if found()
                        IncrXX := IncrXX+1
                        print(IncrXX,42,"■ "+cw("Noleggi       : ")+alltrim(str(DAYNOL)),79)
                    endif
                    dbclosearea()
                endif
            endif
            dbcloseall()

            if type("modemstat") = "U"
                modemstat := cw("NON PREVISTO")
                if conf_mod > 0
                    comready  := cw232Init(conf_mod,conf_bau,conf_ini,.T.,.F.,3)
                    modemstat := cw("NON ATTIVO")
                    if comready
                        modemstat := cw("ATTIVO")
                    endif
                endif
            endif

            if conf_mod <> 0
                IncrXX := IncrXX+3
                Print(IncrXX,42,  "≡ Disk          : " + replicate("▒",16),79)
                diskfll = DiskSpace()*16/Disksize()
                Print(IncrXX,60,replicate("█",17-diskfll),iif(diskfll<12,74,198))
                IncrXX ++
                print(IncrXX,42,"≡ Modem (COM"+str(conf_mod,1)+")  : "+modemstat,79)
            endif
            IncrXX := IncrXX+1
            print(IncrXX,42,"≡ "+cw("Risorse Attive: ")+Drivestr(),79,34)

            if ("F" $ Drivestr()) = .T.
                netready := cw("ATTIVA")
            else
                netready := cw("NON ATTIVA")
            endif

            IncrXX := IncrXX+1
            print(IncrXX,42,"≡ "+cw("Rete          : ")+netready,79)

            IncrXX := IncrXX+1
            print(IncrXX,42,"≡ "+cw("Stampante     : ")+iif(isprinter(),cw("ATTIVA"),cw("NON ATTIVA")),79)

            vjrep := ""

            if substr(v_jet,2,1) = "I" .and. onceISVJ
                OnceIsVJ := .f.
                Help25(cw("Controllo Lettore di Tessere in corso"))
                if VJReady()
                    video_jet := cw("ATTIVO")
                else
                    if vjtry .and. ooVJtry
                        video_jet := cw("NON ATTIVO")
                        m_data(22,1)
                        *if m_Query(cw("IL LETTORE DI CARD NON RISPONDE: SI DESIDERA DISABILITARLO"),79)
                        *    MSG(2,cw("PER RIABILITARE IL LETTORE DI CARD, PREMERE [ALT][J]"))
                        *    v_jet   := stuff(v_jet,2,1,"0")
                        *    ooVJtry := .F.
                        *endif
                        vjtry := .F.
                    endif
                endif
            else
                if video_JET <> cw("ATTIVO")
                    video_jet := cw("DISABILITATO")
                endif
            endif

            vjType := TipoLetore

            IncrXX := IncrXX+1
            do case
                case "" $ tipoletore
                    print(IncrXX,42,"≡ "+cw("Nessun Lettore CARD"),79)
                    v_jet := "00"
                case video_JET = cw("DISABILITATO")
                    print(IncrXX,42,"≡ [OFF] "+vjTYPE,79)
                case video_JET = cw("ATTIVO")
                    print(IncrXX,42,"≡ [ON] "+vjTYPE,79)
                case video_JET = cw("NON ATTIVO")
                    print(IncrXX,42,"≡ [#ERR#] "+vjTYPE,79)
            endcase
            IncrXX := IncrXX+1

            /*
            do case
                case date() < ctod("01/01/2000")
                    print(IncrXX,42,"≡ "+cw("Giorni al 2000: ")+alltrim(str(ctod("31/12/1999") - date()+1)),79)
                otherwise
                    print(IncrXX,42,"≡ "+cw("Giorni al 3000: ")+alltrim(str(ctod("31/12/2999") - date()+1)),79)
            endcase
            IncrXX := IncrXX+1
            */

            if type("ORETOTALRV") <> "U"
                print(IncrXX,42,"≡ "+cw("Utilizzo RVM  : ")+alltrim(str(int(oretotalrv / 60)))+"h",79)
            endif
        endif

        dbcloseall()

        /* USE TRM\TRAME
        GOTO 7993
        CWEDIT("TITOLO DI PROVA",DESCRIZ,5,2,20,77,112,8192,100)
        MSG(alfa) */


        today := date()
        __SetFunction(4,dtoc(date()))
        dim := 13

        private aprom[dim]
        private amsg[dim]
        private arows[dim]
        private acolr[DIM]

        IF TYPE("SERVERdsk") <> "U"
            tupd = ADIR(serverdsk+"SOFTWARE\*.*")
            IF tupd <> 0
                PRIVATE updfiles[tupd]
                adir(serverdsk+"SOFTWARE\*.*",updfiles)
                IF FILE("INLINK.DBF")
                    CLOSE DATABASES
                    USE INLINK EXCLUSIVE
                    DO WHILE !EOF()
                        IF !empty(vnet_dsk)
                            vnetpat = Alltrim(vnet_pat)
                            IF FILE(vnetpat+"VBT.MEM")
                                FOR tup = 1 TO tupd
                                    COPYFILE(serverDSK+"SOFTWARE\"+updfiles[tup],vnetpat+updfiles[tup])
                                NEXT
                            ENDIF
                        ENDIF
                        SKIP
                    ENDDO
                    fERASEall(serverDSK+"SOFTWARE\*.*")
                    CLOSE DATABASES
                ENDIF
            ENDIF
        ENDIF
        IF lite
            nolabl = "X"
        ENDIF

        aprom[1] = " "+cw("1. CLIENTI                     ")
        aprom[2] = " "+cw("2. PRODOTTI                    ")
        aprom[3] = " "+cw("3. NOLEGGIO INTERNO            ")
        aprom[4] = iif(NOLABL <> "B","","")+" "+cw("4. GESTIONE DISTRIBUTORE       ")
        aprom[5] = iif(lite,"","")+" "+cw("5. GESTIONE SATELLITI          ")
        aprom[6] = " "+cw("6. MANUTENZIONE ARCHIVI        ")
        aprom[7] = iif(lite,"","")+" "+cw("7. STATISTICHE/STAMPE/POSTA    ")
        aprom[8] = " "+cw("8. MODULI ESTERNI/CENTRO DATI  ")
        aprom[9] = " "+cw("9. CONFIGURAZIONI              ")
        aprom[10] =" "+ cw("0. VENDITA DA BANCO            ")
        aprom[11] = iif (nolabl <> "B","","")+" "+cw("V. LINK DISTRIBUTORE           ")
        aprom[12] =iif(lite,"","")+" "+cw("R. LINK RVM                    ")
        aprom[13] = " "+cw("T. TERMINA OPERAZIONI          ")

        amsg[1] = cw("Gestione Clienti")
        amsg[2] = cw("Gestione Prodotti")
        amsg[3] = cw("Gestione Noleggio / Tessere Magnetiche")
        amsg[4] = cw("Gestione Robot")
        amsg[5] = cw("Gestione Videoteche Remote")
        amsg[6] = cw("Riorganizzazione Archivi")
        amsg[7] = cw("Generazione di Rapporti e Stampe")
        amsg[8] = cw("TeleAssistenza/Posta Elettronica/Centro Dati Ciakware")
        amsg[9] = cw("Configurazione Sistema")
        amsg[10] = cw("Gestione Prodotti da Vendita")
        amsg[11] = cw("Collegamento Diretto Robot (RETE)")
        amsg[12] = cw("Collegamento Telematico Postazione RVM")
        amsg[13] = cw("Termina la Sessione")

        incrXX := iif(LastRow() > 25,8,6)
        arows[1] = IncrXX+1
        arows[2] = IncrXX+2
        arows[3] = IncrXX+3
        arows[4] = IncrXX+4
        arows[5] = IncrXX+5
        arows[6] = IncrXX+6
        arows[7] = IncrXX+7
        arows[8] = IncrXX+8
        arows[9] = IncrXX+9
        arows[10] = IncrXX+10
        arows[11] = IncrXX+11
        arows[12] = IncrXX+12
        arows[13] = IncrXX+14

        for I := 1 to 13
            acolr[i] = 3
        next

        Active := 1
        except := .F.

        if conf_sound = .T.
            Warble(1)
        endif
        setcolor("N/G")

        CWBox(2,iif(LastRow() > 25,7,5),2,LastRow() - 4,37,cw("MENU` PRINCIPALE"))

        m_Data(3,1)
        while .T.
            if type("OLDPICK") = "U"
                oldpick := 1
            endif
            if oldpick < 1 .or. oldpick > 12
                oldpick := 1
            endif
            // Help25(srvstr)

            // CsrPut(5,3)
            set cursor on
            set cursor OFF
            SETattrib("v",42)
            setkey(- 31,{| p,l,v | MOVTESS(p,l,v)})
            setkey(- 39,{| p,l,v | AutoDial(p,l,v)})
            setkey(- 37,{| p,l,v | blank(p,l,v)})
            setkey(- 36,{| p,l,v | go_print(p,l,v)})
            set key 276 to ddcard
            set key 272 to comandline
            Help25("")
            print(lastrow() - 1,0,replicate("─",80),16)

            menuHis = ""
            cwhelp = "0.0.0.0.0"
            pick := M_prompt(EXCEPT,oldpick,arows,acolr,aprom,32,amsg,LastRow() - 2,25)

            SETattrib("v",120)
            set key - 31 to
            set key - 39 to
            set key - 37 to
            set key - 36 to
            set key 276 to
            set key 272 to
            M_csroff()
            CsrPut(0,0)
            forcekey := .F.
            if pick = 0
                loop
            endif
            exit
        enddo

        scelta  := pick
        oldpick := pick
        menuHis = RIGHT(Dec2Hex(scelta),1) // Hex, 10=A

        do case

            case scelta == 13 .or. scelta = - 1
                M_Data(22,1)
                sn := M_Query(cw("DESIDERI TERMINARE"),96)
                if sn
                    if conf_sound = .T.
                        Csroff()
                        Warble(1)
                        Csron()
                    endif
                    exitRVM := .t.
                    break
                endif

            case scelta == 12
                do rvmlink

            case scelta == 1
                // DO RVMq WITH cw("Gestione Clienti")
                do RVMcli
            case scelta = 2
                // DO RVMq WITH cw("Gestione VHS")
                do RVMs
            case scelta == 3
                do RVMq with cw("Gestione Noleggio")

                do RVMmvc
            case scelta == 4
                do RVMq with cw("Gestione Videobank")
                if nolabl = "B"
                    do vb
                endif
            case scelta == 5
                do RVMq with cw("Non Abilitato")
                if nolsat <> "    "
                    do RVMsat
                endif
            case scelta == 6
                do RVMq with cw("Archivi")
                do RVMbuk
            case scelta == 7
                do RVMq with cw("Statistiche")
                do RVMSTATS

            case scelta == 8
                do RVMq with cw("Collegamenti")
                do linkers

            case scelta == 9
                do RVMq with cw("Configurazione")
                do config

            case scelta == 10
                do RVMq with cw("Vendita Banco")
                do banco

            case scelta == 11
                do RVMq with cw("VLink")
                do vnetwork

        endcase
        do RVMq with ("Versione ")+_versione

    end
    dbcloseall()
    if ExitRVM
        exit
    endif
enddo

if conf_abBCK = "N" .and. right(time(),1) = "0"
    MSG(cw("ATTENZIONE!"),;
          "────────────────────────────────────────────────────────────────",;
          cw("L'opzione di Backup di fine sessione è attualmente DISABILITATA."),;
          cw("Sei invitato a prendere in considerazione di abilitarla periodi-"),;
          cw("camente, al fine di poter recuperare i dati degli archivi in ca-"),;
          cw("so di problemi. Per poterla riabilitare, portarsi sui menù 9-0-1"))
endif

// IF FILE("RVMZIP.exe")
if conf_abBCK $ "AS"
    beep()
    bkzip := "!"+left(cdow(date()),3)+".ZIP"
    if conf_abBCK = "A"
        __Keyboard(chr(13)+chr(13)+chr(13))
    endif

    /* Le copie di sicurezza sono custodite nella directory:
             "BACKUP\"+Str(Dow(Date()),1)
          */

    if M_query(cw("DESIDERI EFFETTUARE LA COPIA DI SICUREZZA?"),96)
        M_csroff()
        plswait(.T.,cw("GENERAZIONE COPIA DI SICUREZZA IN CORSO"))
        M_csroff()
        totfiles  := FileScan("*.DB*;*.CFG;*.NTX;*.RGS;*.MEM;*.KEY")
        bblock    := {| filename,fullname | BBFun(FileName,FullName)}
        countfile := 0
        backupdir := "BACKUP\"+str(dow(date()),1)+"\"
        IF !IsDir(backupDIR+"VB")
            MkDir(backupDIR+"VB")
        ENDIF
        backupVCS := backupDIR+"VB\"
        ferase(backupdir+"CONTROL.CKW")
        WriteFile(backupDIR+"CONTROL.CKW",cdow(date())+", "+dtoc(date())+"; "+time())
        ProgON(cw("RVM BACKUP"))
        FileScan("*.DB*;*.CFG;*.NTX;*.RGS;*.MEM;*.KEY",,bblock)
        ProgOff()
        help25(cw("Copia in corso archivi di sistema sul server"))
        IF FILE(serverDSK+"VCS.DBF")
            COPYFILE(serverDSK+"VCS.dbf",backupVCS+"VCS.DBF")
            COPYFILE(serverDSK+"VCSTRAME.dbf",backupVCS+"VCSTRAME.DBF")
            COPYFILE(serverDSK+"VCSTRAME.dbT",backupVCS+"VCSTRAME.DBT")
        ENDIF
        CLOSE DATABASES
        IF FILE("INLINK.DBF")
            IF NET_USE("INLINK",.t.,5)
                DO WHILE !EOF()
                    vnetpat = alltrim(Vnet_PAT)
                    est = RIGHT(vnet_num,3)
                    IF FILE(vnetpat+"POS.TXT")
                        COPYFILE(vnetpat+"POS.TXT",backupVCS+"POS."+est)
                    ENDIF
                    IF FILE(vnetpat+"PARAM.TXT")
                        COPYFILE(vnetpat+"PARAM.TXT",backupVCS+"PARAM."+est)
                    ENDIF
                    IF FILE(vnetpat+"POSIZION.DAT")
                        COPYFILE(vnetpat+"POSIZION.DAT",backupVCS+"POSIZION."+est)
                    ENDIF
                    IF FILE(vnetpat+"POSIZCD.DAT")
                        COPYFILE(vnetpat+"POSIZCD.DAT",backupVCS+"POSIZCD."+est)
                    ENDIF
                    IF FILE(vnetpat+"VDA.EXE")
                        COPYFILE(vnetpat+"VDA.EXE",backupVCS+"VDA."+est)
                    ENDIF
                    IF FILE(vnetpat+"VBT.MEM")
                        COPYFILE(vnetpat+"VBT.MEM",backupVCS+"VBT."+est)
                    ENDIF
                    IF FILE(vnetpat+"KSTATUS.MEM")
                        COPYFILE(vnetpat+"KSTATUS.MEM",backupVCS+"KSTATUS."+est)
                    ENDIF
                    IF FILE(vnetpat+"VCSS.DBF")
                        COPYFILE(vnetpat+"VCSS.DBF",backupVCS+"VCSS."+est)
                    ENDIF
                    SKIP
                enddo
            ENDIF
        ENDIF
        close databases
        CsrOff()
        plswait(.F.)
        *if SwpErrLev() <> 0
        *    if MessYN(cw("SI E` VERIFICATO UN ERRORE DURANTE IL SALVATAGGIO DEI DATI")," "+CW("DETTAGLI")+" "," "+cw("OK")+" ")
        *        m_title(cw("VISUALIZZAZIONE REGISTRO ERRORI"))
        *        m_View(5,1,LastRow() - 3,78,"backup.LOG",48)
        *    endif
        *else

            M_display(cw("COPIA DI SICUREZZA COMPLETATA CON SUCCESSO:"),112)
            M_csroff()
            if file("BACK.COM")
                M_Data(22,1)
                M_MESSAGE(cw("COPIA SU DISCHETTO"),78)
                sn    := M_Query(cw("DESIDERI TRASFERIRE IL BACKUP SU DISCHETTI"),32)
                PIPPO := savescreen(0,0,LastRow(),maxcol())
                setcolor("")
                scroll()
                setpos(0,0)
                ReadKill(.T.)
                GetList := {}
                if sn
                    SwpRunCmd("BACK "+"BACKUP\"+str(dow(date()),1)+"\*.* A:",0,"","") // RIMETTERE *.* !!!
                endif
                restscreen(0,0,LastRow(),maxcol(),PIPPO)
            else
                M_Display(cw("UTILIZZARE LE PROCEDURE DOS PER CREARE LA COPIA"),78)
                M_CsrOff()
            endif
    endif
endif
/* ELSE
   M_display(cw("Attenzione! Manca il file RVMZIP.exe!!!"),78)
   M_display(cw("Impossibile Generare COPIA DI SICUREZZA"),78)
   M_csroff()
ENDIF
*/

M_csroff()

setcolor("")
hotkeys(0)
scroll()
setpos(0,0)
ReadKill(.T.)
GetList := {}
CAPSLOCK(.F.)
Writefile(ID+"_LOG.OUT","OK")
Flreset()
dbcloseall()
dbcloseall()
dbselectarea("1")
__SetFormat(NIL)
Border(0)
VidReset()
BlinkBit(.t.)

IF FILE("QUOTES.DBF")
    USE QUOTES EXCLUSIVE
    tot = LastREC()
    DO WHILE .T.
        rec := Random()
        if rec <= tot
            goto rec
             FOR i = 1 to 10
                 II = alltrim(str(i))
                 ? Linea&ii
             NEXT
             exit
        endif
    enddo
    USE
ENDIF


return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure FunKeys()
*+
*+    Called from ( RVM.prg      )   1 - procedure main()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure FunKeys

set key - 35 to
private Fu2
private Fu3
private Fu4
private Fu5
private Fu6
private Fu7
private Fu8
private Fu9
private Fu0
private i
private ii

for i := 0 to 9
    ii     := str(i,1)
    iid    := ii+"d"
    Fu&ii  := space(10)
    Fu&iid := space(15)
next

if !file(ID+"FUN.mem")
    save to (ID+"FUN") all like fu*
endif

RESTORE from (ID+"FUN") additive
for i := 0 to 9
    ii     := str(i,1)
    iid    := ii+"d"
    Fu&iid := pad(fu&iid,15)
next
boxfun := MakeBox(5,20,19,56)
@  5,22 say("[HOTKEYS]")
@  6,22 say cw("Tasto             Descriz")
@  7,22 say("cF2:")                         get Fu2   pict "@!"
@  7,40 get Fu2d                            pict "@!"
@  8,22 say("cF3:")                         get Fu3   pict "@!"
@  8,40 get Fu3d                            pict "@!"
@  9,22 say("cF4:")                         get Fu4   pict "@!"
@  9,40 get Fu4d                            pict "@!"
@ 10,22 say("cF5:")                         get Fu5   pict "@!"
@ 10,40 get Fu5d                            pict "@!"
@ 11,22 say("cF6:")                         get Fu6   pict "@!"
@ 11,40 get Fu6d                            pict "@!"
@ 12,22 say("cF7:")                         get Fu7   pict "@!"
@ 12,40 get Fu7d                            pict "@!"
@ 13,22 say("cF8:")                         get Fu8   pict "@!"
@ 13,40 get Fu8d                            pict "@!"
@ 14,22 say("cF9:")                         get Fu9   pict "@!"
@ 14,40 get Fu9d                            pict "@!"
@ 15,22 say("cF0:")                         get Fu0   pict "@!"
@ 15,40 get Fu0d                            pict "@!"
@ 17,22 say " * = [ESC]"
@ 18,22 say " + = [ENTER]"
CsrOn()
read
CsrOff()
UNBOX(boxfun)
save to (ID+"FUN") all like Fu*
set key - 20 to Stuffer
set key - 21 to Stuffer
set key - 22 to Stuffer
set key - 23 to Stuffer
set key - 24 to Stuffer
set key - 25 to Stuffer
set key - 26 to Stuffer
set key - 27 to Stuffer
set key - 28 to Stuffer
set key - 29 to Stuffer
set key - 35 to funkeys
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure Stuffer()
*+
*+    Called from ( RVM.prg      )  10 - procedure main()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure Stuffer

m_Squeak()
RESTORE from (ID+"FUN") additive
forcekey := .t.
keyb     := lastkey()
fill_esc := replicate(chr(27),8)
do case
    case keyb = - 20
        forcekey := .f.
        StrStuff(fill_esc)
    case keyb = - 21
        Fu2 := XEsc(Fu2)
        StrStuff(fill_esc+left(Fu2,1)+alltrim(fu2))
    case keyb = - 22
        Fu3 := XEsc(Fu3)
        StrStuff(fill_esc+left(Fu3,1)+alltrim(fu3))
    case keyb = - 23
        Fu4 := XEsc(Fu4)
        StrStuff(fill_esc+left(Fu4,1)+alltrim(fu4))
    case keyb = - 24
        Fu4 := XEsc(Fu4)
        StrStuff(fill_esc+left(Fu5,1)+alltrim(fu5))
    case keyb = - 25
        Fu6 := XEsc(Fu6)
        StrStuff(fill_esc+left(Fu6,1)+alltrim(fu6))
    case keyb = - 26
        Fu7 := XEsc(Fu7)
        StrStuff(fill_esc+left(Fu7,1)+alltrim(fu7))
    case keyb = - 27
        Fu8 := XEsc(Fu8)
        StrStuff(fill_esc+left(Fu8,1)+alltrim(fu8))
    case keyb = - 28
        Fu9 := XEsc(Fu9)
        StrStuff(fill_esc+left(Fu9,1)+alltrim(fu9))
    case keyb = - 29
        Fu0 := XEsc(Fu0)
        StrStuff(fill_esc+left(Fu0,1)+alltrim(fu0))
endcase
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Function XEsc()
*+
*+    Called from ( RVM.prg      )   9 - procedure stuffer()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
function XEsc

parameter fux
private fux_
private cnt
fux_ := ""
for cnt := 1 to len(fux)
    do case
        case substr(fux,cnt,1) = "*"
            fux_ := fux_+chr(27)
        case substr(fux,cnt,1) = "+"
            fux_ := fux_+chr(13)
        otherwise
            fux_ := fux_+substr(fux,cnt,1)
    endcase
next
return fux_

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure RetMaster()
*+
*+    Called from ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure RetMaster

StrStuff(replicate(chr(27),8))
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure OverMan()
*+
*+    Called from ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure OverMan

MSG("Overlay Cache Location    :"+alltrim(str(BliMgrSts(1))),;
    "Overlay Cache Size        :"+alltrim(str(BliMgrSts(2))),;
    "Extended Memory Available :"+alltrim(str(BliMgrSts(3))),;
    "Extender Host Mode        :"+alltrim(str(BliMgrSts(4))),;
    "Extender Machine Mode     :"+alltrim(str(BliMgrSts(5))),;
    "Overlay Area Location     :"+alltrim(str(BliMgrSts(6))),;
    "Overlay Area Size         :"+alltrim(str(BliMgrSts(7))),;
    "Real Memory Available     :"+alltrim(str(BliMgrSts(8))),;
    "Virtual Memory Available  :"+alltrim(str(BliMemAvl(9))),;
    "#ROM Serial Number        :",bliSerNum(),;
    "Estimated Free Chr Memory :" + alltrim(str(MEMORY(  0)*1024)),;
    "Largest String Object     :" + alltrim(str(MEMORY(  1)*1024)),;
    "Free Run Memory           :" + alltrim(str(MEMORY(  2)*1024)),;
    "Unused Conventional Memory:" + alltrim(str(MEMORY(104)*1024)),;
    "Available EMS             :" + alltrim(str(MEMORY(  4)*1024)),;
    "Free Memory for Swapping  :" + alltrim(str(MEMORY(0)*1024+MEMORY(103)*1024)),;
    "Fixed Heap-Size           :" + alltrim(str(MEMORY(101)*1024)),;
    "Segments in Fixed Heap    :" + alltrim(str(MEMORY(102)*1024)),;
    "Size of SVOS Memory       :" + alltrim(str(MEMORY(  3)*1024)),;
    "SVOS for Strings & Arrs   :" + alltrim(str(MEMORY( -1)*1024)))


return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+
*+    Called from ( backup.prg   )  18 -
*+                ( banco.prg    )  58 -
*+                                   1 - function barcode()
*+                ( blackbox.prg )  12 - procedure showbart()
*+                ( bldidx.prg   )  29 - procedure view_ret()
*+                ( boom.prg     )  22 - procedure view_ret()
*+                ( calcolo.prg  )   3 - function calcfeec()
*+                                   2 - function calcfeet()
*+                ( cardman.prg  )   3 - function rdcrd()
*+                                   2 - procedure crback()
*+                                   5 - function wrcrd()
*+                ( case_pr.prg  )   4 - function runcrdman()
*+                ( chcidx.prg   )   6 - function runcrdman()
*+                ( chkvbr.prg   )   2 - function runcrdman()
*+                ( comm.prg     ) 143 - procedure clear_gets()
*+                ( config.prg   ) 127 - procedure starttx()
*+                ( con_vhs.prg  )  10 - procedure convhs()
*+                ( cw.prg       ) 374 - function bin2dec()
*+                ( cwserver.prg )  78 - procedure font35()
*+                                   3 - function easyserver()
*+                                  20 - function callserver()
*+                ( data_c.prg   )  11 - function gsmsend()
*+                ( db_cli.prg   )   4 - function pee()
*+                ( db_vcs.prg   )   1 - function pee()
*+                ( draw_bar.prg )   5 - function funbrowse()
*+                ( edit_cli.prg )  23 - function funbrowse()
*+                ( edit_tit.prg )   1 - function funbrowse()
*+                ( events.prg   )   1 - procedure xmas()
*+                ( format.prg   )   2 - procedure aggrvmtr()
*+                ( get11.prg    )   2 - function myfuncchk()
*+                ( RVM.prg      ) 137 - procedure main()
*+                                   2 - procedure funkeys()
*+                                   2 - procedure kbuffer()
*+                                   1 - procedure vbuffer()
*+                                   2 - procedure altj()
*+                                   2 - function bbfun()
*+                ( RVM2.prg     )  56 - procedure plancton()
*+                ( RVMazp.prg   )  40 - procedure plancton()
*+                                   2 - function ctrlreturn()
*+                ( RVMbuk.prg   )   1 - function ctrlreturn()
*+                ( RVMcli.prg   ) 113 - function ctrlreturn()
*+                                  23 - procedure movtess()
*+                                   3 - function sendclivb()
*+                ( RVMele.prg   )  18 - function sendclivb()
*+                ( RVMesc.prg   )  35 - function sendclivb()
*+                ( RVMinc.prg   )  21 - function sendclivb()
*+                ( RVMmov.prg   )  66 - function sendclivb()
*+                                   2 - function listavisti()
*+                                   8 - procedure fastric()
*+                ( RVMmvc.prg   )  22 - function menuext()
*+                ( RVMmvis.prg  )   9 - function menuext()
*+                ( RVMq.prg     )   1 - procedure dbdisp()
*+                ( RVMs.prg     )  38 - procedure dbdisp()
*+                ( RVMs11.prg   )  10 - procedure dbdisp()
*+                                   2 - procedure tramap()
*+                                   5 - function sendvbvhs()
*+                                  20 - procedure tastof2()
*+                ( RVMs12.prg   )  27 - procedure tastof2()
*+                ( RVMsat.prg   )   7 - procedure tastof2()
*+                ( RVMsat1.prg  )   2 - procedure tastof2()
*+                ( RVMsat2.prg  )   2 - procedure tastof2()
*+                ( RVMsat4.prg  )  69 - procedure tastof2()
*+                ( RVMsch.prg   )  33 - procedure tastof2()
*+                ( RVMsld.prg   )  45 - procedure tastof2()
*+                                   1 - procedure listates()
*+                ( RVMtab.prg   )  67 - procedure listates()
*+                ( RVMtit.prg   )   1 - procedure RVMmem()
*+                ( RVMvcs.prg   )   1 - function loopcom1()
*+                ( hitfilm.prg  )   1 - function loopcom1()
*+                                  12 - procedure alltitle()
*+                ( int25.prg    )   7 - procedure alltitle()
*+                ( in_tit.prg   )   8 - procedure alltitle()
*+                ( linkers.prg  )  92 - procedure alltitle()
*+                ( note11.prg   )   1 - function sendmodem()
*+                ( open11.prg   )   9 - function sendmodem()
*+                ( open12.prg   )   3 - function sendmodem()
*+                ( panic.prg    )   1 - function sendmodem()
*+                ( printall.prg )   9 - function sendmodem()
*+                ( restore.prg  )  30 - function sendmodem()
*+                ( rvmcheck.prg )  10 - function sendmodem()
*+                ( rvmfail.prg  )   4 - function db_error()
*+                                   3 - function open_error()
*+                                   1 - function print_error()
*+                                   4 - function prr()
*+                ( rvmfun.prg   )   1 - function makemenu()
*+                                   1 - function plswait()
*+                                   6 - function bccd()
*+                                   6 - function bccdi()
*+                                   3 - function brow()
*+                                   1 - function rlist()
*+                                   3 - function stlin()
*+                                   4 - function sttlin()
*+                                   4 - procedure crepa()
*+                                  14 - procedure ciclablu()
*+                                  15 - function m_prompt1()
*+                                   2 - function password()
*+                                   5 - procedure go_print()
*+                                   1 - function show_bin()
*+                                   4 - function sendvb()
*+                                   3 - function recvvb()
*+                                   2 - function sendvhsvb()
*+                                   3 - function recvmsgvb()
*+                                   1 - function sndwhichvb()
*+                                   6 - function sndvb_rbox()
*+                                   1 - function whatvhs()
*+                                   1 - function get_finfo()
*+                                   2 - procedure calendario()
*+                                   2 - function hhelp()
*+                                   2 - function stampasu()
*+                                   1 - function popex()
*+                                   1 - function smalls11()
*+                                   8 - function m_dbfview()
*+                ( rvmfun2.prg  )   3 - function key_read()
*+                                   5 - procedure autodial()
*+                                   3 - function key_error()
*+                                   2 - function cw232init()
*+                                   1 - function cw232dial()
*+                                   5 - function cw232zmod()
*+                                   7 - function sendprogress()
*+                                   1 - function one_read()
*+                                   6 - function cwdbf()
*+                                   1 - function abort()
*+                                  12 - function filtcli()
*+                                  12 - function filtvhs()
*+                ( rvmlink.prg  )  39 - function filtvhs()
*+                                  29 - procedure processarx()
*+                ( rvmlist.prg  )   7 - procedure processarx()
*+                                   2 - procedure prepara()
*+                ( rvmstats.prg )  58 - function writfile()
*+                ( say25.prg    )   2 - function writfile()
*+                ( scse.prg     )   1 - function writfile()
*+                ( soca.prg     )   4 - function cwfontload()
*+                ( sope.prg     )   8 - function cwfontload()
*+                ( tab11.prg    )  24 - static function makemydbf()
*+                ( tempcard.prg )   4 - static function makemydbf()
*+                ( tot25.prg    )   2 - static function makemydbf()
*+                ( update.prg   )  38 - static function makemydbf()
*+                ( vb.prg       )  47 - static function makemydbf()
*+                                  32 - procedure vbstatss()
*+                                   7 - procedure mdin()
*+                                   1 - function gened()
*+                ( vbcli.prg    )  28 - function editmemo1()
*+                                   3 - function idisk()
*+                ( vbmov.prg    )  83 - function idisk()
*+                ( vbst.prg     )  35 - function idisk()
*+                                   1 - function vbdisp()
*+                ( vbsv.prg     )   4 - function vbdisp()
*+                ( vbtar.prg    )  30 - function vbdisp()
*+                ( vbvcs.prg    )  29 - function vbdisp()
*+                ( vb_cli.prg   )   1 - function vbdisp()
*+                ( vnetcli.prg  )   4 - function vbdisp()
*+                ( vnetvhs.prg  )  57 - function vbdisp()
*+                ( vnetwork.prg )  76 - function vbdisp()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
FUNCTION cw
parameter cwstring
return cwstring
IF !extlang
    RETURN cwstring
ENDIF
IF LEN(cwstring) < 2
    RETURN cwstring
ENDIF
IF EMPTY(cwstring)
    RETURN cwstring
ENDIF
IF EMPTY(extfile)
    RETURN cwstring
ENDIF
cwstring1 = chr(34)+cwstring+chr(34)
*cwstring1 = chr(34)+alltrim(cwstring) // +chr(34)
hh = FOpen(extfile)
IF FLocate(hh,cwstring1) < 1
    FClose(hh)
    IF FILE("ADDLNG.SMF")
        TONE(1000,.1)
        WriteFile(extfile,cwstring1+","+cwstring1)
    ENDIF
    RETURN cwstring
ENDIF
cwstring = StrExtract(FReadLine(hh),["],4)
FClose(hh)
*msg(cwstring)
RETURN cwstring

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure KBUFFER()
*+
*+    Called from ( RVM.prg      )   2 - procedure kbuffer()
*+                ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure KBUFFER

setkey(304,NIL)
private tasto
private xpos
private ypos
private oldpos
private xstart
private ystart
private i
kbh := savescreen(LastRow(),0,LastRow(),80)
Help25(cw("Posizionare il cursore ad inizio carattere e premere [INVIO] │ [ESC] Annulla"))
xpos     := row()
ypos     := col()
oldxpos  := 0
oldypos  := 0
oldpos   := GetAttr(xpos,ypos)
FSCREEN1 := savescreen(0,0,LastRow(),maxcol())
m_csroff()
SetAttr(xpos,ypos,xpos,ypos,15+127)
while .T.
    tasto := inkey(0)
    do case
        case tasto = 13
            Help25(cw("Posizionare il cursore a fine stringa e premere [INVIO] │ [ESC] Annulla"))
            xstart := xpos
            ystart := ypos
            while .T.
                tasto := inkey(0)
                do case
                    case tasto = 13
                        keypaste := ""

                        for i := xstart to xpos
                            keypaste := keypaste+ReadScreen(i,ystart,ypos - ystart+1)
                        next

                        restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
                        setkey(304,{| p,l,v | kbuffer(p,l,v)})
                        restscreen(LastRow(),0,LastRow(),80,kbh)
                        print(3,30,"[CLP]",23)
                        return

                    case tasto = 27
                        restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
                        exit
                    case tasto = 4
                        ypos := ypos+1
                        SetAttr(xstart,ystart,xpos,ypos,15+127)
                    case tasto = 24
                        xpos := xpos+1
                        SetAttr(xstart,ystart,xpos,ypos,15+127)

                endcase
            enddo

        case tasto = 27
            restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
            restscreen(LastRow(),0,LastRow(),80,kbh)
            setkey(304,{| p,l,v | kbuffer(p,l,v)})
            return
        case tasto = 24 .and. xpos < LastRow()
            restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
            xpos := xpos+1
            SetAttr(xpos,ypos,xpos,ypos,15+127)
        case tasto = 5 .and. xpos >= 1
            restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
            xpos --
            SetAttr(xpos,ypos,xpos,ypos,15+127)
        case tasto = 4 .and. ypos < 79
            restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
            ypos := ypos+1
            SetAttr(xpos,ypos,xpos,ypos,15+127)
        case tasto = 19 .and. ypos > 0
            restscreen(0,0,LastRow(),maxcol(),FSCREEN1)
            ypos --
            SetAttr(xpos,ypos,xpos,ypos,15+127)
    endcase
enddo

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Function FBuffer()
*+
*+    Called from ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
function FBuffer

__Keyboard(keypaste)
return .T.

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure Vbuffer()
*+
*+    Called from ( RVM.prg      )   1 - procedure vbuffer()
*+                ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure Vbuffer

setkey(303,NIL)
mmbox := MakeBox(5,10,21,70)
print(5,10,"[ "+CW("VISUALIZZAZIONE CLIPBOARD")+" ]")
memoedit(keypaste,6,11,20,69,.F.)
Unbox(mmbox)
CsrOff()
setkey(303,{| p,l,v | VBuffer(p,l,v)})
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure ALTm()
*+
*+    Called from ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure ALTm

if type("CODICE") <> "U"
    tone(2500,.3)
    keypaste := CODICE
endif
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure ALTj()
*+
*+    Called from ( RVM.prg      )   1 - procedure altj()
*+                ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure ALTj

setkey(292,NIL)
if right(V_jet,1) = "I"
    v_Jet := stuff(v_jet,2,1,"0")
    MSG(1,cw("LETTORE CARD DISABILITATO"))
else
    v_Jet := stuff(v_jet,2,1,"I")
    MSG(1,cw("LETTORE CARD ABILITATO"))
endif
setkey(292,{| p,l,v | ALTj(p,l,v)})
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Procedure Stuff42()
*+
*+    Called from ( RVM2.prg     )   1 - procedure plancton()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
procedure Stuff42

__Keyboard("■")
return

*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
*+    Function BbFUN()
*+
*+    Called from ( RVM.prg      )   1 - procedure main()
*+
*+▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
*+
function BbFUN(filename,fullname)

countfile := countfile+1
ProgDISP(countfile,totfiles,{ ||cw("Backup in corso di")+" "+filename })
if inkey() = 27
    return 0
endif
result := FCompress(filename,"BACKUP\"+str(dow(date()),1)+"\"+filename)
if result < 0
    Help25(cw("Errore nella compressione di")+" "+filename+" #"+alltrim(str(result)),1)
endif
return 1

*+ EOF: RVM.PRG