Patch level : 10.0 718
Files correlati : cg2.exe Ricompilazione Demo : [ ] Commento : 0001605: 002416 - Pharmatex righe di sola contabilita in pagamento con saldaconto inserisco un pagamento di fattura fornitore in valuta, cui aggiungo delle righe di sola contabilità, in imputazione del fornitore mi viene calcolato un residuo, tentando di chiudere la registrazione da la mancata quadratura con la testata. Noto che sulle righe di sola contabilità non viene indicato il tipo riga e neppure le contropartite. Passaggi per riprodurre l'anomalia git-svn-id: svn://10.65.10.50/trunk@20392 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1046956d4a
commit
5d886904cb
@ -332,7 +332,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
|||||||
ivasheet.sheet_mask().enable(IVA_NOTAVARECF, show_notevar);
|
ivasheet.sheet_mask().enable(IVA_NOTAVARECF, show_notevar);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ins && !ci_sono_importi())
|
if (ins && !ci_sono_importi(cgsheet))
|
||||||
{
|
{
|
||||||
cgsheet.reset();
|
cgsheet.reset();
|
||||||
for (int i = 1; i < causale().size(); i++)
|
for (int i = 1; i < causale().size(); i++)
|
||||||
@ -1867,8 +1867,8 @@ void TPrimanota_application::dump_rec(TConfig & ini, const TRectype & rec, int r
|
|||||||
|
|
||||||
void TPrimanota_application::dump_fatt(TConfig& ini, TPartita & game, int rigafatt)
|
void TPrimanota_application::dump_fatt(TConfig& ini, TPartita & game, int rigafatt)
|
||||||
{
|
{
|
||||||
if (rigafatt > 0)
|
CHECKD(rigafatt > 0 && rigafatt < 9999, "Riga fattura errata ", rigafatt);
|
||||||
{
|
|
||||||
const TRiga_partite& riga = game.riga(rigafatt);
|
const TRiga_partite& riga = game.riga(rigafatt);
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -1895,7 +1895,6 @@ void TPrimanota_application::dump_fatt(TConfig& ini, TPartita & game, int rigafa
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
||||||
{
|
{
|
||||||
@ -1905,7 +1904,6 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
|||||||
for (i = 0; i < _rel->cg_items(); i++)
|
for (i = 0; i < _rel->cg_items(); i++)
|
||||||
{
|
{
|
||||||
const TRectype& rec = _rel->cg(i);
|
const TRectype& rec = _rel->cg(i);
|
||||||
|
|
||||||
dump_rec(ini, rec, i + 1);
|
dump_rec(ini, rec, i + 1);
|
||||||
}
|
}
|
||||||
for ( ; ini.set_paragraph(format("%d,%d", LF_RMOV, i+1)); i++)
|
for ( ; ini.set_paragraph(format("%d,%d", LF_RMOV, i+1)); i++)
|
||||||
@ -1914,7 +1912,6 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
|||||||
for (i = 0; i < _rel->iva_items(); i++)
|
for (i = 0; i < _rel->iva_items(); i++)
|
||||||
{
|
{
|
||||||
const TRectype& rec = _rel->iva(i);
|
const TRectype& rec = _rel->iva(i);
|
||||||
|
|
||||||
dump_rec(ini, rec, i + 1);
|
dump_rec(ini, rec, i + 1);
|
||||||
}
|
}
|
||||||
for ( ; ini.set_paragraph(format("%d,%d", LF_RMOVIVA, i+1)); i++)
|
for ( ; ini.set_paragraph(format("%d,%d", LF_RMOVIVA, i+1)); i++)
|
||||||
@ -1927,46 +1924,41 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
|||||||
if (is_fattura())
|
if (is_fattura())
|
||||||
{
|
{
|
||||||
TPartita* game = p.first();
|
TPartita* game = p.first();
|
||||||
|
|
||||||
if (game)
|
if (game)
|
||||||
{
|
{
|
||||||
const int rigafatt = game->prima_fattura(numreg);
|
const int rigafatt = game->prima_fattura(numreg);
|
||||||
|
if (rigafatt > 0 && rigafatt < 9999)
|
||||||
dump_fatt(ini, *game, rigafatt);
|
dump_fatt(ini, *game, rigafatt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TBit_array dumped;
|
|
||||||
|
|
||||||
for (TPartita* game = p.first(); game != NULL; game = p.next())
|
for (TPartita* game = p.first(); game != NULL; game = p.next())
|
||||||
{
|
{
|
||||||
|
TBit_array dumped;
|
||||||
const int rigapag = game->primo_pagamento(numreg);
|
const int rigapag = game->primo_pagamento(numreg);
|
||||||
|
|
||||||
if (rigapag > 0)
|
if (rigapag > 0)
|
||||||
{
|
{
|
||||||
TRiga_partite & riga = game->riga(rigapag);
|
// Ricava la lista dei pagamenti dal database invece di leggerli dalla struttura in memoria :-(
|
||||||
TCursor pag(new TRelation(LF_PAGSCA));
|
const TRiga_partite& riga = game->riga(rigapag);
|
||||||
TRectype filter(pag.curr());
|
TRelation rel(LF_PAGSCA);
|
||||||
|
TCursor pag(&rel);
|
||||||
|
TRectype& recpag = pag.curr();
|
||||||
|
|
||||||
filter.put(PAGSCA_TIPOC, riga.get(PART_TIPOCF));
|
recpag.put(PAGSCA_TIPOC, riga.get(PART_TIPOCF));
|
||||||
filter.put(PAGSCA_GRUPPO, riga.get(PART_GRUPPO));
|
recpag.put(PAGSCA_GRUPPO, riga.get(PART_GRUPPO));
|
||||||
filter.put(PAGSCA_CONTO, riga.get(PART_CONTO));
|
recpag.put(PAGSCA_CONTO, riga.get(PART_CONTO));
|
||||||
filter.put(PAGSCA_SOTTOCONTO, riga.get(PART_SOTTOCONTO));
|
recpag.put(PAGSCA_SOTTOCONTO, riga.get(PART_SOTTOCONTO));
|
||||||
filter.put(PAGSCA_ANNO, riga.get(PART_ANNO));
|
recpag.put(PAGSCA_ANNO, riga.get(PART_ANNO));
|
||||||
filter.put(PAGSCA_NUMPART, riga.get(PART_NUMPART));
|
recpag.put(PAGSCA_NUMPART, riga.get(PART_NUMPART));
|
||||||
pag.setregion(filter, filter);
|
pag.setregion(recpag, recpag);
|
||||||
const int items = pag.items();
|
const int items = pag.items();
|
||||||
|
|
||||||
for (pag = 0L; pag.pos() < items; ++pag)
|
for (pag = 0L; pag.pos() < items; ++pag)
|
||||||
{
|
{
|
||||||
const TRectype & recpag = pag.curr();
|
|
||||||
|
|
||||||
if (rigapag == recpag.get_int(PAGSCA_NRIGP))
|
if (rigapag == recpag.get_int(PAGSCA_NRIGP))
|
||||||
{
|
{
|
||||||
const int rigafatt = recpag.get_int(PAGSCA_NRIGA);
|
const int rigafatt = recpag.get_int(PAGSCA_NRIGA);
|
||||||
|
if (rigafatt > 0 && rigafatt < 9999 && !dumped[rigafatt])
|
||||||
if (rigafatt >= 0 && !dumped[rigafatt])
|
|
||||||
{
|
{
|
||||||
dump_fatt(ini, *game, rigafatt);
|
dump_fatt(ini, *game, rigafatt);
|
||||||
dumped.set(rigafatt);
|
dumped.set(rigafatt);
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
#include <doc.h>
|
#include <doc.h>
|
||||||
#include <occas.h>
|
#include <occas.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Funzioni di decodifica/calcolo
|
// Funzioni di decodifica/calcolo
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -26,8 +24,14 @@
|
|||||||
// Determina il tipo di una riga contabile in formato TToken_string
|
// Determina il tipo di una riga contabile in formato TToken_string
|
||||||
char TPrimanota_application::row_type(const TToken_string& s)
|
char TPrimanota_application::row_type(const TToken_string& s)
|
||||||
{
|
{
|
||||||
const int l = s.len()-1;
|
char t = ' ';
|
||||||
return l > 0 ? s[l] : ' ';
|
if (s.full())
|
||||||
|
{
|
||||||
|
t = s[s.len()-1];
|
||||||
|
if (t < 'A' || t > 'Z')
|
||||||
|
t = ' ';
|
||||||
|
}
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determina il tipo IVA da causale+anno
|
// Determina il tipo IVA da causale+anno
|
||||||
@ -211,8 +215,7 @@ TSheet_field& TPrimanota_application::cgs() const
|
|||||||
{
|
{
|
||||||
const TMask* m = _msk[_iva == nessuna_iva ? 1 : 2];
|
const TMask* m = _msk[_iva == nessuna_iva ? 1 : 2];
|
||||||
CHECK(m, "Null cgs() mask");
|
CHECK(m, "Null cgs() mask");
|
||||||
TSheet_field& s = m->sfield(F_SHEETCG);
|
return m->sfield(F_SHEETCG);
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -459,33 +462,35 @@ void TPrimanota_application::cgs_pack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TPrimanota_application::ci_sono_importi() const
|
bool TPrimanota_application::ci_sono_importi(const TSheet_field& s) const
|
||||||
{
|
{
|
||||||
const int rows = cgs().items();
|
if (s.items() > 0)
|
||||||
for (int i = 0; i < rows; i++)
|
|
||||||
{
|
{
|
||||||
const TImporto imp = get_cgs_imp(i);
|
TImporto imp;
|
||||||
|
FOR_EACH_SHEET_ROW(s, r, riga);
|
||||||
|
{
|
||||||
|
imp = *riga;
|
||||||
if (!imp.is_zero())
|
if (!imp.is_zero())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
real TPrimanota_application::calcola_saldo() const
|
real TPrimanota_application::calcola_saldo() const
|
||||||
{
|
{
|
||||||
TImporto importo, bilancio, saldaconto;
|
|
||||||
const bool pag = is_pagamento() && !_as400;
|
const bool pag = is_pagamento() && !_as400;
|
||||||
|
TImporto importo, bilancio, saldaconto;
|
||||||
|
|
||||||
TString_array& rows = cgs().rows_array();
|
TSheet_field& cgrows = cgs();
|
||||||
for (int i = rows.last(); i >= 0; i--)
|
FOR_EACH_SHEET_ROW_BACK(cgrows, i, r)
|
||||||
{
|
{
|
||||||
TToken_string& r = rows.row(i);
|
importo = *r;
|
||||||
importo = r;
|
|
||||||
bilancio += importo;
|
bilancio += importo;
|
||||||
if (pag)
|
if (pag)
|
||||||
{
|
{
|
||||||
const char tipo = row_type(r);
|
const char tipo = row_type(*r);
|
||||||
if (strchr("ACGKP", tipo) != NULL) // Abbuoni attivi, differenze cambio,
|
if (strchr("ACGKP", tipo) != NULL) // Abbuoni attivi, differenze cambio, spese, ...
|
||||||
saldaconto += importo;
|
saldaconto += importo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ protected:
|
|||||||
|
|
||||||
void ivas_pack();
|
void ivas_pack();
|
||||||
void cgs_pack();
|
void cgs_pack();
|
||||||
bool ci_sono_importi() const;
|
bool ci_sono_importi(const TSheet_field& cgs) const;
|
||||||
real calcola_saldo() const;
|
real calcola_saldo() const;
|
||||||
real calcola_imp() const;
|
real calcola_imp() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user