bacnv.cpp Aggiunto codice ufficio unico sulle anagrafiche
Corretta sostituzione CAP sulle anagrafiche bacnv16d.txt Aggiunto codice del comune di riferimento git-svn-id: svn://10.65.10.50/trunk@5666 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									2810135cc8
								
							
						
					
					
						commit
						42f44f1d9e
					
				
							
								
								
									
										68
									
								
								ba/bacnv.cpp
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								ba/bacnv.cpp
									
									
									
									
									
								
							@ -1436,7 +1436,10 @@ void TConversione_archivi::convert_uue() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  pi.set_text("Caricamento Uffici Unici nei comuni");
 | 
					  pi.set_text("Caricamento Uffici Unici nei comuni");
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  TLocalisamfile comuni(LF_COMUNI);
 | 
					  TAssoc_array cod_uue;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  TSystemisamfile comuni(LF_COMUNI);
 | 
				
			||||||
 | 
					  comuni.open(_excllock);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  lf.format("%sstd/bacnv16b.txt", __ptprf);
 | 
					  lf.format("%sstd/bacnv16b.txt", __ptprf);
 | 
				
			||||||
  TScanner scan16b(lf);
 | 
					  TScanner scan16b(lf);
 | 
				
			||||||
@ -1447,7 +1450,7 @@ void TConversione_archivi::convert_uue() const
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    cod = line.get(0);
 | 
					    cod = line.get(0);
 | 
				
			||||||
    comuni.put("COM", cod);
 | 
					    comuni.put("COM", cod);
 | 
				
			||||||
    int err = comuni.read(_isequal, _lock);
 | 
					    int err = comuni.read(_isequal);
 | 
				
			||||||
    if (err == NOERR)
 | 
					    if (err == NOERR)
 | 
				
			||||||
    { 
 | 
					    { 
 | 
				
			||||||
      TString16 fieldname, fieldval;
 | 
					      TString16 fieldname, fieldval;
 | 
				
			||||||
@ -1457,6 +1460,7 @@ void TConversione_archivi::convert_uue() const
 | 
				
			|||||||
      {            
 | 
					      {            
 | 
				
			||||||
        fieldname = "CODUUE"; fieldname << uue;
 | 
					        fieldname = "CODUUE"; fieldname << uue;
 | 
				
			||||||
        fieldval = comuni.get(fieldname);
 | 
					        fieldval = comuni.get(fieldname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (first_uue == 0 && fieldval.empty())
 | 
					        if (first_uue == 0 && fieldval.empty())
 | 
				
			||||||
          first_uue = uue;
 | 
					          first_uue = uue;
 | 
				
			||||||
        if (fieldval == uff)
 | 
					        if (fieldval == uff)
 | 
				
			||||||
@ -1471,17 +1475,47 @@ void TConversione_archivi::convert_uue() const
 | 
				
			|||||||
        comuni.put(fieldname, uff);
 | 
					        comuni.put(fieldname, uff);
 | 
				
			||||||
        err = comuni.rewrite();
 | 
					        err = comuni.rewrite();
 | 
				
			||||||
      }  
 | 
					      }  
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      if (uue == 1)
 | 
				
			||||||
 | 
					        cod_uue.add(cod, comuni.get("CODUUE1"));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (err != NOERR)
 | 
					    if (err != NOERR)
 | 
				
			||||||
      error_box("Impossibile aggiornare l'ufficio unico del comune %s: errore %d", 
 | 
					      error_box("Impossibile aggiornare l'ufficio unico del comune %s: errore %d", 
 | 
				
			||||||
                (const char*)cod, err);  
 | 
					                (const char*)cod, err);  
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  scan16b.close();
 | 
					  comuni.close();
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  pi.set_text("Caricamento Uffici Unici nelle anagrafiche");
 | 
				
			||||||
 | 
					  TSystemisamfile persone(LF_ANAG);                                
 | 
				
			||||||
 | 
					  persone.open(_excllock);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  for (int err = persone.first(); err == NOERR; err = persone.next())
 | 
				
			||||||
 | 
					  {       
 | 
				
			||||||
 | 
					    if (persone.get("UFFUUE").empty())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      cod = persone.get("COMRF");
 | 
				
			||||||
 | 
					      if (cod.empty())
 | 
				
			||||||
 | 
					        cod = persone.get("COMRES");
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					      const TString* uffuue = (const TString*)cod_uue.objptr(cod);  
 | 
				
			||||||
 | 
					      if (uffuue)
 | 
				
			||||||
 | 
					      {                 
 | 
				
			||||||
 | 
					        persone.put("UFFUUE", *uffuue);  
 | 
				
			||||||
 | 
					        err = persone.rewrite();
 | 
				
			||||||
 | 
					        if (err != NOERR)
 | 
				
			||||||
 | 
					          error_box("Impossibile aggiornare l'ufficio unico sulle anagrafiche: errore %d", err);  
 | 
				
			||||||
 | 
					      }  
 | 
				
			||||||
 | 
					    }  
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  persone.close();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Effettua conversioni per nuovi cap
 | 
					// Effettua conversioni per nuovi cap
 | 
				
			||||||
void TConversione_archivi::convert_cap() const
 | 
					void TConversione_archivi::convert_cap() const
 | 
				
			||||||
{                                     
 | 
					{                                     
 | 
				
			||||||
 | 
					  if (_codditta != 0)
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TLocalisamfile comuni(LF_COMUNI);
 | 
					  TLocalisamfile comuni(LF_COMUNI);
 | 
				
			||||||
  TFilename lf;
 | 
					  TFilename lf;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@ -1499,6 +1533,8 @@ void TConversione_archivi::convert_cap() const
 | 
				
			|||||||
    cod = line.get(0);
 | 
					    cod = line.get(0);
 | 
				
			||||||
    oldcod = line.get();
 | 
					    oldcod = line.get();
 | 
				
			||||||
    newcod = line.get();
 | 
					    newcod = line.get();
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    oldcod.insert(cod, 0);    // La chiave e' comune+cap
 | 
				
			||||||
    cap.add(oldcod, newcod);
 | 
					    cap.add(oldcod, newcod);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (_codditta == 0L)
 | 
					    if (_codditta == 0L)
 | 
				
			||||||
@ -1517,12 +1553,16 @@ void TConversione_archivi::convert_cap() const
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  scan16c.close();
 | 
					  scan16c.close();
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  TDir dir; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TString msg;
 | 
					  TString msg;
 | 
				
			||||||
 | 
					  TToken_string com_cap(15, ',');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  lf.format("%sstd/bacnv16d.txt", __ptprf);
 | 
					  lf.format("%sstd/bacnv16d.txt", __ptprf);
 | 
				
			||||||
  TScanner scan16d(lf);
 | 
					  TScanner scan16d(lf);
 | 
				
			||||||
  for (line = scan16d.line(); line.not_empty(); line = scan16d.line())
 | 
					  for (line = scan16d.line(); line.not_empty(); line = scan16d.line())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TString16 cod = line.get(0);
 | 
					    const TString16 cod = line.get(0);
 | 
				
			||||||
    const int logicnum = atoi(cod);
 | 
					    const int logicnum = atoi(cod);
 | 
				
			||||||
    if (_codditta == 0L && logicnum == LF_OCCAS) // Il file degli occasionali non puo' essere comune
 | 
					    if (_codditta == 0L && logicnum == LF_OCCAS) // Il file degli occasionali non puo' essere comune
 | 
				
			||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
@ -1532,27 +1572,34 @@ void TConversione_archivi::convert_cap() const
 | 
				
			|||||||
    if (logicnum > 0)
 | 
					    if (logicnum > 0)
 | 
				
			||||||
      file = new TLocalisamfile(logicnum);
 | 
					      file = new TLocalisamfile(logicnum);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      if (_codditta == 0L)
 | 
					 | 
				
			||||||
      file = new TTable(cod);
 | 
					      file = new TTable(cod);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    dir.get(file->num(), _nolock, _nordir, _sysdirop);
 | 
				
			||||||
 | 
					    const bool good_file = dir.is_com() ^ _codditta != 0;
 | 
				
			||||||
 | 
					    if (!good_file)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      delete file;
 | 
				
			||||||
 | 
					      file = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    if (file != NULL)
 | 
					    if (file != NULL)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      msg = "Aggiornamento CAP sul file "; 
 | 
					      msg = "Aggiornamento CAP sul file "; 
 | 
				
			||||||
      msg << cod;
 | 
					      msg << cod;
 | 
				
			||||||
      pi.set_text(msg);
 | 
					      pi.set_text(msg);
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      file->lock();  
 | 
					 | 
				
			||||||
      for (int err = file->first(); err == NOERR; err = file->next())  
 | 
					      for (int err = file->first(); err == NOERR; err = file->next())  
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        bool dirty = FALSE;
 | 
					        bool dirty = FALSE;
 | 
				
			||||||
        for (cod = line.get(1); cod.not_empty(); cod = line.get())
 | 
					        for (com_cap = line.get(1); com_cap.not_empty(); com_cap = line.get())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          oldcod = file->get(cod);
 | 
					          oldcod = file->get(com_cap.get(0));
 | 
				
			||||||
 | 
					          const TString16 cap_field = com_cap.get();
 | 
				
			||||||
 | 
					          oldcod << file->get(cap_field);
 | 
				
			||||||
          TString* newcod = (TString*)cap.objptr(oldcod);
 | 
					          TString* newcod = (TString*)cap.objptr(oldcod);
 | 
				
			||||||
          if (newcod)
 | 
					          if (newcod)
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            file->put(cod, *newcod);
 | 
					            file->put(cap_field, *newcod);
 | 
				
			||||||
            dirty = TRUE;
 | 
					            dirty = TRUE;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        } 
 | 
					        } 
 | 
				
			||||||
@ -1563,7 +1610,6 @@ void TConversione_archivi::convert_cap() const
 | 
				
			|||||||
            error_box("Errore di aggiornamento %d", err);
 | 
					            error_box("Errore di aggiornamento %d", err);
 | 
				
			||||||
        }    
 | 
					        }    
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      file->unlock();  
 | 
					 | 
				
			||||||
      delete file;  
 | 
					      delete file;  
 | 
				
			||||||
    }  
 | 
					    }  
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,15 +1,15 @@
 | 
				
			|||||||
6|CAPRES|CAPRF|CAPCORR
 | 
					6|COMRES,CAPRES|COMRF,CAPRF|COMCORR,CAPCORR
 | 
				
			||||||
9|CAPAA
 | 
					9|COMAA,CAPAA
 | 
				
			||||||
10|CAPCS
 | 
					10|COMCS,CAPCS
 | 
				
			||||||
11|CAPULC|CAPTRIB
 | 
					11|COMULC,CAPULC|COMTRIB,CAPTRIB
 | 
				
			||||||
16|CAP
 | 
					16|COM,CAP
 | 
				
			||||||
18|CAP
 | 
					18|COM,CAP
 | 
				
			||||||
20|CAPCF
 | 
					20|COMCF,CAPCF
 | 
				
			||||||
%BAN|S3
 | 
					%BAN|S5,S3
 | 
				
			||||||
%UCC|S7
 | 
					%UCC|S6,S7
 | 
				
			||||||
%UCS|S7
 | 
					%UCS|S6,S7
 | 
				
			||||||
%UES|S7
 | 
					%UES|S6,S7
 | 
				
			||||||
%UID|S7
 | 
					%UID|S6,S7
 | 
				
			||||||
%UIV|S7
 | 
					%UIV|S6,S7
 | 
				
			||||||
%URE|S7
 | 
					%URE|S6,S7
 | 
				
			||||||
%VET|S7
 | 
					%VET|S9,S7
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user