diff --git a/cg/cglib04.cpp b/cg/cglib04.cpp index 919d1b173..a8e56a7df 100755 --- a/cg/cglib04.cpp +++ b/cg/cglib04.cpp @@ -2474,7 +2474,7 @@ void TTransfer_file::write_testata_causali(TString& record) if (fname == CAU_TIPOMOV) if (field == "0") - field == ""; + field = ""; _depcaus->put(fname, (const char*)field); @@ -2582,7 +2582,7 @@ void TTransfer_file::write_righe_causali(TString& record) void TTransfer_file::write_clienti_fornitori(TString& record) { - TString sigla,key; + TString sigla,key,com,comune,cap; int numfield = 1; TMappa_trc& trc = mappa(); @@ -2629,7 +2629,35 @@ void TTransfer_file::write_clienti_fornitori(TString& record) { long sottoc = atol(field); field.format("%6ld", sottoc); + } + if (fname == CLI_COMCF) + { + com = field; + com.trim(); + } + if (fname == CLI_CAPCF) + { + field.trim(); + if (field == "00000") + cap = ""; + else + cap = field; } + if (fname == CLI_LOCCF) + { + comune = ""; + + if (com.empty()) + { + if (cap.not_empty()) + comune = cerca_comune_cap(cap); + if (comune.empty()) + comune = cerca_comune_den(field); + if (comune.not_empty()) + _depclifo->put(CLI_COMCF, comune); + } + } + if (flag == 2) { TString f = converti(field,TRUE); @@ -2800,7 +2828,7 @@ void TTransfer_file::write_testata_movimenti(TString& record) if (trc.is_key((const char *) key)) { - _numreg = atol(record.sub(2,8)); + _numreg = atol(record.sub(2,9)); do { @@ -2957,9 +2985,37 @@ void TTransfer_file::write_testata_movimenti(TString& record) { _depmov->put(fname,field); _depoccas->put("CFPI", field); - } - else - _depoccas->put(fname, field); + } + else + if (fname == "COM") + { + field.trim(); + if (field.empty()) + { + TString denominazione = record.sub(403,453); + denominazione.trim(); + TString comune (cerca_comune_den(denominazione)); + _depoccas->put("COM", comune); + } + else + _depoccas->put("COM", field); + } + else + if (fname == "COMNASC") + { + field.trim(); + if (field.empty()) + { + TString denominazione = record.sub(473,523); + denominazione.trim(); + TString comune (cerca_comune_den(denominazione)); + _depoccas->put("COMNASC", comune); + } + else + _depoccas->put("COMNASC", field); + } + else + _depoccas->put(fname, field); registra_occas = TRUE; } } @@ -3349,7 +3405,7 @@ int packindex(bool vis, int num, TString& name) d.get(num,_nolock, _nordir,_sysdirop); d.get(num,_nolock, (d.is_com()) ? _comdir : _nordir); r.get(num); - err=DB_packindex(vis, name, r.rec(), &peod,TRUE); + err=DB_packindex(vis, name, r.rec(), &peod); if (err != NOERR) err = get_error(err); #ifdef DBG diff --git a/cg/cgtrcpc.ini b/cg/cgtrcpc.ini index c7f43cb76..5d559b0e8 100755 --- a/cg/cgtrcpc.ini +++ b/cg/cgtrcpc.ini @@ -64,10 +64,10 @@ A1|2|4|9|20|CODCF||| A1|3|61|110|20|RAGSOC|1|| A1|4|111|145|20|INDCF|1|| A1|5|146|155|20|CIVCF|1|| -A1|6|156|190|20|LOCALITACF|1|| -A1|7|191|193|20|STATOCF|1|| -A1|8|194|197|20|COMCF|1|| -A1|9|248|252|20|CAPCF|1|| +A1|6|191|193|20|STATOCF|1|| +A1|7|194|197|20|COMCF|1|| +A1|8|248|252|20|CAPCF|1|| +A1|9|156|190|20|LOCALITACF|1|| A1|10|253|268|20|COFI|1|| A1|11|269|270|20|STATOPAIV|1|| A1|12|271|282|20|PAIV|1||