Patch level : 12.00 1382
Files correlati : ba8.exe Bug : Commento: Corretto generatoe report
This commit is contained in:
parent
cc00258a72
commit
eb35c28b96
@ -154,7 +154,7 @@ void TSection_properties_mask::vedo_non_vedo()
|
|||||||
if (level > 1)
|
if (level > 1)
|
||||||
{
|
{
|
||||||
if (level > 10)
|
if (level > 10)
|
||||||
can_delete = _report.find_section('B', level+1) == NULL;
|
can_delete = _report.find_section('B', level+1) == nullptr;
|
||||||
else
|
else
|
||||||
can_delete = true;
|
can_delete = true;
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ bool TReport_query_mask::select_query()
|
|||||||
item.Load(path);
|
item.Load(path);
|
||||||
|
|
||||||
const TXmlItem* sql = item.FindFirst("sql");
|
const TXmlItem* sql = item.FindFirst("sql");
|
||||||
ok = sql != NULL;
|
ok = sql != nullptr;
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
TString str; sql->GetEnclosedText(str);
|
TString str; sql->GetEnclosedText(str);
|
||||||
@ -407,7 +407,8 @@ bool TReport_query_mask::on_field_event(TOperable_field& o, TField_event e, long
|
|||||||
{
|
{
|
||||||
const TString& sql = get(F_SQL);
|
const TString& sql = get(F_SQL);
|
||||||
TRecordset* rex = create_recordset(sql);
|
TRecordset* rex = create_recordset(sql);
|
||||||
if (rex != NULL)
|
|
||||||
|
if (rex != nullptr)
|
||||||
{
|
{
|
||||||
if (rex->items() > 0)
|
if (rex->items() > 0)
|
||||||
{
|
{
|
||||||
@ -501,6 +502,7 @@ bool TReport_mask::get_rep_path(TFilename& path) const
|
|||||||
{
|
{
|
||||||
const TString& name = get(DLG_REPORT);
|
const TString& name = get(DLG_REPORT);
|
||||||
const bool ok = name.full();
|
const bool ok = name.full();
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
if (path.blank())
|
if (path.blank())
|
||||||
@ -557,6 +559,7 @@ bool TReport_mask::save_report()
|
|||||||
if (is_power_station())
|
if (is_power_station())
|
||||||
{
|
{
|
||||||
FILE_SPEC fsp;
|
FILE_SPEC fsp;
|
||||||
|
|
||||||
xvt_fsys_convert_str_to_fspec(_curr_report, &fsp);
|
xvt_fsys_convert_str_to_fspec(_curr_report, &fsp);
|
||||||
ok = xvt_dm_post_file_save(&fsp, TR("Nome report")) == FL_OK;
|
ok = xvt_dm_post_file_save(&fsp, TR("Nome report")) == FL_OK;
|
||||||
if (ok)
|
if (ok)
|
||||||
@ -568,13 +571,6 @@ bool TReport_mask::save_report()
|
|||||||
if (ok)
|
if (ok)
|
||||||
_is_dirty = false;
|
_is_dirty = false;
|
||||||
}
|
}
|
||||||
if (is_power_station())
|
|
||||||
{
|
|
||||||
DIRECTORY dir;
|
|
||||||
|
|
||||||
xvt_fsys_get_default_dir(&dir);
|
|
||||||
xvt_fsys_set_dir(&dir);
|
|
||||||
}
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,6 +780,13 @@ void TReport_mask::add_field()
|
|||||||
|
|
||||||
void TReport_mask::edit_field(TReport_field& rf)
|
void TReport_mask::edit_field(TReport_field& rf)
|
||||||
{
|
{
|
||||||
|
DIRECTORY dir;
|
||||||
|
DIRECTORY def;
|
||||||
|
|
||||||
|
xvt_fsys_get_curr_dir(&dir);
|
||||||
|
xvt_fsys_get_default_dir(&def);
|
||||||
|
|
||||||
|
xvt_fsys_set_dir(&def);
|
||||||
TReport_section& rs = rf.section();
|
TReport_section& rs = rf.section();
|
||||||
TReport_field_mask m(rf);
|
TReport_field_mask m(rf);
|
||||||
const KEY key = m.run();
|
const KEY key = m.run();
|
||||||
@ -868,7 +871,8 @@ void TReport_mask::fields_properties()
|
|||||||
bool TReport_mask::enumerate_bodies(int level, TToken_string& code, TToken_string& desc) const
|
bool TReport_mask::enumerate_bodies(int level, TToken_string& code, TToken_string& desc) const
|
||||||
{
|
{
|
||||||
TReport_section* rs = _report.find_section('B', level);
|
TReport_section* rs = _report.find_section('B', level);
|
||||||
if (rs != NULL)
|
|
||||||
|
if (rs != nullptr)
|
||||||
{
|
{
|
||||||
TString str; str.format("B%d", level);
|
TString str; str.format("B%d", level);
|
||||||
code.add(str);
|
code.add(str);
|
||||||
@ -878,7 +882,7 @@ bool TReport_mask::enumerate_bodies(int level, TToken_string& code, TToken_strin
|
|||||||
enumerate_bodies(level*10+1, code, desc); // Figlio
|
enumerate_bodies(level*10+1, code, desc); // Figlio
|
||||||
enumerate_bodies(level+1, code, desc); // Fratello
|
enumerate_bodies(level+1, code, desc); // Fratello
|
||||||
}
|
}
|
||||||
return rs != NULL;
|
return rs != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TReport_mask::add_section()
|
bool TReport_mask::add_section()
|
||||||
@ -898,14 +902,14 @@ bool TReport_mask::add_section()
|
|||||||
if (type == 'S')
|
if (type == 'S')
|
||||||
{
|
{
|
||||||
type = 'B';
|
type = 'B';
|
||||||
const int father = atoi(m.get(102).mid(1));
|
const int father = atoi(m.get(102).smid(1));
|
||||||
if (father < 100000L)
|
if (father < 100000L)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 1; i <= 9; i++) // Cerca l'ultimo figlio del nodo padre
|
for (i = 1; i <= 9; i++) // Cerca l'ultimo figlio del nodo padre
|
||||||
{
|
{
|
||||||
level = father*10+i;
|
level = father*10+i;
|
||||||
if (_report.find_section(type, level) == NULL)
|
if (_report.find_section(type, level) == nullptr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i > 9)
|
if (i > 9)
|
||||||
@ -984,13 +988,13 @@ void TReport_mask::report_properties()
|
|||||||
void TReport_mask::report_query()
|
void TReport_mask::report_query()
|
||||||
{
|
{
|
||||||
TReport_query_mask qm;
|
TReport_query_mask qm;
|
||||||
if (_report.recordset() != NULL)
|
if (_report.recordset() != nullptr)
|
||||||
qm.set(F_SQL, _report.recordset()->query_text());
|
qm.set(F_SQL, _report.recordset()->query_text());
|
||||||
if (qm.run() == K_ENTER)
|
if (qm.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
_report.set_recordset(qm.get(F_SQL));
|
_report.set_recordset(qm.get(F_SQL));
|
||||||
_is_dirty = true;
|
_is_dirty = true;
|
||||||
const bool ok = _report.recordset() != NULL;
|
const bool ok = _report.recordset() != nullptr;
|
||||||
enable(DLG_PRINT, ok);
|
enable(DLG_PRINT, ok);
|
||||||
enable(DLG_PREVIEW, ok);
|
enable(DLG_PREVIEW, ok);
|
||||||
enable(DLG_PDF, ok);
|
enable(DLG_PDF, ok);
|
||||||
@ -1012,7 +1016,9 @@ void TReport_mask::update_toolbar()
|
|||||||
const bool full = !efield(DLG_REPORT).empty();
|
const bool full = !efield(DLG_REPORT).empty();
|
||||||
enable(DLG_SAVEREC, full);
|
enable(DLG_SAVEREC, full);
|
||||||
enable(DLG_DELREC, full);
|
enable(DLG_DELREC, full);
|
||||||
const bool printok = full && _report.recordset() != NULL;
|
|
||||||
|
const bool printok = full && _report.recordset() != nullptr;
|
||||||
|
|
||||||
enable(DLG_PRINT, printok);
|
enable(DLG_PRINT, printok);
|
||||||
enable(DLG_PREVIEW, printok);
|
enable(DLG_PREVIEW, printok);
|
||||||
enable(DLG_PDF, printok);
|
enable(DLG_PDF, printok);
|
||||||
@ -1024,26 +1030,26 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
{
|
{
|
||||||
case DLG_REPORT:
|
case DLG_REPORT:
|
||||||
{
|
{
|
||||||
const TString & s = o.get();
|
if (e == fe_init || e == fe_modify)
|
||||||
|
|
||||||
if (e == fe_init || e == fe_modify)
|
|
||||||
{
|
|
||||||
if (e == fe_init)
|
|
||||||
{
|
{
|
||||||
if (main_app().argc() >= 3)
|
const TString & s = o.get();
|
||||||
|
|
||||||
|
if (e == fe_init)
|
||||||
{
|
{
|
||||||
set(DLG_REPORT, main_app().argv(2));
|
if (main_app().argc() >= 3)
|
||||||
load_report();
|
{
|
||||||
|
set(DLG_REPORT, main_app().argv(2));
|
||||||
|
load_report();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (e == fe_modify)
|
||||||
|
{
|
||||||
|
save_if_needed();
|
||||||
|
load_report();
|
||||||
|
}
|
||||||
|
update_toolbar();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (e == fe_modify)
|
|
||||||
{
|
|
||||||
save_if_needed();
|
|
||||||
load_report();
|
|
||||||
}
|
|
||||||
update_toolbar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case F_SECTIONS:
|
case F_SECTIONS:
|
||||||
@ -1059,7 +1065,8 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
if (e == fe_modify)
|
if (e == fe_modify)
|
||||||
{
|
{
|
||||||
const TReport_section& rs = _tree.curr_section();
|
const TReport_section& rs = _tree.curr_section();
|
||||||
const bool on = strchr("HBF", rs.type()) != NULL;
|
const bool on = strchr("HBF", rs.type()) != nullptr;
|
||||||
|
|
||||||
switch (atoi(o.get()))
|
switch (atoi(o.get()))
|
||||||
{
|
{
|
||||||
case 0: if (on) add_field(); break;
|
case 0: if (on) add_field(); break;
|
||||||
@ -1229,18 +1236,18 @@ protected:
|
|||||||
virtual void print();
|
virtual void print();
|
||||||
virtual void preview();
|
virtual void preview();
|
||||||
public:
|
public:
|
||||||
TReporter_app() : _msk(NULL) { }
|
TReporter_app() : _msk(nullptr) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
void TReporter_app::print()
|
void TReporter_app::print()
|
||||||
{
|
{
|
||||||
if (_msk != NULL)
|
if (_msk != nullptr)
|
||||||
_msk->on_print(false);
|
_msk->on_print(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TReporter_app::preview()
|
void TReporter_app::preview()
|
||||||
{
|
{
|
||||||
if (_msk != NULL)
|
if (_msk != nullptr)
|
||||||
_msk->on_print(true);
|
_msk->on_print(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,11 +1263,7 @@ bool TReporter_app::create()
|
|||||||
|
|
||||||
bool TReporter_app::destroy()
|
bool TReporter_app::destroy()
|
||||||
{
|
{
|
||||||
if (_msk != NULL)
|
safe_delete(_msk);
|
||||||
{
|
|
||||||
delete _msk;
|
|
||||||
_msk = NULL;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user