Modifica richiesta da Patrizia nella ricezione da sistema riguardo il codice comune dei clienti/fornitori e dei clienti occasionali.

git-svn-id: svn://10.65.10.50/trunk@3029 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
ale 1996-06-20 13:47:57 +00:00
parent 3b963dab14
commit 8cd0b30be6
3 changed files with 44 additions and 11 deletions

@ -1092,7 +1092,7 @@ bool TVar_mov::cap_occasionali(TMask_field& f, KEY k)
TString capocc = f.mask().get(F_CAPOCC);
if (capocc.not_empty())
com = app()._tras_file.cerca_comune_cap(capocc);
com = app()._tras_file.cerca_comune_cap(capocc,den);
if (com.not_empty())
app().ricerca_localita(com,den,cap,prov);

@ -905,10 +905,14 @@ const char* TTransfer_file::numero_civico(TString& indirizzo)
return TEMP;
}
const char* TTransfer_file::cerca_comune_cap(TString& field)
const char* TTransfer_file::cerca_comune_cap(TString& field, const TString& localita)
{
TLocalisamfile comuni (LF_COMUNI);
TString cap = field;
TString cap = field;
bool trovato = FALSE;
bool prima_volta = TRUE;
TEMP = "";
if (cap.sub(2,3) == "1")
{
@ -916,14 +920,43 @@ const char* TTransfer_file::cerca_comune_cap(TString& field)
cap << "00";
}
TString dencom = localita;
comuni.setkey(3);
comuni.zero();
comuni.put(COM_CAPCOM, cap);
if (comuni.read() == NOERR)
TEMP = comuni.get(COM_COM);
else
TEMP = "";
TRectype com (comuni.curr());
for (comuni.read(_isgteq); !comuni.eof(); comuni.next())
{
if (comuni.curr() != com) break;
TString denominazione (comuni.get(COM_DENCOM));
if (prima_volta)
{
TEMP = comuni.get(COM_COM);
prima_volta = FALSE;
}
for (int i = 0; i < 3; i++)
{
if (dencom[i] == denominazione[i])
trovato = TRUE;
else
{
trovato = FALSE;
break;
}
}
if (!trovato)
continue;
else
{
TEMP = comuni.get(COM_COM);
break;
}
}
return TEMP;
}
@ -1140,7 +1173,7 @@ void TTransfer_file::write_tmp_tabelle(TString& record, bool create)
comune = "";
if (cap.not_empty())
comune = cerca_comune_cap(cap);
comune = cerca_comune_cap(cap,field);
if (comune.empty())
comune = cerca_comune_den(field);
if (comune.not_empty())
@ -1670,7 +1703,7 @@ const char* TTransfer_file::scrivi_occasionali(const TString& record)
_cod_com = "";
if (cap.not_empty())
_cod_com = cerca_comune_cap(cap);
_cod_com = cerca_comune_cap(cap,com);
if (_cod_com.empty())
_cod_com = cerca_comune_den(com);
@ -3764,7 +3797,7 @@ void TTransfer_file::write_clienti_fornitori(TString& record)
if (com.empty())
{
if (cap.not_empty())
comune = cerca_comune_cap(cap);
comune = cerca_comune_cap(cap,field);
if (comune.empty())
comune = cerca_comune_den(field);
if (comune.not_empty())

@ -269,7 +269,7 @@ public:
void canc_file_dir_temp(const char* dir);
void temp_dir(TString& orig,TString& dest,TString& sigle);
const char* cerca_comune_cap(TString& field);
const char* cerca_comune_cap(TString& field,const TString& localita);
const char* cerca_comune_den(TString& field);
void datafine_esprec(const int aep, TDate& datacomp);