111 lines
2.3 KiB
C++
111 lines
2.3 KiB
C++
|
//Programma per stampa report tabelle
|
||
|
|
||
|
#include <applicat.h>
|
||
|
#include <automask.h>
|
||
|
#include <relation.h>
|
||
|
#include <reprint.h>
|
||
|
#include <tabutil.h>
|
||
|
#include "../ba/ba3200.h"
|
||
|
#define F_REPORT 250
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// TMask_print_table
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TMask_print_table : public TAutomask
|
||
|
{
|
||
|
|
||
|
protected:
|
||
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) {return true;}
|
||
|
public:
|
||
|
TMask_print_table(const char * name);
|
||
|
virtual ~TMask_print_table() {}
|
||
|
};
|
||
|
|
||
|
TMask_print_table::TMask_print_table(const char * name)
|
||
|
:TAutomask(name)
|
||
|
{
|
||
|
TEdit_field & f = add_string(F_REPORT, 0, TR("Report "), 2, -3, 20, "B");
|
||
|
f.set_query_button(new TReport_select(&f, name));
|
||
|
f.enable_check();
|
||
|
}
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// TTable_report
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TTable_report : public TReport
|
||
|
{
|
||
|
public:
|
||
|
virtual bool use_mask() { return false;}
|
||
|
|
||
|
TTable_report() {}
|
||
|
virtual ~TTable_report() {}
|
||
|
};
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// TTable_dettaglio_reporter
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TTable_dettaglio_reporter : public TSkeleton_application
|
||
|
{
|
||
|
protected:
|
||
|
virtual void main_loop();
|
||
|
|
||
|
public:
|
||
|
bool get_rpt_name(TFilename& rptname) const;
|
||
|
};
|
||
|
|
||
|
|
||
|
bool TTable_dettaglio_reporter::get_rpt_name(TFilename& rptname) const
|
||
|
{
|
||
|
TTable tab(argv(2));
|
||
|
|
||
|
rptname = tab.get("COD");
|
||
|
rptname.insert("vdst", 0);
|
||
|
rptname.ext("rep");
|
||
|
rptname.lower();
|
||
|
return rptname.custom_path();
|
||
|
}
|
||
|
|
||
|
void TTable_dettaglio_reporter::main_loop()
|
||
|
{
|
||
|
TFilename rptname;
|
||
|
|
||
|
if (get_rpt_name(rptname))
|
||
|
{
|
||
|
|
||
|
TFilename msk(rptname.name()); msk.ext(""); msk.lower();
|
||
|
TMask_print_table m(msk);
|
||
|
|
||
|
while (m.run() == K_ENTER)
|
||
|
{
|
||
|
TTable_report rep;
|
||
|
TReport_book book;
|
||
|
TString name(m.get(F_REPORT));
|
||
|
|
||
|
if (name.empty())
|
||
|
name = rptname;
|
||
|
rep.load(name);
|
||
|
rep.mask2report(m);
|
||
|
book.add(rep);
|
||
|
book.print_or_preview();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
error_box(FR("Manca il file %s"), (const char *)rptname);
|
||
|
}
|
||
|
|
||
|
|
||
|
int vd0200(int argc, char* argv[])
|
||
|
{
|
||
|
if (argc > 2)
|
||
|
{
|
||
|
TString name;
|
||
|
TTable_dettaglio_reporter app;
|
||
|
|
||
|
name << TR("Stampa Tabelle ") << argv[2];
|
||
|
app.run(argc, argv, name);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|