Files correlati : Ricompilazione Demo : [ ] Commento : Corretti errori di salvataggio query. Ottimizzato il "pagina su" in query molto grandi Iniziato report generator (importa solo le query) git-svn-id: svn://10.65.10.50/trunk@11814 c028cbd2-c16b-5b4b-a496-9718f37d4682
140 lines
2.6 KiB
C++
Executable File
140 lines
2.6 KiB
C++
Executable File
#include <xi.h>
|
|
|
|
#include <applicat.h>
|
|
#include <automask.h>
|
|
#include <execp.h>
|
|
#include <prefix.h>
|
|
#include <xml.h>
|
|
|
|
#include "ba8201.h"
|
|
#include "ba8300.h"
|
|
|
|
class TReport_mask : public TAutomask
|
|
{
|
|
protected:
|
|
virtual void handler(WINDOW win, EVENT* ep);
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
protected:
|
|
bool select_query();
|
|
bool select_report();
|
|
|
|
public:
|
|
TReport_mask() : TAutomask("ba8300a") { }
|
|
};
|
|
|
|
bool TReport_mask::select_report()
|
|
{
|
|
TEdit_field& fld = efield(F_CODICE);
|
|
|
|
TFilename dirname; get_sql_directory(dirname);
|
|
|
|
xvt_fsys_save_dir();
|
|
|
|
FILE_SPEC fs;
|
|
xvt_fsys_convert_str_to_dir(dirname, &fs.dir);
|
|
|
|
strcpy(fs.type, "rep");
|
|
strcpy(fs.name, "*");
|
|
strcpy(fs.creator, "AGA");
|
|
|
|
const bool good = xvt_dm_post_file_open(&fs, (char*)fld.prompt()) == FL_OK;
|
|
|
|
xvt_fsys_restore_dir();
|
|
|
|
if (good)
|
|
{
|
|
char name[_MAX_FNAME];
|
|
xvt_fsys_parse_pathname (fs.name, NULL, NULL, name, NULL, NULL);
|
|
fld.set(name);
|
|
}
|
|
return good;
|
|
}
|
|
|
|
bool TReport_mask::select_query()
|
|
{
|
|
TFilename path; get_sql_directory(path);
|
|
|
|
xvt_fsys_save_dir();
|
|
|
|
FILE_SPEC fs;
|
|
xvt_fsys_convert_str_to_dir(path, &fs.dir);
|
|
|
|
strcpy(fs.type, "qry");
|
|
strcpy(fs.name, "*");
|
|
strcpy(fs.creator, "AGA");
|
|
|
|
bool good = xvt_dm_post_file_open(&fs, "Selezione query") == FL_OK;
|
|
|
|
xvt_fsys_restore_dir();
|
|
|
|
if (good)
|
|
{
|
|
xvt_fsys_convert_dir_to_str(&fs.dir, path.get_buffer(), path.size());
|
|
path.add(fs.name);
|
|
TXmlItem item; item.Load(path);
|
|
const TXmlItem* sql = item.FindFirst("sql");
|
|
good = sql != NULL;
|
|
if (good)
|
|
{
|
|
TString str; sql->GetEnclosedText(str);
|
|
set(F_SQL, str);
|
|
}
|
|
}
|
|
return good;
|
|
}
|
|
|
|
void TReport_mask::handler(WINDOW win, EVENT* ep)
|
|
{
|
|
TAutomask::handler(win, ep);
|
|
}
|
|
|
|
bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
switch (o.dlg())
|
|
{
|
|
case F_CODICE:
|
|
if (e == fe_button)
|
|
select_report();
|
|
break;
|
|
case F_NEW_QRY:
|
|
if (e == fe_button)
|
|
{
|
|
TExternal_app q("ba8 -1");
|
|
q.run();
|
|
}
|
|
break;
|
|
case F_IMPORT_QRY:
|
|
if (e == fe_button)
|
|
select_query();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TReporter_app
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TReporter_app : public TSkeleton_application
|
|
{
|
|
protected:
|
|
virtual void main_loop();
|
|
};
|
|
|
|
void TReporter_app::main_loop()
|
|
{
|
|
TReport_mask* msk = new TReport_mask;
|
|
msk->run();
|
|
delete msk;
|
|
}
|
|
|
|
int ba8300(int argc, char* argv[])
|
|
{
|
|
TReporter_app app;
|
|
app.run(argc, argv, TR("Report Generator"));
|
|
return 0;
|
|
}
|