Patch level : 4.0 604
Files correlati : ve0.exe ve6.exe Ricompilazione Demo : [ ] Commento : Corretta COntabilizzazione analitica git-svn-id: svn://10.65.10.50/trunk@14843 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
672d00c7b2
commit
a0e8995ee5
@ -486,6 +486,7 @@ class TContabilizzazione_analitica : public TElaborazione // velib04f
|
||||
TToken_string _search_seq;
|
||||
TBill _sco_perc_bill_an, _sco_imp_bill_an;
|
||||
TCache_causali* _caus;
|
||||
TString16 _fld_cms_cont;
|
||||
|
||||
error_type _error; // Errore rilevato durante l'elaborazione
|
||||
bool _usepdcc;
|
||||
|
@ -20,32 +20,56 @@ protected:
|
||||
TObject* key2obj(const char* key);
|
||||
|
||||
public:
|
||||
const TCausale& causale(const TDocumento& doc);
|
||||
const TCausale& causale(const TDocumento& doc, const TString & fld_cms);
|
||||
TCache_causali() : TCache(17) { }
|
||||
};
|
||||
|
||||
TObject* TCache_causali::key2obj(const char* key)
|
||||
{
|
||||
TToken_string k = key;
|
||||
const int year = k.get_int(1);
|
||||
TString cod = k.get(0);
|
||||
TToken_string k(key);
|
||||
TString4 cod;
|
||||
k.get(0, cod);
|
||||
cod.trim();
|
||||
int year; k.get(1, year);
|
||||
return new TCausale(cod, year);
|
||||
}
|
||||
|
||||
const TCausale& TCache_causali::causale(const TDocumento& doc)
|
||||
const TCausale& TCache_causali::causale(const TDocumento& doc, const TString & fld_cms)
|
||||
{
|
||||
TString4 codcaus;
|
||||
TToken_string key;
|
||||
|
||||
if (!fld_cms.blank())
|
||||
{
|
||||
const TString & cms = doc.commessa_principale();
|
||||
|
||||
if (!cms.blank())
|
||||
{
|
||||
key.add(cms);
|
||||
const TString16 fld_val = cache().get(LF_COMMESSE, key, fld_cms);
|
||||
|
||||
if (!fld_val.blank())
|
||||
{
|
||||
key = "CTCMS";
|
||||
key.add(doc.tipo().codice());
|
||||
key.add(fld_val);
|
||||
codcaus = cache().get(LF_MULTIREL, key, "DATA");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (codcaus.blank())
|
||||
{
|
||||
// Cerca il codice causale sul cliente
|
||||
const char* const fld = doc.is_nota_credito() ? CFV_CODCAUSNC : CFV_CODCAUS;
|
||||
|
||||
TString16 key;
|
||||
key.format("%c|%ld", doc.get_char(DOC_TIPOCF), doc.get_long(DOC_CODCF));
|
||||
TString4 codcaus = cache().get(LF_CFVEN, key, fld);
|
||||
codcaus = cache().get(LF_CFVEN, key, fld);
|
||||
if (codcaus.blank()) // Se non lo trova guarda sul tipo documento
|
||||
{
|
||||
const TTipo_documento& tipo = doc.tipo();
|
||||
codcaus = tipo.causale();
|
||||
}
|
||||
}
|
||||
|
||||
//Assegna l'anno della causale
|
||||
const int year = doc.get_date(DOC_DATADOC).year();
|
||||
@ -61,7 +85,7 @@ const TCausale& TCache_causali::causale(const TDocumento& doc)
|
||||
const TCausale& TContabilizzazione_analitica::doc2caus(const TDocumento& doc)
|
||||
{
|
||||
CHECK(_caus, "Cache nulla");
|
||||
return _caus->causale(doc);
|
||||
return _caus->causale(doc, _fld_cms_cont);
|
||||
}
|
||||
|
||||
const TCausale& TContabilizzazione_analitica::rdoc2caus(const TRiga_documento& rdoc)
|
||||
@ -446,9 +470,10 @@ bool TContabilizzazione_analitica::elabora(TDocumento& doc, long numreg_cg, TVis
|
||||
}
|
||||
else
|
||||
{
|
||||
TEsercizi_contabili esc;
|
||||
datadoc = doc.get(DOC_DATADOC);
|
||||
datareg = datacomp = datadoc;
|
||||
annoes = datareg.year();
|
||||
annoes = esc.date2esc(datareg);
|
||||
doc.riferimento(descr);
|
||||
if (descr.empty())
|
||||
descr = doc.tipo().descrizione();
|
||||
@ -701,6 +726,7 @@ void TContabilizzazione_analitica::init()
|
||||
gr = conf.get_int("SCOIMCODCON","ve",1);
|
||||
co = conf.get_int("SCOIMCODCON","ve",2);
|
||||
so = conf.get_long("SCOIMCODCON","ve",3);
|
||||
_fld_cms_cont = conf.get("CMSCNTFIELD","ve");
|
||||
_sco_imp_bill_an.set(gr,co,so);
|
||||
|
||||
_caus = new TCache_causali;
|
||||
|
Loading…
x
Reference in New Issue
Block a user