Bug fix inserimento movimenti prima nota

This commit is contained in:
Men Simone 2022-01-04 15:30:12 +01:00
parent 824f84e02e
commit b58ed98aac
2 changed files with 10 additions and 4 deletions

View File

@ -1711,7 +1711,11 @@ int TPrimanota_application::write(const TMask& m)
int TPrimanota_application::rewrite(const TMask& m) int TPrimanota_application::rewrite(const TMask& m)
{ {
if (cached_causale(_rel->file().get(MOV_CODCAUS), _rel->file().get_int(MOV_ANNOES)).reverse_charge_pubb()) const TString & cod_caus = _rel->file().get(MOV_CODCAUS);
const int anno = _rel->file().get_int(MOV_ANNOES);
const TCausale & caus = cached_causale(cod_caus, anno);
if (caus.reverse_charge_pubb())
{ {
const long movcoll = m.get_long(F_MOVCOLL); const long movcoll = m.get_long(F_MOVCOLL);

View File

@ -362,7 +362,7 @@ void TCausale::calcIVA()
i = ri; i = ri;
if (i != ri) if (i != ri)
{ {
error_box(FR("Tipo documento '%s' incompatibile con tipo registro (registo %s)"), (const char*) td, (const char*) codice_registro()); error_box(FR("Tipo documento '%s' incompatibile con tipo registro (registro %s)"), (const char*) td, (const char*) codice_registro());
i = iva_errata; i = iva_errata;
} }
c = tpd.get_bool("B0"); // B0 flag corrispettivi c = tpd.get_bool("B0"); // B0 flag corrispettivi
@ -456,8 +456,10 @@ TObject* TCache_causale::key2obj(const char* key)
const TCausale & TCache_causale::caus(const char* key, const int anno) const TCausale & TCache_causale::caus(const char* key, const int anno)
{ {
TToken_string k(key); TToken_string k;
k.add(anno);
k.add(key);
k.add(anno, 1);
return (const TCausale &)*objptr(k); return (const TCausale &)*objptr(k);
} }