program listino_magazzino;{ genera un file ascii contenente le informazioni
  da spedire all'host per il programma di magazzino o listino}

{$define strc}
{define too4g2}
{define shortname}
uses crt,dos,epson,strdef,too5b,too5s{$ifdef too4g2}, too5g2 {$endif},conf2,printer,lpt;

CONST
  maxtab=10;
  stlen=30;

TYPE
    str4=string[4];
  strc=string[stlen];

  tab=array[1..maxtab] of strc;

{$ifndef too4g2}
  charset=set of char; {serve in too4proc}
{$endif}


VAR
  st,name,st_name,outname                 :string;
  color                                 :text;
  t_list,t_filin,
  t_conf,t_prezzo,t_sconto,t_txt3,
  t_txt,t_txt2,t_um,t_iva,t_campo       :tab;
  tasto                                 :char;
  closechar                             :integer;{carattere che serve pper chiudere il record attuale}
  common,                             {parte standard codice articolo}
  descr,um,merc,iva,peso                :strc;

  code,lis,pconf                            :integer;
  confile                               :file of tab;

{C-,I-,K-}
{$ifndef too4g2}
{$I unitool}
{$endif}

procedure azz(var tabel:tab);
var y:integer;
begin{ azzera la tabella di input}
  for y:=1 to maxtab do
    tabel[y]:='';
end;


procedure loadtab(nameftab:string;maga:boolean);{carica le tabelle esistenti nel file }
var config                       :file of tab;
    mix                          :tab;
begin
  menu(1,'L O A D  I N G . . . . .');
  azz(mix);
  assign(config,nameftab);
  reset(config);
  seek(config,0);
  if not(eof(config)) then begin
    read(config,t_list);
    if maga then
      writexy(10,5,'Caricata tabella GRUPPI MERCEOLOGICI')
    else
      writexy(10,6,'Caricata tabella LISTINI');
    if not(eof(config)) then begin
      read(config,t_conf);
      writexy(10,7,'Caricata tabella CONFEZIONI');
      if not(eof(config)) then begin
        read(config,t_prezzo);

        writexy(10,8,'Caricata tabella PREZZI');
        if not(eof(config)) then begin
          read(config,t_sconto);
          if maga then
            writexy(10,9,'Caricata tabella PROVVIGIONI')
          else
            writexy(10,10,'Caricata tabella SCONTI');

          if not(eof(config)) then begin

            read(config,mix);
            common:=mix[1];
            writexy(10,11,'Caricata parte standard cod.art.');


            outname:=mix[2];
            writexy(10,12,'Caricato nome file di uscita.');
            read(config,t_filin);
            writexy(10,13,'Caricata tabella nomi file colori ');
            if not(eof(config)) and maga then begin
              read(config,t_txt);
              writexy(10,14,'Caricata tabella Descrizioni 1 ');
              read(config,t_txt2);
              writexy(53,14,'e 2 ');
              read(config,t_um);
              writexy(10,15,'Caricata tabella unit… di misura ');
              read(config,t_iva);
              writexy(10,16,'Caricata tabella I.V.A. ');
              if not(eof(config)) and maga then begin
                read(config,t_campo);
                writexy(10,17,'Caricata tabella Campi ');
                read(config,t_txt3);
                writexy(10,18,'Caricata tabella Descrizioni Campi ');


              end;
            end;
          end;
        end;
      end;
    end;
  end;
  close(config);
  message2('Premere un tasto.',1,0);
end;

procedure savetab(nameftab:string;maga:boolean);{Salve le tabelle nel file name}
var config                       :file of tab;
    mix                          :tab;
begin
  menu(1,'S A V I N G . . . . .');

  assign(config,nameftab);
  rewrite(config);
  write(config,t_list);
  if maga then
    writexy(10,5,'Salvata tabella GRUPPI MERCEOLOGICI')
  else
    writexy(10,6,'Salvata tabella LISTINI');

  write(config,t_conf);
  writexy(10,7,'Salvata tabella CONFEZIONI');

  write(config,t_prezzo);
  writexy(10,8,'Salvata tabella PREZZI');

  write(config,t_sconto);
  if maga then
    writexy(10,9,'Salvata tabella PROVVIGIONI')
  else
    writexy(10,10,'Salvata tabella SCONTI');
  azz(mix);
  mix[1]:=common;
  writexy(10,11,'Salvata parte standard cod.art.');

  mix[2]:=outname;
  writexy(10,12,'Salvato nome file di uscita.');

  write(config,mix);

  write(config,t_filin);
  writexy(10,13,'Salvata tabella nomi file colori ');
  if maga then begin
    write(config,t_txt);
    writexy(10,14,'Salvato tabella Descrizioni 1 ');
    write(config,t_txt2);
    writexy(53,14,'e 2 ');
    write(config,t_um);
    writexy(10,15,'Salvato tabella unit… di misura ');
    write(config,t_iva);
    writexy(10,16,'Salvato tabella I.V.A. ');
    write(config,t_campo);
    writexy(10,17,'Salvato tabella Campi ');
    write(config,t_txt3);
    writexy(10,18,'Salvato tabella Descrizioni Campi ');
  end;
  close(config);
  message2('Premere un tasto.',1,0);
end;

procedure get_tab(tex:str80;var t:tab);
var code,p:integer;
    st:strc;
begin
  p:=1;
  repeat
    code:=3;
    st:=t[p];
    get_str(10,p+3,stlen,tex+sts(p)+' : ',st,code);
    t[p]:=st;

    if (code=3) and (p>1) then
       p:=p-1
    else begin
      p:=p+1;

      if (t[p]='') and (p>1) then
        t[p]:=t[p-1];
    end;
  until (t[p]='') or (p=maxtab+1);
end;


procedure listino;

procedure buildfilelistino(namein,nameout:string);
var
  infile,outfile                      :text;
  buffin,buffout,help                      :str80;
  run:char;
  main,ch:char;

begin
  run:='s';
  buffin:='';
  buffout:='';
  assign(infile,namein);
  assign(outfile,nameout);
  rewrite(outfile);
  lis:=1;


  while (t_list[lis]<>'')  do begin
    reset(infile);
    ch:='N';
    run:='Y';
    menu(1,'PROCEDURA DI CREAZIONE FILE DATI LISTINO');
    while not(eof(infile)) and (upcase(ch)<>'Q')  do begin
      pconf:=1;
      readln(infile,buffin);
      writexy(20,23,'Letto colore:'+buffin);
      if upcase(ch)<>'S' then
        get_chr(20,24,'Procedo Avanzo Speed Quit?',ch);
      while (t_conf[pconf]<>'') and (upcase(ch)<>'A') and (upcase(run)<>'N') do begin

          write(outfile,t_list[lis]+CHR(13));
          writexy(10,8,t_list[lis]+'        ');

          write(outfile,common+buffin+t_conf[pconf]+CHR(13));
          writexy(10,10,common+buffin+t_conf[pconf]+'        ');

          if t_prezzo[pconf]<>'' then begin
            write(outfile,CHR(13));      {seleziona riga uno}
            write(outfile,t_prezzo[pconf]+CHR(13));
            writexy(10,12,t_prezzo[pconf]+'        ');
            write(outfile,CHR(13));      {seleziona riga due}
            write(outfile,t_sconto[lis]+CHR(13));
            writexy(10,14,t_sconto[lis]+'        ');
          end;
          if closechar<>0 then begin
            write(outfile,chr(closechar));
            writexy(10,16,'Close record.        ');
          end;
          pconf:=pconf+1;
          if upcase(run)<>'S' then
            get_chr(20,20,'Continue?(y/n/Speed)',run);
      end;{WHILE}
    end;
    close(infile);
    lis:=lis+1;
  end;
  close(outfile);
end;

begin{listino}
   repeat
     menu(1,'Generazione file per creazione listino articoli rel 1.0');

    repeat
      tasto:='S';
      code:=3;
      message('Premere <- per NESSUN FILE',1,9);
      get_name2(2,16,12,'File di configurazione tabelle?',st_name,code);
      if code=0 then
        if present(st_name) then begin
          loadtab(st_name,false);
        end
        else begin
          message('Non esiste il file '+st_name,1,0);

        end;

    until (code=3) or ((code=0) and present(st_name));

      lis:=1;
      repeat
        menu(1,'Modifica Tabelle');
        centre(10,'1   Tabella       Listini         ');
        centre(12,'2   Tabella       Confezioni      ');
        centre(14,'3   Tabella       Prezzi          ');
        centre(16,'4   Tabella       Sconti          ');
        centre(18,'4   Tabella       Nomi file colori');

        get_int(20,20,'Tabella?',lis);
        menu(1,'Modifica Tabelle');
        case lis of
          1:get_tab('Listino ',t_list);
          2:get_tab('Confezione ',t_conf);
          3:get_tab('Prezzo ',t_prezzo);
          4:get_tab('Sconto ',t_sconto);
          5:get_tab('Nomi file colori ',t_filin);

        end;
        lis:=lis+1;
      until lis>5;
    outname:=st_name;
    repeat
      tasto:='S';
      get_name(2,12,'File dove scrivere(quello da spedire)?',outname);
      if present(outname) then begin
        message('Esiste gi… il file specificato',1,0);
        get_chr2(2,14,'Cancello?',tasto,code);
      end
    until absent(outname) or (upcase(tasto)='S');


    menu(1,'Generazione file per creazione listino articoli');
    get_str(10,6,12,'Parte standard codice articolo:',common,code);
    get_chr2(20,20,'Salvo Tabelle',tasto,code);
    if upcase(tasto)='S' then begin
      message('Premere <- per uscire',1,0);
      code:=3;
      get_name2(20,21,12,'Nome?',st_name,code);
      if code=0 then
        savetab(st_name,false);
    end;
    message('Se come valore viene dato 0 , significhera` Nessun Cattere ',1,0);
    get_int(10,16,'Carattere di chiusura record?',closechar);
    buildfilelistino(name,outname);
    menu(1,'Generazione file per creazione listino articoli');
    tasto:='n';
    get_chr2(10,10,'Vuoi uscire',tasto,code);
   until upcase(tasto)='S';
end;




procedure maga;
{ le tabelle t_listino e t_sconto vencono utilizzate rispettivamente per
contenere i gruppi merc e provigioni}
var tasto:char;

procedure buildfilemaga(namein,nameout:string);
var
  infile,outfile                      :text;
  buffin,buffout,help                      :str80;
  run:char;
  main,ch:char;

begin
  run:='s';
  buffin:='';
  buffout:='';
  assign(infile,namein);
  assign(outfile,nameout);
  rewrite(outfile);
  reset(infile);
  ch:='N';
  run:='Y';
  menu(1,'PROCEDURA DI CREAZIONE FILE DATI MAGAZZINO');
  while not(eof(infile)) and (upcase(ch)<>'Q')  do begin
    pconf:=1;
    readln(infile,buffin);
    writexy(20,23,'Letto colore:'+buffin);
    if upcase(ch)<>'S' then
      get_chr(20,24,'Procedo Avanzo Speed Quit?',ch);
    while (t_conf[pconf]<>'') and (upcase(ch)<>'A') and (upcase(run)<>'N') do begin

          write(outfile,common+buffin+t_conf[pconf]+CHR(10)+CHR(13));
          writexy(10,10,common+buffin+t_conf[pconf]+'        ');

          if t_txt[pconf]<>'' then begin
            write(outfile,CHR(10)+CHR(13));      {seleziona riga uno}
            write(outfile,t_txt[pconf]+buffin+t_txt2[pconf]+CHR(10)+CHR(13));
            writexy(10,13,t_txt[pconf]+buffin+t_txt2[pconf]+'     ');

            write(outfile,CHR(10)+CHR(13));      {seleziona riga due}
            write(outfile,t_um[pconf]+CHR(10)+CHR(13));
            writexy(10,14,t_um[pconf]+'        ');


            write(outfile,'11'+CHR(10)+CHR(13));      {seleziona riga 11}
            write(outfile,t_list[pconf]+CHR(10)+CHR(13));
            writexy(10,15,t_list[pconf]+'        ');

            write(outfile,CHR(10)+CHR(13));      {seleziona riga sucessiva}
            write(outfile,t_sconto[pconf]+CHR(10)+CHR(13));
            writexy(10,16,t_sconto[pconf]+'        ');

            write(outfile,CHR(10)+CHR(13));      {seleziona riga sucessiva}
            write(outfile,t_iva[pconf]+CHR(10)+CHR(13));
            writexy(10,17,t_iva[pconf]+'        ');

            write(outfile,CHR(10)+CHR(13));      {seleziona riga sucessiva}
            write(outfile,t_prezzo[pconf]+CHR(10)+CHR(13));
            writexy(10,18,t_prezzo[pconf]+'        ');
          end;

          if closechar<>0 then begin
            write(outfile,chr(closechar));
            writexy(10,19,'Close record.        ');
          end;

          pconf:=pconf+1;
          if upcase(run)<>'S' then
            get_chr(20,21,'Continue?(y/n/Speed)',run);
      end;{WHILE}
  end;
  close(infile);
  close(outfile);
end;

procedure buildfilemaga2(namein,nameout:string);
var
  infile,outfile                      :text;
  buffin,buffout,help                      :str80;
  run:char;
  main,ch:char;

begin
  run:='s';
  buffin:='';
  buffout:='';
  assign(infile,namein);
  assign(outfile,nameout);
  rewrite(outfile);
  reset(infile);
  ch:='N';
  run:='Y';
  menu(1,'PROCEDURA DI CREAZIONE FILE DATI MAGAZZINO parte 2 ');
  while not(eof(infile)) and (upcase(ch)<>'Q')  do begin
    pconf:=1;
    readln(infile,buffin);
    writexy(20,23,'Letto colore:'+buffin);
    if upcase(ch)<>'S' then
      get_chr(20,24,'Procedo Avanzo Speed Quit?',ch);
    while (t_conf[pconf]<>'') and (upcase(ch)<>'A') and (upcase(run)<>'N') do begin

          write(outfile,common+buffin+t_conf[pconf]+CHR(13));
          writexy(10,10,common+buffin+t_conf[pconf]+'        ');
          write(outfile,t_campo[pconf]+CHR(13));      {seleziona riga }
          writexy(10,pconf+5,'Campo: '+t_campo[pconf]);
          write(outfile,t_txt3[pconf]+CHR(13));
          writexy(50,pconf+5,'Descrizione: '+t_txt3[pconf]);

          if closechar<>0 then begin
            write(outfile,chr(closechar));
            writexy(10,19,'Close record.        ');
          end;

          pconf:=pconf+1;
          if upcase(run)<>'S' then
            get_chr(20,21,'Continue?(y/n/Speed)',run);
      end;{WHILE}
  end;
  close(infile);
  close(outfile);
end;


begin{maga}
   repeat
     menu(1,'Generazione file per creazione magazzino articoli rel 1.0');

    repeat
      tasto:='S';
      code:=3;
      message('Premere <- per NESSUN FILE',1,9);
      get_name2(2,16,12,'File di configurazione tabelle?',st_name,code);
      if code=0 then
        if present(st_name) then begin
          message('Carico dal file '+st_name,1,0);
          loadtab(st_name,true);
        end
        else begin
          message('Non esiste il file '+st_name,1,0);

        end;

    until (code=3) or ((code=0) and present(st_name));

      lis:=1;
      tasto:='1';
      repeat
        menu(1,'Modifica Tabelle');

        centre(8,' 1)   Tabella      Confezioni            ');
        centre(9,' 2)     "          Descrizioni 1         ');
        centre(10,' 3)     "          Descrizioni 2         ');
        centre(11,' 4)     "          Unit… di misura       ');
        centre(12,' 5)     "          Gruppi merceologici   ');
        centre(13,' 6)     "          Provvigioni           ');
        centre(14,' 7)     "          I.V.A.                ');
        centre(15,' 8)     "          Prezzi                ');
        centre(16,' 9)     "          Campi                 ');
        centre(17,' A)     "          Descrizione Campi     ');
        centre(18,' b)     "          Nomi file colori      ');

        message('Dare 0 per uscire',1,0);
        code:=0;
        getrchr(20,20,'0','A','Tabella?',tasto,code);
        menu(1,'Modifica Tabelle');
        case upcase(tasto) of
          '1':get_tab('Confezione ',t_conf);
          '2':get_tab('Descrizione Prima ',t_txt);
          '3':get_tab('Descrizione Seconda ',t_txt2);
          '4':get_tab('Unit… di misura ',t_um);
          '5':get_tab('Gruppo merceologico ',t_list);
          '6':get_tab('Provvigione ',t_sconto);
          '7':get_tab('I.V.A. ',t_iva);
          '8':get_tab('Prezzo ',t_prezzo);
          '9':get_tab('Campo ',t_campo);
          'A':get_tab('Descrizione Seconda ',t_txt3);
          'B':get_tab('Nomi file colori ',t_filin);
        end;

        if tasto='B' then
          tasto:='1';
        if tasto<>'0'then
          tasto:=succ(tasto);
      until tasto='0';
    menu(1,'Generazione file per creazione magazzino parte 1');

    repeat
      get_name(2,10,'File contenente i colori(parte variabile del cod_art)?',name);
      if absent(name) then
        message('Non esiste il file specificato',1,0);
    until present(name);
    outname:=st_name;
    repeat
      tasto:='S';
      get_name(2,12,'File dove scrivere(quello da spedire)?',outname);
      if present(outname) then begin
        message('Esiste gi… il file specificato',1,0);
        get_chr(2,14,'Cancello?',tasto);
      end
    until absent(outname) or (upcase(tasto)='S');


    menu(1,'Generazione file per creazione magazzino articoli');
    get_str(10,6,12,'Parte standard codice articolo:',common,code);
    get_chr(20,20,'Salvo Tabelle',tasto);
    if upcase(tasto)='S' then begin
      message('Premere <- per uscire',1,0);
      code:=3;

      get_name2(20,21,12,'Nome?',st_name,code);
      if code=0 then
        savetab(st_name,true);
    end;
    menu(1,'Generazione file per creazione magazzino articoli');
    get_int(10,16,'Carattere di chiusura record?',closechar);
    buildfilemaga(name,outname);
    menu(1,'Generazione file per creazione magazzino articoli parte 2');
    tasto:='s';
    get_chr(10,10,'Vuoi generare anche il file campi generici ?',tasto);
    if upcase(tasto)='S' then begin
      repeat
        tasto:='S';
        get_name(2,12,'File dove scrivere(quello da spedire)?',outname);
        if present(outname) then begin
          message('Esiste gi… il file specificato',1,0);
          get_chr(2,14,'Cancello?',tasto);
        end
      until absent(outname) or (upcase(tasto)='S');
      buildfilemaga2(name,outname);
    end;

    tasto:='n';
    get_chr(10,10,'Vuoi uscire',tasto);
   until upcase(tasto)='S';
end;{MAGA}

procedure merge;
var
  name1,name2                 :string;


procedure mergefile(name1,name2,nameout:string);
var
  infile1,infile2,outfile                      :text;
  buffin,buffout,help                      :str80;
  run:char;
  ch:char;
  x,y:integer;
begin
  run:='s';
  buffin:='';
  buffout:='';
  assign(infile1,name1);
  assign(infile2,name2);
  assign(outfile,nameout);
  reset(infile1);
  rewrite(outfile);
  run:='y';
  menu(1,'WRITING FILE 1');
  while not(eof(infile1)) and ((upcase(run)='S') or (upcase(run)='Y')) do begin
    read(infile1,ch);
    write(ch);
    write(outfile,ch);
    if upcase(run)<>'S' then
       get_chr(20,20,'Continue?(y/n/Speed)',run);
  end;
  close(infile1);
  reset(infile2);
  run:='y';
  menu(1,'WRITING FILE 2 ');
  while not(eof(infile2)) and ((upcase(run)='S') or (upcase(run)='Y')) do begin
    read(infile2,ch);
    write(ch);
    write(outfile,ch);
    if upcase(run)<>'S' then begin
      savepos(x,y);
      get_chr(20,20,'Continue?(y/n/Speed)',run);
      gotoxy(x,y);
    end;
  end;
  close(infile2);
  close(outfile);
end;


begin {merge}
  name1:=st_name;

    REPEAT
     menu(1,'MERGE FILE ');
    repeat
      get_name(2,10,'File 1?',name1);
      if absent(name1) then
        message('Non esiste il file specificato',1,0);
    until present(name1);
    name2:=name1;
    repeat
      get_name(2,10,'File 2?',name2);
      if absent(name2) then
        message('Non esiste il file specificato',1,0);
    until present(name2);

    repeat
      tasto:='S';
      get_name(2,12,'File dove scrivere?',outname);
      if present(outname) then begin
        message('Esiste gi… il file specificato',1,0);
        get_chr2(2,14,'Cancello?',tasto,code);
      end
    until absent(outname) or (upcase(tasto)='S');
    mergefile(name1,name2,outname);
    menu(1,'MERGE FILE');
    tasto:='n';
    get_chr2(10,10,'Vuoi uscire',tasto,code);
   until upcase(tasto)='S';
end;



procedure convert;
procedure buildfile(namein,nameout:string);
var
  infile,outfile                      :text;
  buffin,buffout,help                      :str80;
  run:char;
  ch:char;
begin
  run:='s';
  buffin:='';
  buffout:='';
  assign(infile,namein);
  assign(outfile,nameout);
  reset(infile);
  rewrite(outfile);
  run:='y';
  menu(1,'PROCEDURA DI CONVERSIONE FILE ASCII IN FILE TESTO');
  while not(eof(infile)) and ((upcase(run)='S') or (upcase(run)='Y')) do begin
    read(infile,ch);
    write(ch);
    if ch=chr(13) then
      writeln(outfile)
    else
      write(outfile,ch);
    if upcase(run)<>'S' then
       get_chr(20,20,'Continue?(y/n/Speed)',run);
  end;
  close(infile);
  close(outfile);
end;


BEGIN {convert}
  code:=0;
    REPEAT
     menu(1,'CONVERSIONE FILE ASCII IN FILE TESTO');
     centre(2,'Sostituisce i chr(13) in chr(13)+chr(10)');
    repeat
      get_name(2,10,'File Ascii?',name);
      if absent(name) then
        message('Non esiste il file specificato',1,0);
    until present(name);
    repeat
      tasto:='S';
      get_name(2,12,'File dove scrivere?',outname);
      if present(outname) then begin
        message('Esiste gi… il file specificato',1,0);
        get_chr2(2,14,'Cancello?',tasto,code);
      end
    until absent(outname) or (upcase(tasto)='S');
    buildfile(name,outname);
    menu(1,'CONVERSIONE FILE LISTINO ARTICOLI');
    tasto:='n';
    get_chr2(10,10,'Vuoi uscire',tasto,code);
   until upcase(tasto)='S';
end;

procedure VISUAL;
procedure VISUALfile(namein:string);
var
  infile                      :text;
  run                         :char;
  ch                          :char;
  x,y                         :integer;
begin
  run:='s';
  assign(infile,namein);
  reset(infile);
  run:='y';
  menu(1,'PROCEDURA DI CONVERSIONE FILE ASCII IN FILE TESTO');
  gotoxy(1,2);
  while not(eof(infile)) and ((upcase(run)='S') or (upcase(run)='Y')) do begin
    read(infile,ch);
    write(ch);
    if ch=chr(13) then
      writeln;
    if upcase(run)<>'S' then begin
      savepos(x,y);
      get_chr(20,25,'Continue?(y/n/Speed)',run);
      gotoxy(x,y);
    end;
    if (wherey=24) and not(eof(infile))  then begin
      message2('Premere un tasto per continuare',1,0);
      menu(1,'PROCEDURA DI CONVERSIONE FILE ASCII IN FILE TESTO');
      gotoxy(1,2);
    end;
  end;
  close(infile);
  message2('Fine del file. Premere un tasto pper uscire',1,0);

end;


BEGIN {convert}
  code:=0;
    REPEAT
     menu(1,'CONVERSIONE FILE ASCII IN FILE TESTO');
     centre(2,'Sostituisce i chr(13) in chr(13)+chr(10)');
    repeat
      get_name(2,10,'File Ascii?',name);
      if absent(name) then
        message('Non esiste il file specificato',1,0);
    until present(name);
    visualfile(name);
    menu(1,'CONVERSIONE FILE LISTINO ARTICOLI');
    tasto:='n';
    get_chr2(10,10,'Vuoi uscire',tasto,code);
   until upcase(tasto)='S';
end;

procedure f1proc;
begin
  menu(1,'HELP');
  centre( 5,'Convenzioni da seguire per una gestione ordinata:                            ');
  centre( 7,'Le convenzioni sono relative alle estensioni dei nomi dei file creati da GEST');
  centre( 9,'Per i file di Listino (es per prodotto XX) :                                 ');
  centre(10,'File di configurazione per la parte n di xx per Gener/Mod.            XXn.CL ');
  centre(11,'File di configurazione per la parte n di xx per Cancellazione         XXn.CLC');
  centre(12,'File di trasmmissione  per la parte n di xx per Genr/Mod              XXn.L  ');
  centre(13,'File di trassmissione  per la parte n di xx per Cancellazione         XXn.LC ');
  centre(15,'Per i file di Magazzino (es per prodotto XX) :                               ');
  centre(16,'File di conf. parte n di xx, campi fissi(1-15) per Gener/Mod.         XXn.CM ');
  centre(17,'File di configurazione parte n di xx,  per Cancellazione              XXn.CMC');
  centre(18,'File di trasmis. parte n di xx ,campi fissi(1-15)  per Gen./Mod       XXn.M1 ');
  centre(19,'File di trasmis. parte n di xx ,campi variabili    per Gen./Mod       XXn.M2 ');
  centre(20,'File di trasmissione per la parte n di xx per Cancellazione           XXn.MC ');
  message2('Premere un tasto e muovere una freccia per continuare',1,0);
  menu(2,'Unknow Enviroment');
end;
procedure f2proc;
begin
 gest_printer;
end;
procedure f3proc;
begin
 siren;
end;
procedure f10proc;
var tasto:char;
begin
 tasto:='s';
 get_chr(10,25,'Vuoi uscire dal programma(Non si conoscono le conseguenze!!)?',tasto);
 if upcase(tasto)='S' then begin
   mid('Fine forzata dell`utente');
   halt;
 end;
end;

procedure execute(st_name,param:string);
{$m  $4000,0,0}
begin
       exec(st_name,param);
    if doserror<>0 then begin
       writexy(1,25,'Dos error = ');
       case doserror of
         2:writeln('File not found');
         8:writeln('not enough memory');
       else
         message2('Dos error _code ='+sts(doserror),1,1);
       end;
    end;
end;
BEGIN {program}
  common:='';
  code:=0;
  outname:='';
  name:='';
  st_name:='tab';
  closechar:=3;
    azz(t_list);
    azz(t_conf);
    azz(t_prezzo);
    azz(t_sconto);
    azz(t_um);
    azz(t_txt);
    azz(t_txt2);
    azz(t_iva);
    azz(t_campo);
    azz(t_txt3);
    azz(t_filin);
    tasto:='8';
    repeat
      menu(1,'GESTIONE LISTINO');
      centre(8,'1) Creazione file Listino articoli da generare             ');
      centre(10,'2) Creazione file Magazzino articoli generare              ');
      centre(12,'3) Appendi un file ad un`altro                             ');
      centre(14,'4) Conversione file listino ricevuto RS-232 in file testo  ');
      centre(16,'5) Visualizzazione di un file RS-232                       ');
      centre(20,'8) Lista archivi tabelle                                   ');
      code:=3;
      get_chr2(60,22,'Scelta?',tasto,code);
      if code<>3 then
        case tasto of
          '1':listino;
          '2':maga;
          '3':merge;
          '4':convert;
          '5':visual;
          '8':begin
                st:='*'+copy(st_name,length(st_name)-3,4);
                repeat
                  menu(1,'Lista archivi');
                  code:=3;
                  gets(1,3,20,'Maschera di lista?',st,code);
                  if code<>3 then begin
                    gotoxy(1,3);
                    execute('\UTIL\SDL.COM',' '+st);{utility;}
                    message2('Premere un tasto ; `'+sts(doserror),1,0);
                  end;
                until code=3;
                code:=0;
              end;
        end
    until (tasto='0') or (code=3);
    mid('A R R I V E D E R C I ');
end.
