Patch level : 10.0 no patch
Files correlati : Ricompilazione Demo : [ ] Commento : Habilita git-svn-id: svn://10.65.10.50/branches/R_10_00@21155 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4202720a55
commit
5a2a236544
@ -2763,6 +2763,18 @@ bool ca_can_merge_rows(const TRectype& compact_rec, const TRectype& rec)
|
||||
compact_rec.get(RMOVANA_CODCONTORI) == rec.get(RMOVANA_CODCONTORI);
|
||||
}
|
||||
|
||||
bool ca_can_pack_rows(const TRectype& compact_rec, const TRectype& rec)
|
||||
{
|
||||
return compact_rec.get(RMOVANA_CODCCOSTO) == rec.get(RMOVANA_CODCCOSTO) &&
|
||||
compact_rec.get(RMOVANA_CODCMS) == rec.get(RMOVANA_CODCMS) &&
|
||||
compact_rec.get(RMOVANA_CODFASE) == rec.get(RMOVANA_CODFASE) &&
|
||||
compact_rec.get(RMOVANA_CODCONTO) == rec.get(RMOVANA_CODCONTO)&&
|
||||
compact_rec.get(RMOVANA_CODCCORI) == rec.get(RMOVANA_CODCCORI) &&
|
||||
compact_rec.get(RMOVANA_CODCMSORI) == rec.get(RMOVANA_CODCMSORI) &&
|
||||
compact_rec.get(RMOVANA_CODFASEORI) == rec.get(RMOVANA_CODFASEORI) &&
|
||||
compact_rec.get(RMOVANA_CODCONTORI) == rec.get(RMOVANA_CODCONTORI);
|
||||
}
|
||||
|
||||
bool ca_ori_present(const TRectype& rec)
|
||||
{
|
||||
return (rec.get(RMOVANA_CODCCORI).not_empty() || rec.get(RMOVANA_CODCMSORI).not_empty() ||
|
||||
|
@ -255,6 +255,7 @@ bool ca_implode_rows(const TRecord_array& input_rows, TRecord_array& compact_row
|
||||
bool ca_ori_present(const TRectype& rec);
|
||||
bool ca_ori_present(const TRecordset & rec);
|
||||
bool ca_can_merge_rows(const TRectype& compact_rec, const TRectype& rec);
|
||||
bool ca_can_pack_rows(const TRectype& compact_rec, const TRectype& rec);
|
||||
void ca_taglia_campo(TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
||||
void ca_copia_campo(const TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
||||
|
||||
|
@ -134,7 +134,7 @@ protected:
|
||||
virtual const char * extra_modules() const {return "ca";}
|
||||
virtual void main_loop();
|
||||
|
||||
bool elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows, TRecord_array& output_rows);
|
||||
bool elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows);
|
||||
bool ripartizione(const TAnal_ripartizioni_batch& rrip, const TRectype& rec, const TToken_string& path_item, TRecord_array& output_rows, TArray & output_paths);
|
||||
bool pareggio(TAnal_mov& anal_mov, const TAnal_ripartizioni_batch& rrip, const TRectype& rec, const TToken_string& path, TRecord_array& output_rows, TArray & output_paths);
|
||||
|
||||
@ -231,8 +231,7 @@ bool TRib_movanal_app::ripartizione(const TAnal_ripartizioni_batch& rrip, const
|
||||
if (imp != ZERO)
|
||||
{
|
||||
TRectype* newrec = new TRectype(rec);
|
||||
newrec->put(RMOVANA_NUMRIG, output_rows.rows() + 1);
|
||||
newrec->put(RMOVANA_IMPORTO, imp); //e la mette nella nuova riga
|
||||
|
||||
//poi copia i valori dei campi cdc,cms,fsc,in quelli di tipo ori (nello stesso record)
|
||||
if (rec.get(RMOVANA_CODCCORI).blank() && rec.get(RMOVANA_CODCMSORI).blank() &&
|
||||
rec.get(RMOVANA_CODFASEORI).blank()) // RMOVANA_CODCONTORI è vuoto nel caso di pareggio
|
||||
@ -262,12 +261,26 @@ bool TRib_movanal_app::ripartizione(const TAnal_ripartizioni_batch& rrip, const
|
||||
ripkey.add(newrec->get(RMOVANA_CODFASE));
|
||||
// ripkey.add(newrec->get(RMOVANA_CODCONTO));
|
||||
|
||||
int r = output_rows.add_row(newrec);
|
||||
TToken_string * rowpath = (TToken_string *) output_paths.objptr(r);
|
||||
const int rows = output_rows.rows();
|
||||
int r = -1;
|
||||
for (int j = 1; r < 0 && j <= rows; j++)
|
||||
if (ca_can_pack_rows(*newrec, output_rows[j]))
|
||||
r = j;
|
||||
if (r < 0)
|
||||
{
|
||||
newrec->put(RMOVANA_NUMRIG, rows + 1);
|
||||
newrec->put(RMOVANA_IMPORTO, imp); //e la mette nella nuova riga
|
||||
output_rows.add_row(newrec);
|
||||
TToken_string * rowpath = (TToken_string *) output_paths.objptr(r);
|
||||
|
||||
if (rowpath == NULL)
|
||||
output_paths.add(rowpath = new TToken_string, r);
|
||||
rowpath->add(path_item);
|
||||
if (rowpath == NULL)
|
||||
output_paths.add(rowpath = new TToken_string, r);
|
||||
rowpath->add(path_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
output_rows[r].add(RMOVANA_IMPORTO, imp);
|
||||
}
|
||||
|
||||
real * value = (real *) row->objptr(ripkey);
|
||||
|
||||
@ -283,17 +296,18 @@ bool TRib_movanal_app::ripartizione(const TAnal_ripartizioni_batch& rrip, const
|
||||
}
|
||||
|
||||
|
||||
bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows, TRecord_array& output_rows)
|
||||
bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows)
|
||||
{
|
||||
bool ho_cambiato_qualchecosa = false;
|
||||
|
||||
const int annoes = anal_mov.get_int(MOVANA_ANNOES);
|
||||
const char tipomov = anal_mov.get_char(MOVANA_TIPOMOV);
|
||||
TRecord_array output_rows = input_rows; output_rows.destroy_rows();
|
||||
TArray input_paths;
|
||||
TArray output_paths;
|
||||
int loop = 0;
|
||||
|
||||
while (loop++ < 50)
|
||||
while (loop++ < 20)
|
||||
{
|
||||
bool modified = false;
|
||||
const int nrows = input_rows.rows();
|
||||
@ -324,14 +338,13 @@ bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_r
|
||||
path_item.add(rec.get(RMOVANA_CODFASE));
|
||||
path_item.add(rec.get(RMOVANA_CODCONTO));
|
||||
|
||||
if (rec.get(RMOVANA_CODCMS) == "0001")
|
||||
int i = 1;
|
||||
|
||||
if (ripartisci)
|
||||
ripartisci = input_path.find(path_item) < 0;
|
||||
input_path.add(path_item);
|
||||
if (ripartisci)
|
||||
{
|
||||
if (input_rows.rows() + righe_ripartizione > 999)
|
||||
break;
|
||||
switch (tiporip)
|
||||
{
|
||||
//procedura di ripartizione batch 'B' originale; se tiporip=='P' invece ci vuole il pareggio del movana
|
||||
@ -352,11 +365,13 @@ bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_r
|
||||
output_rows.add_row(newrec);
|
||||
}
|
||||
} //for(int r=1; r<=nrows...
|
||||
if (modified)
|
||||
if (modified && input_rows.rows() != output_rows.rows())
|
||||
{
|
||||
ho_cambiato_qualchecosa = true;
|
||||
input_rows = output_rows;
|
||||
input_paths = output_paths;
|
||||
output_rows.destroy_rows();
|
||||
output_paths.destroy();
|
||||
}
|
||||
else
|
||||
break;
|
||||
@ -371,25 +386,16 @@ bool TRib_movanal_app::elabora_movimento(TAnal_mov& anal_mov, const bool esplodi
|
||||
bool do_rewrite = false;
|
||||
|
||||
//Per prima cosa prende le righe del movimento su RMOVANA e le ricompatta..
|
||||
TRecord_array compact_rows = input_rows; //record array con le righe compattate da creare con la..
|
||||
compact_rows.destroy_rows(); //..implode_rows(); intanto le azzera per sicurezza
|
||||
|
||||
if(anal_mov.get_long(MOVANA_NUMREG) == 358L)
|
||||
int i = 1;
|
||||
if (esplodi)
|
||||
{
|
||||
//Imploditore
|
||||
ca_implode_rows(input_rows, compact_rows);
|
||||
//..poi lo riesplode in tutte le righe che possono nascere secondo le regole delle ripartizioni!
|
||||
TRecord_array output_rows = input_rows; //crea il record_array di output come copia dell'INPUT..
|
||||
output_rows.destroy_rows(); //..e poi lo pulisce
|
||||
|
||||
//Esploditore
|
||||
if (elabora_righe(anal_mov, compact_rows, output_rows))
|
||||
{
|
||||
input_rows = output_rows; //rimette i record elaborati negli originali
|
||||
do_rewrite = true;
|
||||
}
|
||||
|
||||
if (_definitivo) //se l'elaborazione e' definitiva...
|
||||
do_rewrite = elabora_righe(anal_mov, input_rows);
|
||||
|
||||
if (_definitivo) //se l'elaborazione e' definitiva...
|
||||
{
|
||||
anal_mov.put(MOVANA_BLOCCATO, 'X'); //..mette bloccato = X nella testata del movimento
|
||||
do_rewrite = true;
|
||||
@ -398,6 +404,9 @@ bool TRib_movanal_app::elabora_movimento(TAnal_mov& anal_mov, const bool esplodi
|
||||
else
|
||||
{
|
||||
//Imploditore
|
||||
TRecord_array compact_rows = input_rows; //record array con le righe compattate da creare con la..
|
||||
compact_rows.destroy_rows(); //..implode_rows(); intanto le azzera per sicurezza
|
||||
|
||||
do_rewrite = ca_implode_rows(input_rows, compact_rows);
|
||||
for (int r = 1; r <= compact_rows.rows(); r++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user