Patch level : 12.00 1278

Files correlati     : ca3.exe ca3*.msk
Commento            :

La stampa del bilancio di commessa non considerava bene le fatture da ricevere evase.
This commit is contained in:
Alessandro Bonazzi 2023-08-24 01:13:23 +02:00
parent c76d0ba018
commit 0af5c753c9
2 changed files with 51 additions and 0 deletions

View File

@ -684,6 +684,9 @@ public:
const TRectype* find_original_rdoc() const;
const TRectype* find_original_doc() const;
const TRectype* find_son_rdoc() const;
const TRectype* find_son_doc() const;
void set_final_rdoc_key(const TRectype& orig);
void reset_final_rdoc_key();
const TRectype* find_final_rdoc() const;

View File

@ -1791,6 +1791,7 @@ void TRiga_documento::reset_original_rdoc_key()
const TRectype* TRiga_documento::find_original_rdoc() const
{
const long id = get_long(RDOC_DAIDRIGA);
if (id > 0L)
{
TToken_string key;
@ -1817,6 +1818,7 @@ const TRectype* TRiga_documento::find_original_rdoc() const
const TRectype* TRiga_documento::find_original_doc() const
{
const long id = get_long(RDOC_DANDOC);
if (id > 0L)
{
TToken_string key;
@ -1831,6 +1833,52 @@ const TRectype* TRiga_documento::find_original_doc() const
return NULL;
}
const TRectype* TRiga_documento::find_son_rdoc() const
{
const long id = get_long(RDOC_IDRIGA);
if (id > 0L)
{
TToken_string key;
key.add(get(RDOC_PROVV));
key.add(get(RDOC_ANNO));
key.add(get(RDOC_CODNUM));
key.add(get(RDOC_NDOC));
for (int r = 0; ; r++)
{
if (r == 0)
key.add(id, 4);
else
key.add(r, 4);
const TRectype& rec = cache().get(LF_RIGHEDOC, key, 4);
if (r > 0 && rec.empty())
break;
if (rec.get_long(RDOC_DAIDRIGA) == id)
return &rec;
}
}
return nullptr;
}
const TRectype* TRiga_documento::find_son_doc() const
{
const TRectype * son_row = find_son_rdoc();
if (son_row != nullptr)
{
TToken_string key;
key.add(son_row->get(RDOC_PROVV));
key.add(son_row->get(RDOC_ANNO));
key.add(son_row->get(RDOC_CODNUM));
key.add(son_row->get(RDOC_NDOC));
const TRectype& rec = cache().get(LF_DOC, key);
if (rec.not_empty())
return &rec;
}
return nullptr;
}
void TRiga_documento::set_final_rdoc_key(const TRectype& dest)
{
CHECK(dest.num() == num(), "Bad document row");