d182debce3
Files correlati :ba3.exe ba8.exe Ricompilazione Demo : [ ] Commento :spostato il programma stampa tabelle report in ba3200 (da ba8600) git-svn-id: svn://10.65.10.50/trunk@12216 c028cbd2-c16b-5b4b-a496-9718f37d4682
107 lines
2.2 KiB
C++
Executable File
107 lines
2.2 KiB
C++
Executable File
//Programma per stampa report tabelle
|
|
|
|
#include <applicat.h>
|
|
#include <relation.h>
|
|
#include <reprint.h>
|
|
#include <tabutil.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TTable_report
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTable_report : public TReport
|
|
{
|
|
protected:
|
|
virtual bool execute_prescript();
|
|
};
|
|
|
|
bool TTable_report::execute_prescript()
|
|
{
|
|
TFilename msk = filename().name();
|
|
msk.ext(""); msk.lower();
|
|
TMask m(msk);
|
|
|
|
const bool ok = m.run() == K_ENTER;
|
|
if (ok)
|
|
{
|
|
TRectype rec_fr(LF_TAB), rec_to(LF_TAB);
|
|
for (int i = 0; i < m.fields(); i++)
|
|
{
|
|
const TMask_field& fld = m.fld(i);
|
|
const TFieldref* fr = fld.field();
|
|
if (fr != NULL)
|
|
{
|
|
if (fld.in_group(1))
|
|
fr->write(fld.get(), rec_fr);
|
|
if (fld.in_group(2))
|
|
fr->write(fld.get(), rec_to);
|
|
}
|
|
}
|
|
|
|
TString use = recordset()->query_text();
|
|
|
|
const TString& cod_fr = rec_fr.get("CODTAB");
|
|
if (cod_fr.not_empty())
|
|
use << "\nFROM CODTAB='" << cod_fr << '\'';
|
|
|
|
const TString& cod_to = rec_to.get("CODTAB");
|
|
if (cod_to.not_empty())
|
|
use << "\nTO CODTAB='" << cod_to << '\'';
|
|
|
|
set_recordset(use);
|
|
}
|
|
|
|
return ok;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TTable_reporter
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTable_reporter : public TSkeleton_application
|
|
{
|
|
protected:
|
|
virtual void main_loop();
|
|
|
|
public:
|
|
bool get_rpt_name(TFilename& rptname) const;
|
|
};
|
|
|
|
|
|
bool TTable_reporter::get_rpt_name(TFilename& rptname) const
|
|
{
|
|
TTable tab(argv(2));
|
|
rptname = tab.module();
|
|
rptname << "st" << tab.get("COD");
|
|
rptname.ext("rep");
|
|
rptname.lower();
|
|
|
|
return rptname.custom_path();
|
|
}
|
|
|
|
void TTable_reporter::main_loop()
|
|
{
|
|
TFilename rptname;
|
|
if (get_rpt_name(rptname))
|
|
{
|
|
while (true)
|
|
{
|
|
TTable_report rep; rep.load(rptname);
|
|
TReport_book book;
|
|
if (book.add(rep))
|
|
book.print_or_preview();
|
|
else
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
error_box(FR("Manca il file %s"), (const char *)rptname);
|
|
}
|
|
|
|
|
|
int ba3200(int argc, char* argv[])
|
|
{
|
|
TTable_reporter app;
|
|
app.run(argc, argv, TR("Stampa Report Tabelle"));
|
|
return 0;
|
|
} |