Patch level : 2.2
Files correlati : ca2 Ricompilazione Demo : [ ] Commento : Ora viene impedita la rigenerazione delle righe analitiche a partire dalle righe contabile se esiste anche un solo conto per cui non sia disponibile la tabella di ripartizione. Di fatto viene impedito di "rovinare" movimenti provenienti da documenti, i quali devono essere ricontabilizzati. git-svn-id: svn://10.65.10.50/trunk@13648 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
236de8f076
commit
c53c790f0b
@ -35,6 +35,7 @@ protected:
|
|||||||
void split_cg_row(const TRectype& row, const TRecord_array& rrip);
|
void split_cg_row(const TRectype& row, const TRecord_array& rrip);
|
||||||
void load_cg_row(const TRectype& row);
|
void load_cg_row(const TRectype& row);
|
||||||
void load_cg_mov();
|
void load_cg_mov();
|
||||||
|
bool is_ripartible_movcg();
|
||||||
|
|
||||||
int create_sheet_fields(int lf, int& y, short& dlg, bool required);
|
int create_sheet_fields(int lf, int& y, short& dlg, bool required);
|
||||||
void create_sheet();
|
void create_sheet();
|
||||||
@ -185,18 +186,60 @@ void TMovanal_msk::split_cg_row(const TRectype& row, const TRecord_array& rrip)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMovanal_msk::is_ripartible_movcg()
|
||||||
|
{
|
||||||
|
const TString& numregcg = get(F_NUMREGCG);
|
||||||
|
TRecord_array cg(numregcg, LF_RMOV);
|
||||||
|
|
||||||
|
TString80 query;
|
||||||
|
for (int r = cg.last_row(); r > 0; r--)
|
||||||
|
{
|
||||||
|
const TRectype& row = cg.row(r);
|
||||||
|
for (int i = 3; i > 0; i--)
|
||||||
|
{
|
||||||
|
query = "USE RIP SELECT";
|
||||||
|
query << " (GRUPPO=" << row.get(RMV_GRUPPO) << ')'; // Il gruppo c'e' sempre
|
||||||
|
const int conto = i > 1 ? row.get_int(RMV_CONTO) : 0; // Il conto c'e' per i = 2 o 3
|
||||||
|
query << "&&(CONTO=" << conto << ')';
|
||||||
|
if (conto > 0)
|
||||||
|
{
|
||||||
|
const long sotto = i > 2 ? row.get_long(RMV_SOTTOCONTO) : 0; // Il sottoconto c'e' per i = 3
|
||||||
|
query << "&&(SOTTOCONTO=" << sotto << ')';
|
||||||
|
}
|
||||||
|
query << "\nFROM TIPO='I'\nTO TIPO='I'";
|
||||||
|
|
||||||
|
TISAM_recordset rs(query);
|
||||||
|
if (rs.items() > 0) // Ho trovato la ripartizione!
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i <= 0) // Non trovato la ripartizione
|
||||||
|
{
|
||||||
|
return error_box("Non esiste una ripartizione del conto %d.%d.%ld\n"
|
||||||
|
"presente sulla riga %d del movimento %ld",
|
||||||
|
row.get_int(RMV_GRUPPO), row.get_int(RMV_CONTO), row.get_long(RMV_SOTTOCONTO),
|
||||||
|
r, atol(numregcg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void TMovanal_msk::load_cg_row(const TRectype& row)
|
void TMovanal_msk::load_cg_row(const TRectype& row)
|
||||||
{
|
{
|
||||||
// Cerco la ripartizione del sottoconto, se non la trovo uso quella del conto o del gruppo
|
// Cerco la ripartizione del sottoconto, se non la trovo uso quella del conto o del gruppo
|
||||||
|
TString80 query;
|
||||||
for (int i = 3; i > 0; i--)
|
for (int i = 3; i > 0; i--)
|
||||||
{
|
{
|
||||||
TString query = "USE RIP SELECT";
|
query = "USE RIP SELECT";
|
||||||
query << " (GRUPPO=" << row.get(RMV_GRUPPO) << ')'; // Il gruppo c'e' sempre
|
query << " (GRUPPO=" << row.get(RMV_GRUPPO) << ')'; // Il gruppo c'e' sempre
|
||||||
if (i > 1)
|
const int conto = i > 1 ? row.get_int(RMV_CONTO) : 0; // Il conto c'e' per i = 2 o 3
|
||||||
query << "&&(CONTO=" << row.get(RMV_CONTO) << ')'; // Il conto c'e' per i = 2 o 3
|
query << "&&(CONTO=" << conto << ')';
|
||||||
if (i > 2)
|
if (conto > 0)
|
||||||
query << "&&(SOTTOCONTO=" << row.get(RMV_SOTTOCONTO) << ')'; // Il sottoconto c'e' per i = 3
|
{
|
||||||
|
const long sotto = i > 2 ? row.get_long(RMV_SOTTOCONTO) : 0; // Il sottoconto c'e' per i = 3
|
||||||
|
query << "&&(SOTTOCONTO=" << sotto << ')';
|
||||||
|
}
|
||||||
query << "\nFROM TIPO='I'\nTO TIPO='I'";
|
query << "\nFROM TIPO='I'\nTO TIPO='I'";
|
||||||
|
|
||||||
TISAM_recordset rs(query);
|
TISAM_recordset rs(query);
|
||||||
if (rs.items() > 0) // Ho trovato la ripartizione: evviva!
|
if (rs.items() > 0) // Ho trovato la ripartizione: evviva!
|
||||||
{
|
{
|
||||||
@ -210,7 +253,7 @@ void TMovanal_msk::load_cg_row(const TRectype& row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 0) // Non ho trovato nessuno schema di riaprtizione valido
|
if (i == 0) // Non ho trovato nessuno schema di ripartizione valido
|
||||||
{
|
{
|
||||||
// Creo una riga nuova
|
// Creo una riga nuova
|
||||||
TToken_string& riga = sfield(F_RIGHE).row(-1);
|
TToken_string& riga = sfield(F_RIGHE).row(-1);
|
||||||
@ -349,10 +392,15 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
case F_RESET:
|
case F_RESET:
|
||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
{
|
{
|
||||||
TSheet_field& sf = sfield(F_RIGHE);
|
if (is_ripartible_movcg())
|
||||||
sf.destroy();
|
{
|
||||||
load_cg_mov();
|
TSheet_field& sf = sfield(F_RIGHE);
|
||||||
sf.force_update();
|
sf.destroy();
|
||||||
|
load_cg_mov();
|
||||||
|
sf.force_update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
disable(F_RESET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user