Patch level : 12.0 1190

Files correlati     : cg2.exe
Commento:
modificato il metodo di aggiornamento dell'ultimo protocollo dei registri controllare le regolarizzazioni
This commit is contained in:
Alessandro Bonazzi 2022-09-08 01:09:40 +02:00
parent 27c6cb6ef5
commit ebacbbfba6
4 changed files with 64 additions and 54 deletions

View File

@ -371,6 +371,7 @@ void TCausale::calcIVA()
if (td.full()) if (td.full())
{ {
const TRectype& tpd = cache().get("%TPD", td); const TRectype& tpd = cache().get("%TPD", td);
if (!tpd.empty()) if (!tpd.empty())
{ {
i = (TipoIVA) tpd.get_int("I0"); // IVA acquisti, vendite, generica i = (TipoIVA) tpd.get_int("I0"); // IVA acquisti, vendite, generica
@ -450,35 +451,36 @@ bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TCache_causali // TCache_causali
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TCache_causale : public TCache class TCache_causale : public TFile_cache
{ {
int _year;
protected: protected:
virtual TObject* key2obj(const char* key); virtual TObject* rec2obj(const TRectype & rec) const;
public: public:
const TCausale & caus(const char* key, const int anno = 0); const TCausale & caus(const char* cod, const int anno = 0);
TCache_causale() : TCache() { } TCache_causale() : TFile_cache(LF_CAUSALI), _year(0) { }
virtual ~TCache_causale() { } virtual ~TCache_causale() { }
}; };
TObject* TCache_causale::key2obj(const char* key) TObject* TCache_causale::rec2obj(const TRectype & rec) const
{ {
TToken_string k(key); TString4 cod = rec.get(CAU_CODCAUS);
TString4 cod;
k.get(0, cod);
cod.trim(); cod.trim();
int year; k.get(1, year); return new TCausale(cod, _year);
return new TCausale(cod, year);
} }
const TCausale & TCache_causale::caus(const char* key, const int anno) const TCausale & TCache_causale::caus(const char* cod, const int anno)
{ {
TToken_string k; TToken_string key;
k.add(key); key.add(cod);
k.add(anno, 1); key.add(anno, 1);
return (const TCausale &)*objptr(k); _year = anno;
return (const TCausale &)query(key);
} }
const TCausale & cached_causale(const char * codcaus, int year) const TCausale & cached_causale(const char * codcaus, int year)
@ -1063,37 +1065,40 @@ bool TRegistro::update(long protiva, const TDate& datareg)
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TCache_registri // TCache_registri
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TCache_registri : public TCache class TCache_registri : public TFile_cache
{ {
protected: protected:
virtual TObject* key2obj(const char* key); virtual TObject* rec2obj(const TRectype& rec) const;
public: public:
const TRegistro & registro(const char* key, const int anno = 0); const TRegistro & registro(const char* cod, const int anno = 0);
TCache_registri() : TCache() { } TCache_registri() : TFile_cache("REG") { }
virtual ~TCache_registri() { } virtual ~TCache_registri() { }
}; };
TObject* TCache_registri::key2obj(const char* key) TObject* TCache_registri::rec2obj(const TRectype& rec) const
{ {
TToken_string k(key); TString k = rec.get("CODTAB");
TString16 cod;
k.get(0, cod); return new TRegistro(k.mid(4), atoi(k.left(4)));
cod.trim();
int year;
k.get(1, year);
return new TRegistro(cod, year);
} }
const TRegistro & TCache_registri::registro(const char* key, const int anno) const TRegistro & TCache_registri::registro(const char* cod, const int anno)
{ {
TToken_string k(key);
k.add(anno); TToken_string key("REG");
return (const TRegistro &)*objptr(k); int year = anno;
if (year == 0)
year = ini_get_int(CONFIG_DITTA, "cg", "AnLiIv");
TString16 codtab;
codtab << format("%04d", year) << cod;
key.add(codtab);
return (const TRegistro &)query(key);
} }
const TRegistro & cached_registro(const char * codreg, int year) const TRegistro & cached_registro(const char * codreg, int year)
@ -1234,20 +1239,27 @@ bool TCodiceIVA::reverse_charge_pubb() const
} */ } */
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TCache_clifor // TCache_codIVA
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TCache_codIVA : public TCache class TCache_codIVA : public TFile_cache
{ {
protected: protected:
virtual TObject* key2obj(const char* key) { return new TCodiceIVA(key); } virtual TObject* rec2obj(const TRectype & rec) const { return new TCodiceIVA(rec.get("CODTAB")); }
public: public:
const TCodiceIVA & codIVA(const char * codice) { return (const TCodiceIVA &)*objptr(codice); } const TCodiceIVA & codIVA(const char * codice);
TCache_codIVA() : TFile_cache("%IVA") { }
TCache_codIVA() : TCache() { }
virtual ~TCache_codIVA() { } virtual ~TCache_codIVA() { }
}; };
const TCodiceIVA & TCache_codIVA::codIVA(const char * codice)
{
TToken_string key("IVA");
key.add(codice);
return (const TCodiceIVA &)query(key);
}
const TCodiceIVA & cached_codIVA(const char * codiva) const TCodiceIVA & cached_codIVA(const char * codiva)
{ {
HIDDEN TCache_codIVA __cache_codIVA; HIDDEN TCache_codIVA __cache_codIVA;
@ -2035,7 +2047,7 @@ int TMovimentoPN::registra(bool re, bool force)
{ {
TTable tab("%DET"); TTable tab("%DET");
tab.curr() = det; tab.curr() = det;
tab.curr().put("FPC", "X"); tab.curr().put("FPC", true);
tab.rewrite(); tab.rewrite();
} }
} }

View File

@ -917,9 +917,9 @@ void TSaldo_agg::clear_saldi(int year)
} }
else else
{ {
saldi.put(SLD_FLSCA, ""); saldi.put(SLD_FLSCA, false);
saldi.write(); saldi.write();
saldi.put(SLD_FLSCA, "X"); saldi.put(SLD_FLSCA, true);
saldi.read(_isequal,_unlock); saldi.read(_isequal,_unlock);
} }
} }

View File

@ -210,7 +210,7 @@ int TMovimento_contabile::write_rewrite(TBaseisamfile& f, bool re) const
{ {
TTable tab("%DET"); TTable tab("%DET");
tab.curr() = det; tab.curr() = det;
tab.curr().put("FPC", "X"); tab.curr().put("FPC", true);
tab.rewrite(); tab.rewrite();
} }
} }

View File

@ -593,34 +593,32 @@ bool TAnagrafica::init(char tipocf, long codice, const TString& ocfpi)
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TCache_clifor // TCache_clifor
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TCache_clifor : public TCache class TCache_clifor : public TFile_cache
{ {
protected: protected:
virtual TObject* key2obj(const char* key); virtual TObject* rec2obj(const TRectype & rec) const ;
public: public:
const TCli_for & clifor(const char tipo, const long codice); const TCli_for & clifor(const char tipo, const long codice);
TCache_clifor() : TCache() { } TCache_clifor() : TFile_cache(LF_CLIFO) { }
virtual ~TCache_clifor() { } virtual ~TCache_clifor() { }
}; };
TObject* TCache_clifor::key2obj(const char* key) TObject* TCache_clifor::rec2obj(const TRectype & rec) const
{ {
TToken_string k(key); const char tipo = rec.get_char(CLI_TIPOCF);
TString4 tipo; long codice = rec.get_long(CLI_CODCF);
long codice;
k.get(0, tipo); return new TCli_for(tipo, codice);
k.get(1, codice);
return new TCli_for(tipo[0], codice);
} }
const TCli_for & TCache_clifor::clifor(const char tipo, const long codice) const TCli_for & TCache_clifor::clifor(const char tipo, const long codice)
{ {
TToken_string k; k << tipo; TToken_string k; k << tipo;
k.add(codice); k.add(codice);
return (const TCli_for &)*objptr(k); return (const TCli_for &)query(k);
} }
const TCli_for & cached_clifor(const char tipo, long codice) const TCli_for & cached_clifor(const char tipo, long codice)