Abbellita la stampa
git-svn-id: svn://10.65.10.50/trunk@804 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
889c9838f4
commit
2b2c98dde7
@ -4,60 +4,38 @@
|
||||
#include <execp.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "ba3.h"
|
||||
#include "ba3100.h"
|
||||
#include <tabapp.h>
|
||||
|
||||
#include "batbreg.h"
|
||||
|
||||
#define FPC "FPC"
|
||||
#define REG_JOURNAL 5
|
||||
|
||||
class BA3100_application : public TRelation_application
|
||||
class BA3100_application : public Tab_application
|
||||
{
|
||||
TMask* _msk;
|
||||
TMask* _msk;
|
||||
TRelation* _rel;
|
||||
TString _tabname;
|
||||
long _oldditta;
|
||||
int _oldanno;
|
||||
bool _exist_journal;
|
||||
TString _tabname;
|
||||
long _oldditta;
|
||||
int _oldanno;
|
||||
bool _exist_journal;
|
||||
|
||||
bool user_create() ;
|
||||
bool user_destroy() ;
|
||||
virtual bool protected_record(TRectype& rec);
|
||||
virtual TMask* get_mask( int mode) { return _msk;}
|
||||
virtual bool changing_mask( int mode) { return FALSE;}
|
||||
virtual TRelation* get_relation() const { return _rel;}
|
||||
virtual void init_query_mode(TMask& m);
|
||||
virtual void init_insert_mode(TMask& m);
|
||||
virtual void init_modify_mode(TMask& m);
|
||||
virtual bool user_create() ;
|
||||
virtual bool user_destroy() ;
|
||||
|
||||
public:
|
||||
BA3100_application() : _oldditta(-1), _oldanno(-1), _exist_journal(FALSE) , _msk(NULL), _rel(NULL) {}
|
||||
virtual ~BA3100_application() {}
|
||||
virtual void init_insert_mode(TMask& m) ;
|
||||
virtual bool protected_record(TRectype& rec) ;
|
||||
|
||||
bool exist_journal() {return _exist_journal;}
|
||||
void print();
|
||||
|
||||
BA3100_application() {}
|
||||
virtual ~BA3100_application() {}
|
||||
};
|
||||
|
||||
HIDDEN inline BA3100_application & app() { return (BA3100_application & ) main_app();}
|
||||
HIDDEN inline BA3100_application& app() { return (BA3100_application&) main_app();}
|
||||
|
||||
void BA3100_application::print()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
TExternal_app stampa(format("ba3a -1 %s", (const char *) _tabname));
|
||||
#else
|
||||
TExternal_app stampa(format("ba3 -1 %s", (const char *) _tabname));
|
||||
#endif
|
||||
stampa.run();
|
||||
}
|
||||
|
||||
void BA3100_application::init_query_mode(TMask& m)
|
||||
|
||||
{
|
||||
m.send_key(K_SHIFT + K_CTRL + 'e', -GR_MODIFY_PROTECTED);
|
||||
m.send_key(K_SHIFT + K_CTRL + 'e', -GR_RECORD_PROTECTED);
|
||||
}
|
||||
|
||||
void BA3100_application::init_insert_mode(TMask& m)
|
||||
|
||||
{
|
||||
if (_tabname != "REG") return;
|
||||
|
||||
@ -82,15 +60,6 @@ void BA3100_application::init_insert_mode(TMask& m)
|
||||
}
|
||||
}
|
||||
|
||||
void BA3100_application::init_modify_mode(TMask& m)
|
||||
|
||||
{
|
||||
m.send_key(K_SHIFT + K_CTRL + 'd', -GR_MODIFY_PROTECTED);
|
||||
const bool enable = !(_rel->curr().get_bool(FPC));
|
||||
|
||||
m.send_key(K_SHIFT + K_CTRL + 'd' + enable, -GR_RECORD_PROTECTED);
|
||||
}
|
||||
|
||||
bool BA3100_application::protected_record(TRectype& rec)
|
||||
{
|
||||
bool prot = rec.get_bool(FPC);
|
||||
@ -112,9 +81,7 @@ bool BA3100_application::protected_record(TRectype& rec)
|
||||
return prot;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
||||
|
||||
{
|
||||
if ((k == K_TAB || k == K_ENTER) && app().exist_journal() &&
|
||||
(atoi(f.get()) == REG_JOURNAL)
|
||||
@ -126,26 +93,9 @@ HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
||||
|
||||
bool BA3100_application::user_create()
|
||||
{
|
||||
if (argc() < 3) return FALSE;
|
||||
_tabname = argv(2);
|
||||
|
||||
if (_tabname.empty()) return FALSE;
|
||||
_tabname.upper();
|
||||
TString16 m, t(_tabname);
|
||||
|
||||
if (t[0] == '%')
|
||||
t.ltrim(1);
|
||||
|
||||
m << "BATB" << t;
|
||||
_msk = new TMask(m) ;
|
||||
for (int i = 0; i < _msk->fields(); i++)
|
||||
if (_msk->fld(i).in_group(GR_SEARCH))
|
||||
{
|
||||
set_search_field(_msk->fld(i).dlg());
|
||||
break;
|
||||
}
|
||||
_rel = new TRelation(_tabname);
|
||||
set_title(_msk->get_caption());
|
||||
Tab_application::user_create();
|
||||
_msk = get_mask();
|
||||
_tabname = get_tabname();
|
||||
if (_tabname == "REG") _msk->set_handler(F_TIPO, tiporeg_handler);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class BA3200_application : public TPrintapp
|
||||
TArray _string_roman;
|
||||
TArray _field_roman;
|
||||
bool _stampa_registri;
|
||||
bool _stampa_ca7; //tabella causali 770
|
||||
bool _tabella_comune;
|
||||
|
||||
public:
|
||||
@ -77,6 +78,11 @@ bool BA3200_application::set_print(int)
|
||||
}
|
||||
|
||||
_cur->setregion (from, to);
|
||||
|
||||
set_background();
|
||||
if (_stampa_ca7)
|
||||
set_background("W1l{1 3 132 3}W1l{1 5 132 5}");
|
||||
else set_background("W1l{1 3 132 3}W1l{1 6 132 6}");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -159,6 +165,12 @@ void BA3200_application::set_headers()
|
||||
riga.overwrite(format("Ditta %4ld %s", codditta,(const char *)ragsoc));
|
||||
}
|
||||
|
||||
if (_stampa_ca7)
|
||||
{
|
||||
TDate d (_msk->get(F_DATASTAMPA));
|
||||
printer().setdate(d);
|
||||
}
|
||||
|
||||
riga.overwrite ("Data @< Pag. @#", riga.len()-22);
|
||||
|
||||
set_header (last_riga++, "%s", (const char *)riga);
|
||||
@ -170,12 +182,14 @@ void BA3200_application::set_headers()
|
||||
NomeTabella.left_just (LungRiga);
|
||||
/* else
|
||||
NomeTabella.center_just (LungRiga); */
|
||||
if (_stampa_ca7)
|
||||
NomeTabella.center_just (LungRiga);
|
||||
|
||||
set_header (last_riga++, "%s", (const char *)NomeTabella);
|
||||
set_header (last_riga++, "@b%s", (const char *)NomeTabella);
|
||||
|
||||
// Aggiungo una riga vuota per separare prima intestazione
|
||||
sep.fill ('-', LungRiga);
|
||||
set_header (last_riga, "%s", (const char *)sep);
|
||||
//sep.fill ('-', LungRiga);
|
||||
//set_header (last_riga, "%s", (const char *)sep);
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
@ -191,7 +205,7 @@ void BA3200_application::set_headers()
|
||||
|
||||
if (riga_intesta) last_riga += riga_intesta;
|
||||
last_riga++;
|
||||
set_header (last_riga, (const char *)sep);
|
||||
//set_header (last_riga, (const char *)sep);
|
||||
last_riga++;
|
||||
sep.fill(' ');
|
||||
set_header (last_riga, (const char *)sep);
|
||||
@ -344,6 +358,7 @@ bool BA3200_application::user_create()
|
||||
|
||||
// Flag per la stampa tabella registri
|
||||
_stampa_registri = (_tabname.upper() == "REG");
|
||||
_stampa_ca7 = (_tabname.upper() == "%CA7");
|
||||
|
||||
if (!fexist(_rptname))
|
||||
fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname);
|
||||
|
@ -26,6 +26,8 @@
|
||||
#define F_CODDITTA 211
|
||||
#define F_RAGSOC 212
|
||||
|
||||
#define F_DATASTAMPA 213
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user