diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp
index ff732a73b..33c23ffdd 100755
--- a/ve/ve0100.cpp
+++ b/ve/ve0100.cpp
@@ -59,7 +59,10 @@ void TMotore_application::init_insert_mode( TMask& m )
   const int pos = m.id2pos( F_DATACAMBIO1);
   
   if (pos >= 0 && m.fld(pos).active())
+  {
     m.fld(pos).set(data_doc);    
+    m.fld(pos).dirty();
+  }
   m.disable(DLG_PRINT);
   _occas_mask->reset( );
   const int ndefaults = pro( ).get_int( "NDEFAULTS", "DEFAULT" );          // prof
@@ -242,15 +245,35 @@ bool TMotore_application::num_handler( TMask_field& f, KEY key )
 bool TMotore_application::elabora_handler( TMask_field& f, KEY key )
 {          
   if (key == K_SPACE)
-  {     
+  {
+#ifndef DBG
     return message_box("Funzione in fase di implementazione");
+#endif
     TString_array elabs;   
     TMask & m = f.mask();
     const TString16 tipo(m.get(F_TIPODOC));
     const TString16 stato(m.get(F_STATO));
     TLista_elaborazioni & elab = app().elab();
     
-    elab.select(elabs, TRUE, m.insert_mode(), NULL, NULL, tipo, stato);
+    const int items = elab.select(elabs, TRUE, m.insert_mode(), NULL, NULL, tipo, stato);   
+    if (items == 0)
+      return message_box("Non ci sono elaborazioni attive per questo documento");
+    int selected = 0;
+    if (items > 1)
+    {  
+      TMask selection("ve0100b");
+      TList_field & f = (TList_field &) selection.field(F_SELECT);
+      
+      for (int i = 0; i < items; i++)
+        f.add_item(format("%d|%s", i, (const char *)elab[elabs.row(i)].descrizione()));
+    
+      if (selection.run() == K_ENTER)
+        selected = atoi(selection.get(F_SELECT));
+    }            
+    else
+      selected = 1;  
+    if (selected > 0)
+      TElaborazione & e = elab[elabs.row(selected)];
   }
   return TRUE;
 }
@@ -510,7 +533,7 @@ TMask* TMotore_application::get_mask( int mode )
             { 
               const TString & header = l.name(i);
               const int len = header.len() + 1;      
-              const int f_len = l.code_lenght(i);
+              const int f_len = l.code_length(i);
               _doc->set_liv_giac_len(i, f_len);
 
               _sheet->set_column_header(pos, l.name(i));
diff --git a/ve/ve1100.cpp b/ve/ve1100.cpp
index 6815196aa..32ce0e7ee 100755
--- a/ve/ve1100.cpp
+++ b/ve/ve1100.cpp
@@ -47,8 +47,8 @@ int TDocisamfile::readat(TRecnotype nrec, word lockop)
       _doc->summary_filter(1);
     }
   return err;
-  //return err == NOERR ?  _doc->read(curr()) : err;
-}
+} 
+
 class TRDocisamfile : public TLocalisamfile
 {
   TDocumento *_doc;
@@ -76,7 +76,8 @@ class TDocumento_form : public TForm
   TRelation &_firmrel; // relazione di gestione dei dati della ditta corrente
   TString _module; // codice del modulo di carta associato a questo al form
   TCond_vendita * _condv;
-  TString_array _exclude_array; // array di coppie tipo/articolo da escludere dalla stampa
+  TString_array _exclude_array_t; // array di tipi riga da escludere dalla stampa
+  TString_array _exclude_array_a; // array di articoli da escludere dalla stampa
   TDocumentoEsteso * _doc; // Documento da stampare
   bool _valid, _cli_loaded; // flag che indica se il form e' valido | se l'oggetto cliente � gi� stato caricato
   bool _is_lista;           // flag che indica se il form e' usato per la stampa della lista documenti
@@ -116,7 +117,8 @@ public:
   bool doc_arrange();
   int ncopie() { return _doc->tipo().ncopie(); }
   const TString &get_module_code() { return _module; } // ritorna il codice del modulo di carta
-  TString_array & exclude_list()   { return _exclude_array; }
+  TString_array & exclude_list_t()   { return _exclude_array_t; }
+  TString_array & exclude_list_a()   { return _exclude_array_a; }
   TDocumentoEsteso& doc() { return *_doc; }
   TDocumento_form(TRectype&/*TDocumentoEsteso **/ doc, TRelation& rel, const bool definitiva, const bool interattivo);
   TDocumento_form(const char* form, TRelation& rel);
@@ -133,20 +135,21 @@ TDocumento_form::TDocumento_form(TRectype&/*TDocumentoEsteso**/ doc, TRelation&
   _tip = new TTable("%TIP");
   _tab = new TLocalisamfile(LF_TAB);
   TString nomeform;
-  TFilename profilo;
+//  TFilename profilo;
   TString codnum(doc.get(DOC_CODNUM));
   TString numdoc(doc.get(DOC_NDOC));
-  
+                                       // modificare ??
   _tip->put("CODTAB", doc.get(DOC_TIPODOC)); // posiziona la tabella dei tipi di documento
   int err=_tip->read(); // legge la tabella
   if (err==NOERR)
   { // se non ci sono errori procede con la stampa
     nomeform= _tip->get("S5"); // legge il nome del form di stampa
-    profilo= _tip->get("S4"); // legge il nome del profilo di configurazione
-    profilo.ext("ini"); // aggiunge l'estensione al nome del file del profilo
-    if (profilo.empty() || nomeform.empty()) 
+    TFilename test(nomeform); test.ext("frm");
+//    profilo= _tip->get("S4"); // legge il nome del profilo di configurazione
+//    profilo.ext("ini"); // aggiunge l'estensione al nome del file del profilo
+    if (/* profilo.empty() || */ fexist(nomeform)) 
     {
-      error_box("Nome profilo o form di stampa non valido nella tabella TIP");
+      error_box("Nome form di stampa (%s) non valido per il tipo documento %s ", (const char *) nomeform, (const char *) ((TDocumento &)doc).tipo().codice());
       return;
     }
   }
@@ -381,26 +384,16 @@ void TDocumento_form::modify_pictures()
 bool TDocumento_form::print_on_body(int r)
 {
   TPrint_section& body = section('B');
-  
   TRiga_documento& riga = doc()[r];
-
-  TString tiporiga(riga.get(RDOC_TIPORIGA));
-  TString codart(riga.get(RDOC_CODART));
-  const int items = _exclude_array.items();
-  bool ok = TRUE;
+  const TString & tiporiga = riga.get(RDOC_TIPORIGA);
+  bool ok = _exclude_array_t.find(tiporiga) < 0;
   
-  for (int i = 0; i < items && ok; i++)
+  if (ok)                
   {
-    TToken_string& s=_exclude_array.row(i);
-    TString tr(s.get(0));
-    TString ar(s.get(1));
-    tr.trim();ar.trim();
-    if (tr.empty() && ar.empty()) continue;
-    if (tr.empty() && ar == codart) ok = FALSE;
-    else if (tr == tiporiga)
-      if (ar.empty() || (ar.not_empty() && ar == codart)) ok = FALSE;
-  }  
-  
+    const TString & codart = riga.get(RDOC_CODART);
+    ok = _exclude_array_a.find(codart) < 0;
+  }
+
   if (ok)
     body.update(); // Crea la vera riga di stampa, eventuali allineamenti avverranno nella validate(), come al solito.
   
@@ -447,7 +440,15 @@ void TDocumento_form::extended_parse_general(TScanner &scanner)
   if (scanner.key() == "EX")
   {
     TToken_string s(scanner.string(),',');
-    _exclude_array.add(s);
+    const char * i = s.get();
+    if (i)
+    {
+      if (*i)
+        _exclude_array_t.add(i);
+      i = s.get();
+      if (i && *i)
+      _exclude_array_a.add(i);
+    }
   }
 }
 
@@ -719,7 +720,8 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) {
     return (TRUE);
   } // fine _CLIENTE
 
-  if (code == "_DESCRIGA") {
+  if (code == "_DESCRIGA")
+  {
     // Messaggio per reperire la descrizione estesa sulle righe del documento
     TLocalisamfile &rdoc= (cursor())->file(LF_RIGHEDOC);
     TString descrizione = rdoc.get("DESCR");
@@ -735,7 +737,8 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) {
     cf.section().set_height(cf.effective_height());
   }
 
-  if (code== "_ALIGN") {
+  if (code== "_ALIGN")
+  {
     // allineamento della posizione di un campo rispetto ad un altro
     // sintassi: _ALIGN,<campo form>[,<allineamento>][,<allineamento>...]
     // dove: <campo form> � il campo della form (preceduto da '#') da cui prendere l'allineamento
@@ -801,7 +804,8 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) {
     cf.put_paragraph(pg);
   } 
   
-  if (code== "_RIEPILOGOIVA") {
+  if (code== "_RIEPILOGOIVA")
+  {
     // tabella riepilogo aliquote iva e relative imposte
     // sintassi: _RIEPILOGOIVA,<selettore>,<macro>,<cambio codice>
     // dove: <selettore> � uno dei seguenti:
@@ -872,7 +876,8 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) {
     return (TRUE);
   } // fine _TOTIMPONIBILI
 
-  if (code== "_SCADENZE") {
+  if (code== "_SCADENZE")
+  {
     // messaggio per stampare le scadenze
     // sintassi: _SCADENZE,<macro>,<cambio codice>
     // dove <macro> e' uno dei seguenti:
diff --git a/ve/velib.h b/ve/velib.h
index 3ab8c1e36..c480a26a9 100755
--- a/ve/velib.h
+++ b/ve/velib.h
@@ -206,7 +206,7 @@ public:
 
 class TTipo_documento : public TRectype  // velib03
 {              
-  enum { _altro, _fattura, _bolla, _ordine};
+  enum { _altro, _bolla, _fattura, _ordine};
   
   static TAssoc_array _formule_documento;
   TToken_string _formule;
@@ -707,6 +707,7 @@ protected:
 
 public:
   const TString& codice() const { return get("CODTAB"); }
+  const TString& descrizione() const { return get("S0"); }
   const TTipo_elaborazione tipo() const { return (TTipo_elaborazione) get_int("I0"); } 
 
   bool doc_uguale(int u) const  { return get("S1")[u] == 'X'; }
diff --git a/ve/velib03.cpp b/ve/velib03.cpp
index 8660e0fa6..bc1901285 100755
--- a/ve/velib03.cpp
+++ b/ve/velib03.cpp
@@ -857,7 +857,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
     for (int i = rows; i > 0; i--)
     {
       TRiga_documento & r = myself.row(i);
-      if (!r.is_checked())
+      if ((r.is_merce() || r.is_omaggio()) && !r.is_checked())
       {                         
         const TString & codart = r.get("CODART");
         anamag.put("CODART", codart);
diff --git a/ve/velib04c.cpp b/ve/velib04c.cpp
index 3225cb6ac..47a49ed40 100755
--- a/ve/velib04c.cpp
+++ b/ve/velib04c.cpp
@@ -29,7 +29,7 @@ TGenerazione_effetti::TGenerazione_effetti(const char* cod)
   
   _docfile  = new TLocalisamfile(LF_DOC);
   _rdocfile = new TLocalisamfile(LF_RIGHEDOC);
-  _cessfile = new TLocalisamfile(LF_CESS);
+//  _cessfile = new TLocalisamfile(LF_CESS);
   _occas    = new TLocalisamfile(LF_OCCAS);
   _clifo    = new TLocalisamfile(LF_CLIFO);
   _cfven    = new TLocalisamfile(LF_CFVEN);
@@ -50,7 +50,7 @@ TGenerazione_effetti::TGenerazione_effetti(const TRectype& rec)
   _valid_array.reset(9); // bonifici 
   _docfile  = new TLocalisamfile(LF_DOC);
   _rdocfile = new TLocalisamfile(LF_RIGHEDOC);
-  _cessfile = new TLocalisamfile(LF_CESS);
+//  _cessfile = new TLocalisamfile(LF_CESS);
   _occas    = new TLocalisamfile(LF_OCCAS);
   _clifo    = new TLocalisamfile(LF_CLIFO);
   _cfven    = new TLocalisamfile(LF_CFVEN);
@@ -64,7 +64,7 @@ TGenerazione_effetti::~TGenerazione_effetti()
 {
   delete _docfile;
   delete _rdocfile;
-  delete _cessfile;
+//  delete _cessfile;
   delete _occas;
   delete _clifo;
   delete _cfven;
diff --git a/ve/veuml.h b/ve/veuml.h
index 8a7f15133..75321e4b8 100755
--- a/ve/veuml.h
+++ b/ve/veuml.h
@@ -83,4 +83,6 @@
 #define F_CODLIST1                  203
 #define F_CODCONT1                  204
 #define F_CODZON                    205
+
+#define F_SELECT                    101
 #endif // veuml.h