Patch level : 10.0

Files correlati     : fe0.exe
Ricompilazione Demo : [ ]
Commento            :
Migliorata associazione "colorata" delle note di variazione (segnalazione GOMBE)


git-svn-id: svn://10.65.10.50/branches/R_10_00@22565 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-01-27 16:59:21 +00:00
parent cdfb83ce80
commit 4be1ad68c1

View File

@ -1162,51 +1162,57 @@ void TDati_rilevanti_msk::alleg_sort(TSheet_field& s) const
const int c_importo = s.cid2index(A_IMPORTO);
const int tot = s.items();
for (int k = 0; k < 2; k++)
for (int i = tot-1; i >= 0; i--)
for (int k = 0; k < 3; k++)
{
const TString8 numrett = s.cell(i, c_numrett);
if (numrett.full() && numrett != INVALID_NUMDOC)
bool swapped = false; // Something swapped?
for (int i = tot-1; i >= 0; i--)
{
const long codcf_i = atol(s.cell(i, c_codcf));
int j = -1;
if (codcf_i == 37789)
int cazzone = 1;
// Cerca la fattura andando in su
for (j = i-1; j >= 0; j--)
const TString8 numrett = s.cell(i, c_numrett);
if (numrett.full() && numrett != INVALID_NUMDOC)
{
const long codcf_j = atol(s.cell(j, c_codcf));
if (codcf_j != codcf_i)
{
j = -1;
break;
}
if (numrett == s.cell(j, c_numdoc) || numrett == s.cell(j, c_numrett))
break;
}
if (j < 0) // Non l'ho trovata
{
// Cerca la fattura andando in giù
for (j = i+1; j < tot; j++)
const long codcf_i = atol(s.cell(i, c_codcf));
int j = -1;
if (codcf_i == 37789)
int cazzone = 1;
// Cerca la fattura andando in su
for (j = i-1; j >= 0; j--)
{
const long codcf_j = atol(s.cell(j, c_codcf));
if (codcf_j != codcf_i)
{
j = tot;
j = -1;
break;
}
if (numrett == s.cell(j, c_numdoc))
if (numrett == s.cell(j, c_numdoc) || numrett == s.cell(j, c_numrett))
break;
}
}
if (j >= 0 && j < tot) // L'ho trovata
{
s.move_row(i, j+1);
if (*s.cell(j, c_numrett) <= ' ')
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, NORMAL_COLOR, j, c_numdoc);
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, NORMAL_COLOR, j+1, c_numrett);
if (j < 0) // Non l'ho trovata
{
// Cerca la fattura andando in giù
for (j = i+1; j < tot; j++)
{
const long codcf_j = atol(s.cell(j, c_codcf));
if (codcf_j != codcf_i)
{
j = tot;
break;
}
if (numrett == s.cell(j, c_numdoc))
break;
}
}
if (j >= 0 && j < tot && i != j+1) // L'ho trovata
{
swapped = true;
s.move_row(i, j+1);
if (*s.cell(j, c_numrett) <= ' ')
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, NORMAL_COLOR, j, c_numdoc);
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, NORMAL_COLOR, j+1, c_numrett);
}
}
}
if (!swapped)
break; // No row swapping -> exit
}
}