Patch level : 10.0
Files correlati : fe0.exe Ricompilazione Demo : [ ] Commento : Migliorata estrazione di Cognome e Nome di anagrafiche in cui è presente solo la prima parte della Ragione Sociale git-svn-id: svn://10.65.10.50/branches/R_10_00@22537 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8649090cbd
commit
c6cdc3fcd4
73
fe/felib.cpp
73
fe/felib.cpp
@ -86,6 +86,26 @@ const TString& TAnagrafica::stato_estero_UNICO() const
|
||||
return get_tmp_string() = u;
|
||||
}
|
||||
|
||||
void TAnagrafica::split_ragsoc()
|
||||
{
|
||||
if (_tipo == 'F')
|
||||
{
|
||||
if (nome().blank())
|
||||
{
|
||||
const int space = _ragsoc.find(' ');
|
||||
if (space > 0)
|
||||
{
|
||||
TString80 nom = _ragsoc.mid(space+1);
|
||||
nom.cut(20);
|
||||
_ragsoc.cut(space);
|
||||
_ragsoc.insert(nom, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
_ragsoc.strip_double_spaces();
|
||||
}
|
||||
|
||||
bool TAnagrafica::init(const TRectype& rec)
|
||||
{
|
||||
_tipo = '\0';
|
||||
@ -97,7 +117,6 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
switch (rec.num())
|
||||
{
|
||||
case LF_OCCAS:
|
||||
_tipo = 'F';
|
||||
_cofi = rec.get(OCC_COFI);
|
||||
_paiv = rec.get(OCC_PAIV);
|
||||
if (_cofi.blank() || _paiv.blank())
|
||||
@ -115,7 +134,11 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
_loc_res = rec.get(OCC_LOCALITA);
|
||||
build_ind_res(rec, OCC_INDIR, OCC_CIV);
|
||||
_stato_estero = rec.get_int(OCC_STATO);
|
||||
_allegato = _paiv.blank() ? 6 : 2;
|
||||
if (_com_nasc.full() || (!_stato_estero && !real::is_natural(_cofi) || cf_check("", _cofi)))
|
||||
_tipo = 'F';
|
||||
else
|
||||
_tipo = 'G';
|
||||
_allegato = _tipo == 'F' ? 6 : 2;
|
||||
break;
|
||||
case LF_ANAG:
|
||||
_tipo = rec.get_char(ANA_TIPOA);
|
||||
@ -156,21 +179,20 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
if (ca > 0)
|
||||
return init(rec.get_char(CLI_TIPOCF), ca, EMPTY_STRING);
|
||||
}
|
||||
_tipo = rec.get_char(CLI_TIPOAPER);
|
||||
if (_tipo == 'F')
|
||||
|
||||
_tipo = ' '; // Non faccio assunzioni sulla persona fisica
|
||||
|
||||
if (rec.get_char(CLI_TIPOCF) == 'F') // Fornitore -> Percipiente
|
||||
{
|
||||
const long cod = rec.get_long(CLI_CODANAGPER);
|
||||
if (cod > 0 && init(LF_ANAG, _tipo, cod))
|
||||
{
|
||||
if (rec.get(CLI_COMNASC).not_empty())
|
||||
_com_nasc = rec.get(CLI_COMNASC);
|
||||
if (rec.get(CLI_DATANASC).not_empty())
|
||||
_data_nasc = rec.get(CLI_DATANASC);
|
||||
}
|
||||
_tipo = 'F'; // init could reset _tipo
|
||||
if (cod > 0)
|
||||
init(LF_ANAG, 'F', cod);
|
||||
if (rec.get(CLI_COMNASC).not_empty())
|
||||
_com_nasc = rec.get(CLI_COMNASC);
|
||||
if (rec.get(CLI_DATANASC).not_empty())
|
||||
_data_nasc = rec.get(CLI_DATANASC);
|
||||
}
|
||||
else
|
||||
_tipo = 'G';
|
||||
|
||||
// Assegno codice fiscale e partita IVA se validi, altrimenti mantengo quelli dell'anagrafica
|
||||
if (rec.get(CLI_COFI).not_empty())
|
||||
_cofi = rec.get(CLI_COFI);
|
||||
@ -182,6 +204,25 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
_ragsoc = rec.get(CLI_RAGSOC);
|
||||
_stato_estero = rec.get_int(CLI_STATOCF);
|
||||
_loc_res = rec.get(CLI_LOCCF);
|
||||
|
||||
if (_tipo != 'F' && _tipo != 'G')
|
||||
{
|
||||
switch (_allegato)
|
||||
{
|
||||
case 6: _tipo = 'F'; break;
|
||||
case 7: _tipo = 'G'; break;
|
||||
default:
|
||||
if (_com_nasc.full())
|
||||
_tipo = 'F';
|
||||
else
|
||||
{
|
||||
_tipo = rec.get_char(CLI_TIPOPERS);
|
||||
if (_tipo != 'F')
|
||||
_tipo = 'G';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LF_MOV:
|
||||
return init(rec.get_char(MOV_TIPO), rec.get_long(MOV_CODCF), rec.get(MOV_OCFPI));
|
||||
@ -191,9 +232,7 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
CHECKD(false, "Record non valido per TAnagrafica ", rec.num());
|
||||
break;
|
||||
}
|
||||
|
||||
if (_tipo == 'G') // Per le persone fisiche devo mantenere la netta separazione tra cognome e nome
|
||||
_ragsoc.strip_double_spaces();
|
||||
split_ragsoc();
|
||||
|
||||
return _tipo == 'F' || _tipo == 'G';
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ class TAnagrafica : public TObject
|
||||
TAnagrafica(const TAnagrafica&) { CHECK(false, "Can't copy TAnagrafica"); }
|
||||
protected:
|
||||
void build_ind_res(const TRectype& rec, const char* ind, const char* civ);
|
||||
|
||||
void split_ragsoc();
|
||||
|
||||
public:
|
||||
virtual bool ok() const { return _tipo=='F' || _tipo == 'G'; }
|
||||
bool fisica() const { return _tipo == 'F'; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user