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
76
ba/bacnv.cpp
76
ba/bacnv.cpp
@ -1436,8 +1436,11 @@ void TConversione_archivi::convert_uue() const
|
||||
|
||||
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);
|
||||
TScanner scan16b(lf);
|
||||
|
||||
@ -1447,16 +1450,17 @@ void TConversione_archivi::convert_uue() const
|
||||
{
|
||||
cod = line.get(0);
|
||||
comuni.put("COM", cod);
|
||||
int err = comuni.read(_isequal, _lock);
|
||||
int err = comuni.read(_isequal);
|
||||
if (err == NOERR)
|
||||
{
|
||||
TString16 fieldname, fieldval;
|
||||
uff = line.get(1);
|
||||
int first_uue = 0;
|
||||
for (int uue = 1; uue <= 10; uue++)
|
||||
{
|
||||
{
|
||||
fieldname = "CODUUE"; fieldname << uue;
|
||||
fieldval = comuni.get(fieldname);
|
||||
|
||||
if (first_uue == 0 && fieldval.empty())
|
||||
first_uue = uue;
|
||||
if (fieldval == uff)
|
||||
@ -1471,17 +1475,47 @@ void TConversione_archivi::convert_uue() const
|
||||
comuni.put(fieldname, uff);
|
||||
err = comuni.rewrite();
|
||||
}
|
||||
|
||||
if (uue == 1)
|
||||
cod_uue.add(cod, comuni.get("CODUUE1"));
|
||||
}
|
||||
if (err != NOERR)
|
||||
error_box("Impossibile aggiornare l'ufficio unico del comune %s: errore %d",
|
||||
(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
|
||||
void TConversione_archivi::convert_cap() const
|
||||
{
|
||||
{
|
||||
if (_codditta != 0)
|
||||
return;
|
||||
|
||||
TLocalisamfile comuni(LF_COMUNI);
|
||||
TFilename lf;
|
||||
|
||||
@ -1499,6 +1533,8 @@ void TConversione_archivi::convert_cap() const
|
||||
cod = line.get(0);
|
||||
oldcod = line.get();
|
||||
newcod = line.get();
|
||||
|
||||
oldcod.insert(cod, 0); // La chiave e' comune+cap
|
||||
cap.add(oldcod, newcod);
|
||||
|
||||
if (_codditta == 0L)
|
||||
@ -1517,12 +1553,16 @@ void TConversione_archivi::convert_cap() const
|
||||
}
|
||||
scan16c.close();
|
||||
|
||||
TDir dir;
|
||||
|
||||
TString msg;
|
||||
TToken_string com_cap(15, ',');
|
||||
|
||||
lf.format("%sstd/bacnv16d.txt", __ptprf);
|
||||
TScanner scan16d(lf);
|
||||
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);
|
||||
if (_codditta == 0L && logicnum == LF_OCCAS) // Il file degli occasionali non puo' essere comune
|
||||
continue;
|
||||
@ -1532,27 +1572,34 @@ void TConversione_archivi::convert_cap() const
|
||||
if (logicnum > 0)
|
||||
file = new TLocalisamfile(logicnum);
|
||||
else
|
||||
file = new TTable(cod);
|
||||
|
||||
dir.get(file->num(), _nolock, _nordir, _sysdirop);
|
||||
const bool good_file = dir.is_com() ^ _codditta != 0;
|
||||
if (!good_file)
|
||||
{
|
||||
if (_codditta == 0L)
|
||||
file = new TTable(cod);
|
||||
}
|
||||
delete file;
|
||||
file = NULL;
|
||||
}
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
msg = "Aggiornamento CAP sul file ";
|
||||
msg << cod;
|
||||
pi.set_text(msg);
|
||||
|
||||
file->lock();
|
||||
for (int err = file->first(); err == NOERR; err = file->next())
|
||||
{
|
||||
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);
|
||||
if (newcod)
|
||||
{
|
||||
file->put(cod, *newcod);
|
||||
file->put(cap_field, *newcod);
|
||||
dirty = TRUE;
|
||||
}
|
||||
}
|
||||
@ -1563,7 +1610,6 @@ void TConversione_archivi::convert_cap() const
|
||||
error_box("Errore di aggiornamento %d", err);
|
||||
}
|
||||
}
|
||||
file->unlock();
|
||||
delete file;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
6|CAPRES|CAPRF|CAPCORR
|
||||
9|CAPAA
|
||||
10|CAPCS
|
||||
11|CAPULC|CAPTRIB
|
||||
16|CAP
|
||||
18|CAP
|
||||
20|CAPCF
|
||||
%BAN|S3
|
||||
%UCC|S7
|
||||
%UCS|S7
|
||||
%UES|S7
|
||||
%UID|S7
|
||||
%UIV|S7
|
||||
%URE|S7
|
||||
%VET|S7
|
||||
6|COMRES,CAPRES|COMRF,CAPRF|COMCORR,CAPCORR
|
||||
9|COMAA,CAPAA
|
||||
10|COMCS,CAPCS
|
||||
11|COMULC,CAPULC|COMTRIB,CAPTRIB
|
||||
16|COM,CAP
|
||||
18|COM,CAP
|
||||
20|COMCF,CAPCF
|
||||
%BAN|S5,S3
|
||||
%UCC|S6,S7
|
||||
%UCS|S6,S7
|
||||
%UES|S6,S7
|
||||
%UID|S6,S7
|
||||
%UIV|S6,S7
|
||||
%URE|S6,S7
|
||||
%VET|S9,S7
|
||||
|
Loading…
x
Reference in New Issue
Block a user