Patch level : 10.0
Files correlati : fe0.exe Ricompilazione Demo : [ ] Commento : Corretta gestione persone fisiche git-svn-id: svn://10.65.10.50/branches/R_10_00@22526 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3ff0294297
commit
20c4cc5bc9
@ -30,7 +30,7 @@ const long MANUAL_ROW = 900000L;
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
static real importo_limite(int anno)
|
||||
{ return anno > 2010 ? 3000: 25000; }
|
||||
{ return anno > 2010 ? 3000.0 : 25000.0; }
|
||||
|
||||
static bool is_nota_variazione(const TRectype& mov)
|
||||
{
|
||||
@ -103,12 +103,18 @@ protected:
|
||||
|
||||
public:
|
||||
virtual bool ok() const { return !_rec.empty(); }
|
||||
const TString& codice() const { return _rec.get("CODTAB").mid(7); }
|
||||
const TString& chiave() const { return _rec.get("CODTAB"); }
|
||||
const TString& codice() const { return chiave().mid(7); }
|
||||
const TString& codice_padre() const { return _rec.get("S1"); }
|
||||
const TString& codice_base() const;
|
||||
bool totale_annuale(int anno, real& importo, real& imposta) const;
|
||||
int modalita_pagamento() const;
|
||||
|
||||
bool init(const TString& codtab);
|
||||
bool init(char tipocf, long codcf, const TString& codcont);
|
||||
bool init(const TRectype& rec);
|
||||
|
||||
TContratto() : _rec(LF_TABMOD) {}
|
||||
TContratto(char tipocf, long codcf, const char* codcont) : _rec(LF_TABMOD) { init(tipocf, codcf, codcont); }
|
||||
TContratto(const TRectype& rec) : _rec(LF_TABMOD) { init(rec); }
|
||||
};
|
||||
@ -193,16 +199,33 @@ int TContratto::modalita_pagamento() const
|
||||
return modpag;
|
||||
}
|
||||
|
||||
const TString& TContratto::codice_base() const
|
||||
{
|
||||
TString80 c = codice();
|
||||
TString80 p = codice_padre();
|
||||
while (p.full())
|
||||
{
|
||||
c = p;
|
||||
TString80 key = chiave().left(7);
|
||||
key << p;
|
||||
p = cache().get("&CON", key, "S1");
|
||||
}
|
||||
return get_tmp_string() = c;
|
||||
}
|
||||
|
||||
bool TContratto::init(const TString& codtab)
|
||||
{ return init(cache().get("&CON", codtab)); }
|
||||
|
||||
bool TContratto::init(char tipocf, long codcf, const TString& codcont)
|
||||
{
|
||||
if (tipocf >= 'C' && codcf > 0 && codcont.full())
|
||||
{
|
||||
TString80 key; key.format("%c%6ld%s", tipocf, codcf, (const char*)codcont);
|
||||
init(cache().get("&CON", key));
|
||||
return init(key);
|
||||
}
|
||||
else
|
||||
_rec.zero();
|
||||
return ok();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TContratto::init(const TRectype& rec)
|
||||
@ -258,12 +281,43 @@ bool TContratto::init(const TRectype& rec)
|
||||
// TDati_rilevanti_array
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TBase_contract_cache : public TCache
|
||||
{
|
||||
TContratto _c;
|
||||
|
||||
protected:
|
||||
virtual TObject* key2obj(const char* c);
|
||||
|
||||
public:
|
||||
const TString& base_contract(const TRectype& a);
|
||||
};
|
||||
|
||||
TObject* TBase_contract_cache::key2obj(const char* c)
|
||||
{
|
||||
const TFixed_string codice (c);
|
||||
_c.init(codice);
|
||||
return new TString(_c.codice_base());
|
||||
}
|
||||
|
||||
const TString& TBase_contract_cache::base_contract(const TRectype& a)
|
||||
{
|
||||
const char* cod = a.get(ALL_CONTRATTO);
|
||||
if (*cod > ' ')
|
||||
{
|
||||
_c.init(a);
|
||||
return *(TString*)objptr(_c.chiave());
|
||||
}
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
class TDati_rilevanti_array : public TObject
|
||||
{
|
||||
TArray _data;
|
||||
TBase_contract_cache _base;
|
||||
|
||||
protected:
|
||||
TExclusion_mode segnala_riga(const TRectype& alleg, TExclusion_mode motivo, TLog_report& log) const;
|
||||
const TString& get_base_contract(const TRectype& alleg);
|
||||
|
||||
public:
|
||||
int items() const { return _data.items(); }
|
||||
@ -286,7 +340,6 @@ TExclusion_mode TDati_rilevanti_array::segnala_riga(const TRectype& alleg, TExcl
|
||||
return motivo;
|
||||
}
|
||||
|
||||
|
||||
TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all, TLog_report& log)
|
||||
{
|
||||
TExclusion_mode ignora = TExclusion_mode(alleg.get_int(ALL_IGNORA));
|
||||
@ -325,7 +378,7 @@ TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all,
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString80 contratto = alleg.get(ALL_CONTRATTO);
|
||||
const TString80 contratto = get_base_contract(alleg);
|
||||
if (ignora <= em_importo_limite)
|
||||
{
|
||||
const int anno = alleg.get_int(ALL_ANNO);
|
||||
@ -355,6 +408,12 @@ TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all,
|
||||
return em_incluso;
|
||||
}
|
||||
|
||||
const TString& TDati_rilevanti_array::get_base_contract(const TRectype& alleg)
|
||||
{
|
||||
CHECKD(alleg.num() == LF_ALLEG, "Record non valido ", alleg.num());
|
||||
return _base.base_contract(alleg);
|
||||
}
|
||||
|
||||
void TDati_rilevanti_array::add(TArray& fatture, TArray& note, bool send_all, TLog_report& log)
|
||||
{
|
||||
// Cerca di scalare le note dalle relative fatture
|
||||
@ -378,17 +437,18 @@ void TDati_rilevanti_array::add(TArray& fatture, TArray& note, bool send_all, TL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cerca di raggruppare le fatture per contratto
|
||||
FOR_EACH_ARRAY_ITEM_BACK(fatture, c, pcont)
|
||||
{
|
||||
const TRectype& cont = *(const TRectype*)pcont;
|
||||
const TString80 contratto = cont.get(ALL_CONTRATTO);
|
||||
const TString80 contratto = get_base_contract(cont);
|
||||
if (contratto.full())
|
||||
{
|
||||
FOR_EACH_ARRAY_ITEM(fatture, f, pfatt) if (f < c)
|
||||
{
|
||||
TRectype& fatt= *(TRectype*)pfatt;
|
||||
if (fatt.get(ALL_CONTRATTO) == contratto)
|
||||
if (get_base_contract(fatt) == contratto)
|
||||
{
|
||||
fatt.add(ALL_IMPORTO, cont.get_real(ALL_IMPORTO));
|
||||
fatt.add(ALL_IMPOSTA, cont.get_real(ALL_IMPOSTA));
|
||||
|
18
fe/felib.cpp
18
fe/felib.cpp
@ -30,7 +30,7 @@ static const TString& comune_di(const TString& codcom)
|
||||
TString& den = get_tmp_string();
|
||||
den = cache().get(LF_COMUNI, key, COM_DENCOM);
|
||||
den.cut(40);
|
||||
|
||||
den.trim();
|
||||
return den;
|
||||
}
|
||||
|
||||
@ -39,7 +39,10 @@ static const TString& provincia_di(const TString& codcom)
|
||||
if (codcom.blank() || codcom.len() != 4)
|
||||
return EMPTY_STRING;
|
||||
TString8 key; key << '|' << codcom;
|
||||
return cache().get(LF_COMUNI, key, COM_PROVCOM);
|
||||
TString& prov = get_tmp_string();
|
||||
prov = cache().get(LF_COMUNI, key, COM_PROVCOM);
|
||||
if (prov.len() > 2) prov = "RM";
|
||||
return prov;
|
||||
}
|
||||
|
||||
const TString& TAnagrafica::comune_nascita() const
|
||||
@ -174,7 +177,8 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
break;
|
||||
}
|
||||
|
||||
_ragsoc.strip_double_spaces();
|
||||
if (_tipo == 'G') // Per le persone fisiche devo mantenere la netta separazione tra cognome e nome
|
||||
_ragsoc.strip_double_spaces();
|
||||
|
||||
return _tipo == 'F' || _tipo == 'G';
|
||||
}
|
||||
@ -676,26 +680,26 @@ TObject* TCofi_cache::key2obj(const char* key)
|
||||
|
||||
const TString& TCofi_cache::cofi2ragsoc(char tipocf, const TString& cofi)
|
||||
{
|
||||
const TString* ragsoc = NULL;
|
||||
const TString* ragsoc = &EMPTY_STRING;
|
||||
if (cofi.full())
|
||||
{
|
||||
TString80 key;
|
||||
key.format("CF|%c|%s", tipocf, (const char*)cofi);
|
||||
ragsoc = (const TString*)objptr(key);
|
||||
}
|
||||
return ragsoc ? *ragsoc : EMPTY_STRING;
|
||||
return *ragsoc;
|
||||
}
|
||||
|
||||
const TString& TCofi_cache::paiv2ragsoc(char tipocf, const TString& paiv)
|
||||
{
|
||||
const TString* ragsoc = NULL;
|
||||
const TString* ragsoc = &EMPTY_STRING;
|
||||
if (paiv.full())
|
||||
{
|
||||
TString80 key;
|
||||
key.format("PI|%c|%s", tipocf, (const char*)paiv);
|
||||
ragsoc = (const TString*)objptr(key);
|
||||
}
|
||||
return ragsoc ? *ragsoc : EMPTY_STRING;
|
||||
return *ragsoc;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user