Milgiore gestione indirizzi anagrafiche per fe e pa

git-svn-id: svn://10.65.10.50/branches/R_10_00@22979 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2014-07-30 12:56:02 +00:00
parent 811f84501b
commit f7b3d60860
3 changed files with 30 additions and 16 deletions

View File

@ -1,4 +1,4 @@
// gestione tabelle di modulo contabilità
// gestione tabelle di modulo FE
#include <automask.h>
#include <modtbapp.h>

View File

@ -170,18 +170,30 @@ const TString& TAnagrafica::provincia_residenza() const
void TAnagrafica::build_ind_res(const TRectype& rec, const char* ind, const char* civ)
{
TString80 indirizzo = rec.get(ind);
if (indirizzo.full())
_via_res = _ind_res = rec.get(ind);
_civ_res = rec.get(civ);
if (_civ_res.blank())
{
const TString& numero = rec.get(civ);
if (numero.full())
indirizzo << ", " << numero;
indirizzo.strip_double_spaces();
TParagraph_string s(indirizzo, 40);
_ind_res = s.get(0);
const int comma = _via_res.rfind(',');
if (comma > 0 && _via_res.len()-comma <= 8)
{
_civ_res = _via_res.mid(comma+1); _civ_res.trim();
_via_res.cut(comma); _via_res.trim();
}
}
// Sistema persone senza stato ma con comune estero
if (_via_res.full())
{
TString80 ind = _via_res;
if (_civ_res.full())
ind << ", " << _civ_res;
ind.strip_double_spaces();
TParagraph_string s(ind, 40);
_ind_res = s.get(0); // prende solo i primi 40 caratteri dell'indirizzo completo
}
// Sistema persone senza codice stato, ma residenti in comune estero
if (_stato_estero <= 0 && is_stato_estero(_com_res))
{
const TString80 naz = comune_di(_com_res, 0);
@ -304,6 +316,7 @@ bool TAnagrafica::init(const TRectype& rec)
_stato_estero = rec.get_int(OCC_STATO);
_com_res = rec.get(OCC_COM);
_loc_res = rec.get(OCC_LOCALITA);
_cap_res = rec.get(OCC_CAP);
build_ind_res(rec, OCC_INDIR, OCC_CIV);
if (_com_nasc.full() || (!_stato_estero && !real::is_natural(_cofi) || cf_check("", _cofi)))
_tipo = 'F';
@ -323,6 +336,7 @@ bool TAnagrafica::init(const TRectype& rec)
if (_com_res.empty())
_com_res = rec.get(ANA_COMRES);
build_ind_res(rec, ANA_INDRES, ANA_CIVRES);
_cap_res = rec.get(ANA_CAPRES);
// Dati di nascita persone fisiche
if (_tipo == 'F')
@ -371,10 +385,6 @@ bool TAnagrafica::init(const TRectype& rec)
{
_data_nasc = rec.get(CLI_DATANASC);
_tipo = 'F';
#ifdef DBG
if (rec.get(CLI_RAGSOC).starts_with("ACAR"))
int cazzone_estero = 1;
#endif
}
if (_com_nasc.blank())
@ -430,7 +440,7 @@ bool TAnagrafica::init(const TRectype& rec)
// Prevale sempre la ragione sociale del cliente: "Il cliente ha sempre ragione".
_ragsoc = rec.get(CLI_RAGSOC);
_loc_res = rec.get(CLI_LOCCF);
_cap_res = rec.get(CLI_CAPCF);
_stato_estero = rec.get_int(CLI_STATOCF);
if (_stato_estero <= 0 && (_allegato == 5 || _allegato == 9)) // Estero CEE o extra-CEE
_stato_estero = -1; // Stato estero ignoto

View File

@ -19,7 +19,8 @@ class TAnagrafica : public TObject
TString16 _cofi, _paiv;
TString80 _ragsoc;
TString4 _com_nasc, _com_res;
TString80 _loc_res, _ind_res;
TString80 _loc_res, _ind_res, _via_res;
TString16 _civ_res, _cap_res;
TDate _data_nasc;
int _allegato, _stato_estero, _stato_nasc;
@ -55,6 +56,9 @@ public:
const TString& provincia_residenza() const;
const TString& localita_residenza() const { return _loc_res; }
const TString& indirizzo_residenza() const { return _ind_res; }
const TString& via_residenza() const { return _via_res; }
const TString& civico_residenza() const { return _civ_res; }
const TString& CAP_residenza() const { return _cap_res; }
bool init(const TRectype& rec);
bool init(int num, const TString& codice);