Patch level : 2.1 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunta nuova stampa tabelle tramite report git-svn-id: svn://10.65.10.50/trunk@12163 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ba79bf3f29
commit
76e33cb1e3
@ -248,7 +248,6 @@ bool TPicture_mask::on_key(KEY k)
|
|||||||
return TMask::on_key(k);
|
return TMask::on_key(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TPicture_mask::on_firm_change()
|
void TPicture_mask::on_firm_change()
|
||||||
{
|
{
|
||||||
force_update();
|
force_update();
|
||||||
@ -277,17 +276,6 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
|
|||||||
TImage logo(logoname);
|
TImage logo(logoname);
|
||||||
if(logo.ok())
|
if(logo.ok())
|
||||||
{
|
{
|
||||||
/* RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
|
||||||
const bool is_tree = dx == 0 && dy == 0;
|
|
||||||
double screen_width = 50*CHARX;
|
|
||||||
|
|
||||||
const double ratio = screen_width / logo.width();
|
|
||||||
const int maxx = int(ratio * logo.width());
|
|
||||||
const int maxy = int(ratio * logo.height());
|
|
||||||
|
|
||||||
if (can_be_transparent(logo))
|
|
||||||
logo.convert_transparent_color(MASK_BACK_COLOR);
|
|
||||||
_logo = new TImage(logo, maxx, maxy);*/
|
|
||||||
if (can_be_transparent(logo))
|
if (can_be_transparent(logo))
|
||||||
logo.convert_transparent_color(MASK_BACK_COLOR);
|
logo.convert_transparent_color(MASK_BACK_COLOR);
|
||||||
_logo = new TImage(logo);
|
_logo = new TImage(logo);
|
||||||
@ -308,22 +296,78 @@ TPicture_mask::~TPicture_mask()
|
|||||||
class TExplorer_mask : public TMask
|
class TExplorer_mask : public TMask
|
||||||
{
|
{
|
||||||
TMenu_tree _tree;
|
TMenu_tree _tree;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool stop_run(KEY k);
|
virtual bool stop_run(KEY k);
|
||||||
virtual bool on_key(KEY k);
|
virtual bool on_key(KEY k);
|
||||||
virtual void on_idle();
|
virtual void on_idle();
|
||||||
|
|
||||||
static bool explore_handler(TMask_field& f, KEY k);
|
static bool explore_handler(TMask_field& f, KEY k);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TExplorer_mask(TMenu& menu);
|
TExplorer_mask(TMenu& menu);
|
||||||
|
~TExplorer_mask();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool TExplorer_mask::stop_run(KEY k)
|
bool TExplorer_mask::stop_run(KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_CTRL+'R')
|
if (k == K_CTRL+'R')
|
||||||
return TWindow::stop_run(k);
|
return TWindow::stop_run(k);
|
||||||
|
|
||||||
|
if (k == K_QUIT)
|
||||||
|
{
|
||||||
|
if (ADVANCED_GRAPHICS)
|
||||||
|
{
|
||||||
|
WINDOW window[3];
|
||||||
|
XVT_IMAGE image[3];
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
WINDOW w = NULL_WIN;
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 1: w = ((TWindowed_field&)field(DLG_TREE)).win().win(); break;
|
||||||
|
case 2: w = ((TWindowed_field&)field(DLG_LIST)).win().win(); break;
|
||||||
|
default: w = win(); break;
|
||||||
|
}
|
||||||
|
RCT rct; xvt_vobj_get_client_rect(w, &rct);
|
||||||
|
RCT irct = rct; irct.right /= 4; irct.bottom /= 4;
|
||||||
|
XVT_IMAGE cap = xvt_image_capture(w, &rct);
|
||||||
|
XVT_IMAGE img = xvt_image_create(XVT_IMAGE_RGB, irct.right, irct.bottom, 0);
|
||||||
|
xvt_image_transfer(img, cap, &irct, &rct);
|
||||||
|
xvt_image_destroy(cap);
|
||||||
|
|
||||||
|
for (int y = 0; y < irct.bottom; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < irct.right; x++)
|
||||||
|
{
|
||||||
|
COLOR rgb = xvt_image_get_pixel(img, x, y);
|
||||||
|
const unsigned int r = XVT_COLOR_GET_RED(rgb) / 2;
|
||||||
|
const unsigned int g = XVT_COLOR_GET_GREEN(rgb) / 2;
|
||||||
|
const unsigned int b = XVT_COLOR_GET_BLUE(rgb) / 2;
|
||||||
|
xvt_image_set_pixel(img, x, y, MAKE_COLOR(r, g, b));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window[i] = w;
|
||||||
|
image[i] = img;
|
||||||
|
}
|
||||||
|
for (i = 2; i >= 0; i--)
|
||||||
|
{
|
||||||
|
RCT rct; xvt_vobj_get_client_rect(window[i], &rct);
|
||||||
|
RCT irct = rct; irct.right /= 4; irct.bottom /= 4;
|
||||||
|
xvt_dwin_draw_image(window[i], image[i], &rct, &irct);
|
||||||
|
xvt_image_destroy(image[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!yesno_box(TR("Si desidera uscire?")))
|
||||||
|
{
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
xvt_dwin_invalidate_rect(window[i], NULL);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TMask::stop_run(k);
|
return TMask::stop_run(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +410,7 @@ bool TExplorer_mask::explore_handler(TMask_field& f, KEY k)
|
|||||||
TExplorer_mask::TExplorer_mask(TMenu& menu)
|
TExplorer_mask::TExplorer_mask(TMenu& menu)
|
||||||
: TMask ("", 1, 0, 0, 0, 0), _tree(menu)
|
: TMask ("", 1, 0, 0, 0, 0), _tree(menu)
|
||||||
{
|
{
|
||||||
const int margin = (columns()-80) / 2;
|
const int margin = (columns()-80) / 2;
|
||||||
const int tree_width = margin+21; // Usa la metà di sinistra
|
const int tree_width = margin+21; // Usa la metà di sinistra
|
||||||
|
|
||||||
TTree_field& tree_fld = add_tree(DLG_TREE, 0, 0, 0, tree_width, -5);
|
TTree_field& tree_fld = add_tree(DLG_TREE, 0, 0, 0, tree_width, -5);
|
||||||
@ -390,6 +434,10 @@ TExplorer_mask::TExplorer_mask(TMenu& menu)
|
|||||||
first_focus(DLG_LIST);
|
first_focus(DLG_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TExplorer_mask::~TExplorer_mask()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Color Mask
|
// Color Mask
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -813,10 +861,15 @@ bool TMenu_application::check_user()
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
TMask m("ba0100a");
|
TMask m("ba0100a");
|
||||||
#ifdef DBG
|
|
||||||
m.set_handler(F_USER, pwd_handler);
|
char hostname[256]; xvt_sys_get_host_name(hostname, sizeof(hostname));
|
||||||
m.set_handler(F_PASSWORD, pwd_handler);
|
if (strcmp(hostname, "BATMOBILE") == 0 || strcmp(hostname, "ETABETA") == 0 ||
|
||||||
#endif
|
strcmp(hostname, "KIRK") == 0 || strcmp(hostname, "SPOCK") == 0 ||
|
||||||
|
strcmp(hostname, "UHURA") == 0)
|
||||||
|
{
|
||||||
|
m.set_handler(F_USER, pwd_handler);
|
||||||
|
m.set_handler(F_PASSWORD, pwd_handler);
|
||||||
|
}
|
||||||
|
|
||||||
TEdit_field& e = m.efield(F_USER);
|
TEdit_field& e = m.efield(F_USER);
|
||||||
e.browse()->set_filter("ISGROUP!=\"X\"");
|
e.browse()->set_filter("ISGROUP!=\"X\"");
|
||||||
|
@ -344,7 +344,6 @@ void TMenulist_images::set_owner_info(WINDOW win, int max_side)
|
|||||||
_max_side = max_side;
|
_max_side = max_side;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TObject* TMenulist_images::key2obj(const char* key)
|
TObject* TMenulist_images::key2obj(const char* key)
|
||||||
{
|
{
|
||||||
TImage* img = NULL;
|
TImage* img = NULL;
|
||||||
|
@ -10,6 +10,7 @@ int main(int argc, char** argv)
|
|||||||
case 2: ba8300(argc, argv); break; // Report Generator
|
case 2: ba8300(argc, argv); break; // Report Generator
|
||||||
case 3: ba8400(argc, argv); break; // Form Converter
|
case 3: ba8400(argc, argv); break; // Form Converter
|
||||||
case 4: ba8500(argc, argv); break; // Report Printer
|
case 4: ba8500(argc, argv); break; // Report Printer
|
||||||
|
case 5: ba8600(argc, argv); break; // Tables Report Printer
|
||||||
default: ba8100(argc, argv); break; // Record Selector
|
default: ba8100(argc, argv); break; // Record Selector
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
1
ba/ba8.h
1
ba/ba8.h
@ -3,5 +3,6 @@ int ba8200(int argc, char* argv[]);
|
|||||||
int ba8300(int argc, char* argv[]);
|
int ba8300(int argc, char* argv[]);
|
||||||
int ba8400(int argc, char* argv[]);
|
int ba8400(int argc, char* argv[]);
|
||||||
int ba8500(int argc, char* argv[]);
|
int ba8500(int argc, char* argv[]);
|
||||||
|
int ba8600(int argc, char* argv[]);
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <extcdecl.h>
|
#include <extcdecl.h>
|
||||||
|
#include <modaut.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
@ -1336,6 +1337,9 @@ public:
|
|||||||
|
|
||||||
bool TSQL_recordset_app::create()
|
bool TSQL_recordset_app::create()
|
||||||
{
|
{
|
||||||
|
if (!has_module(RSAUT))
|
||||||
|
return error_box(TR("Modulo non autorizzato"));
|
||||||
|
|
||||||
_msk = new TQuery_mask;
|
_msk = new TQuery_mask;
|
||||||
xvt_sys_sleep(500); // Lasciamo il tempo di leggere il titolo
|
xvt_sys_sleep(500); // Lasciamo il tempo di leggere il titolo
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
|
#include <modaut.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
@ -1333,6 +1334,9 @@ void TReporter_app::print()
|
|||||||
|
|
||||||
bool TReporter_app::create()
|
bool TReporter_app::create()
|
||||||
{
|
{
|
||||||
|
if (!has_module(RSAUT))
|
||||||
|
return error_box(TR("Modulo non autorizzato"));
|
||||||
|
|
||||||
_msk = new TReport_mask;
|
_msk = new TReport_mask;
|
||||||
xvt_sys_sleep(500);
|
xvt_sys_sleep(500);
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <form.h>
|
#include <form.h>
|
||||||
|
#include <modaut.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <report.h>
|
#include <report.h>
|
||||||
|
|
||||||
@ -547,9 +548,18 @@ TFormer_mask::TFormer_mask()
|
|||||||
class TFormer_app : public TSkeleton_application
|
class TFormer_app : public TSkeleton_application
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
virtual bool create();
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool TFormer_app::create()
|
||||||
|
{
|
||||||
|
if (!has_module(RSAUT))
|
||||||
|
return error_box(TR("Modulo non autorizzato"));
|
||||||
|
|
||||||
|
return TSkeleton_application::create();
|
||||||
|
}
|
||||||
|
|
||||||
void TFormer_app::main_loop()
|
void TFormer_app::main_loop()
|
||||||
{
|
{
|
||||||
TFormer_mask m;
|
TFormer_mask m;
|
||||||
|
@ -164,45 +164,48 @@ protected:
|
|||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void TKlarkKent_app::main_loop()
|
void TKlarkKent_app::main_loop()
|
||||||
{
|
{
|
||||||
TFilename report_name;
|
TString_array arr;
|
||||||
if (argc() > 2)
|
for (int i = 2; i < argc(); i++)
|
||||||
{
|
arr.add(argv(i));
|
||||||
report_name = argv(2);
|
if (arr.items() == 0)
|
||||||
|
arr.add(EMPTY_STRING);
|
||||||
|
|
||||||
|
TReport_book book;
|
||||||
|
FOR_EACH_ARRAY_ROW(arr, r, row)
|
||||||
|
{
|
||||||
|
TFilename report_name = *row;
|
||||||
report_name.ext("rep");
|
report_name.ext("rep");
|
||||||
}
|
if (report_name.empty() || !report_name.custom_path())
|
||||||
|
|
||||||
if (report_name.empty() || !report_name.custom_path())
|
|
||||||
{
|
|
||||||
TKlarkKent_mask m;
|
|
||||||
m.set(F_REPORT, report_name);
|
|
||||||
if (m.run() == K_ENTER)
|
|
||||||
{
|
{
|
||||||
report_name = m.get(F_REPORT);
|
TKlarkKent_mask m;
|
||||||
report_name.custom_path();
|
m.set(F_REPORT, report_name);
|
||||||
|
if (m.run() == K_ENTER)
|
||||||
|
{
|
||||||
|
report_name = m.get(F_REPORT);
|
||||||
|
report_name.custom_path();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TString appname, desc;
|
||||||
|
rep2app(report_name, appname, desc);
|
||||||
|
if (appname.not_empty())
|
||||||
|
{
|
||||||
|
appname << ' ' << report_name;
|
||||||
|
TExternal_app app(appname);
|
||||||
|
app.run(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TReport rep;
|
||||||
|
if (rep.load(report_name))
|
||||||
|
book.add(rep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TString appname, desc;
|
if (book.pages() > 0)
|
||||||
rep2app(report_name, appname, desc);
|
book.print_or_preview();
|
||||||
if (appname.not_empty())
|
|
||||||
{
|
|
||||||
appname << ' ' << report_name;
|
|
||||||
TExternal_app app(appname);
|
|
||||||
app.run(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TReport rep;
|
|
||||||
if (rep.load(report_name))
|
|
||||||
{
|
|
||||||
TReport_book book;
|
|
||||||
book.add(rep);
|
|
||||||
book.print_or_preview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ba8500(int argc, char* argv[])
|
int ba8500(int argc, char* argv[])
|
||||||
|
107
ba/ba8600.cpp
Executable file
107
ba/ba8600.cpp
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
//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 ba8600(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
TTable_reporter app;
|
||||||
|
app.run(argc, argv, TR("Stampa Report Tabelle"));
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user