Patch level : 10.0

Files correlati     : lv2 lv3
Ricompilazione Demo : [ ]
Commento            :
Correzioni di Guido


git-svn-id: svn://10.65.10.50/trunk@20008 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca83 2010-01-28 15:22:15 +00:00
parent ee97a1cc06
commit c46620fa4c

View File

@ -137,30 +137,38 @@ class TMov_mag_doc : public TMov_mag
TString_array _codmagc;
protected:
virtual const char * codmag_rauto(int r) const;
virtual const char* codmag_rauto(int r) const;
public:
void add_magc(const char* magc) { _codmagc.add(magc); }
void add_magc(const char* magc)
{
CHECKS(magc && *magc && strlen(magc) <= 5, "Invalid CODMAG ", magc);
_codmagc.add(magc);
}
};
const char* TMov_mag_doc::codmag_rauto(int r) const
{
const TRecord_array& b = body();
if (r <= 0 || r > b.rows()) // Can't check non-existent rows
return NULL;
const char tr = b[r].get_char(RMOVMAG_TIPORIGA);
if (tr != 'D' && tr != 'A') // These are customer's added rows
return NULL;
int j = -1; // Indice per reperire il mag. collegato da _codmagc
for (int i = r; i > 0; i--) // Scorre dalla riga r in su e conta quante righe D
if (b[i].get_char(RMOVMAG_TIPORIGA) == 'D')
j++;
return j >= 0 && j < _codmagc.items() ? _codmagc.row(j) : NULL;
const char* codmagc = NULL;
const int num_magc = _codmagc.items();
if (num_magc > 0) // Impossibile trovare un codmagc
{
const TRecord_array& b = body();
if (r > 0 && r <= b.rows()) // Can't check non-existent rows
{
const char tr = b[r].get_char(RMOVMAG_TIPORIGA);
if (tr == 'D' || tr == 'A') // These are customer's added rows
{
int j = -1; // Indice per reperire il mag. collegato da _codmagc
for (int i = r; i > 0; i--) // Scorre dalla riga r in su e conta quante righe D
if (b[i].get_char(RMOVMAG_TIPORIGA) == 'D')
j++;
if (j >= 0 && j < num_magc)
codmagc = _codmagc.row(j);
}
}
}
return codmagc;
}
/////////////////////////////////////////////////////////////