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 <execp.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include "ba3.h"
|
#include <tabapp.h>
|
||||||
#include "ba3100.h"
|
|
||||||
#include "batbreg.h"
|
#include "batbreg.h"
|
||||||
|
|
||||||
#define FPC "FPC"
|
|
||||||
#define REG_JOURNAL 5
|
#define REG_JOURNAL 5
|
||||||
|
|
||||||
class BA3100_application : public TRelation_application
|
class BA3100_application : public Tab_application
|
||||||
{
|
{
|
||||||
TMask* _msk;
|
TMask* _msk;
|
||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
TString _tabname;
|
TString _tabname;
|
||||||
long _oldditta;
|
long _oldditta;
|
||||||
int _oldanno;
|
int _oldanno;
|
||||||
bool _exist_journal;
|
bool _exist_journal;
|
||||||
|
|
||||||
bool user_create() ;
|
virtual bool user_create() ;
|
||||||
bool user_destroy() ;
|
virtual 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);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BA3100_application() : _oldditta(-1), _oldanno(-1), _exist_journal(FALSE) , _msk(NULL), _rel(NULL) {}
|
virtual void init_insert_mode(TMask& m) ;
|
||||||
virtual ~BA3100_application() {}
|
virtual bool protected_record(TRectype& rec) ;
|
||||||
|
|
||||||
bool exist_journal() {return _exist_journal;}
|
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)
|
void BA3100_application::init_insert_mode(TMask& m)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_tabname != "REG") return;
|
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 BA3100_application::protected_record(TRectype& rec)
|
||||||
{
|
{
|
||||||
bool prot = rec.get_bool(FPC);
|
bool prot = rec.get_bool(FPC);
|
||||||
@ -112,9 +81,7 @@ bool BA3100_application::protected_record(TRectype& rec)
|
|||||||
return prot;
|
return prot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
||||||
|
|
||||||
{
|
{
|
||||||
if ((k == K_TAB || k == K_ENTER) && app().exist_journal() &&
|
if ((k == K_TAB || k == K_ENTER) && app().exist_journal() &&
|
||||||
(atoi(f.get()) == REG_JOURNAL)
|
(atoi(f.get()) == REG_JOURNAL)
|
||||||
@ -126,26 +93,9 @@ HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
bool BA3100_application::user_create()
|
bool BA3100_application::user_create()
|
||||||
{
|
{
|
||||||
if (argc() < 3) return FALSE;
|
Tab_application::user_create();
|
||||||
_tabname = argv(2);
|
_msk = get_mask();
|
||||||
|
_tabname = get_tabname();
|
||||||
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());
|
|
||||||
if (_tabname == "REG") _msk->set_handler(F_TIPO, tiporeg_handler);
|
if (_tabname == "REG") _msk->set_handler(F_TIPO, tiporeg_handler);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
815
ba/ba3200.cpp
815
ba/ba3200.cpp
@ -1,400 +1,415 @@
|
|||||||
// ba3200 Stampa tabelle
|
// ba3200 Stampa tabelle
|
||||||
//
|
//
|
||||||
// legge un file con estensione .rpt che descrive la stampa.
|
// legge un file con estensione .rpt che descrive la stampa.
|
||||||
// Vedi file leggimi.txt per il formato del file
|
// Vedi file leggimi.txt per il formato del file
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <printapp.h>
|
#include <printapp.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include <nditte.h>
|
#include <nditte.h>
|
||||||
|
|
||||||
#include "ba3.h"
|
#include "ba3.h"
|
||||||
#include "ba3200.h"
|
#include "ba3200.h"
|
||||||
|
|
||||||
#define FOOTER_LEN 4 // se non ridefinito nel .rpt
|
#define FOOTER_LEN 4 // se non ridefinito nel .rpt
|
||||||
|
|
||||||
class BA3200_application : public TPrintapp
|
class BA3200_application : public TPrintapp
|
||||||
{
|
{
|
||||||
TString _tabname;
|
TString _tabname;
|
||||||
TFilename _rptname;
|
TFilename _rptname;
|
||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
TCursor *_cur;
|
TCursor *_cur;
|
||||||
TMask* _msk;
|
TMask* _msk;
|
||||||
TString _maskname;
|
TString _maskname;
|
||||||
int _logicnum;
|
int _logicnum;
|
||||||
TArray _string_roman;
|
TArray _string_roman;
|
||||||
TArray _field_roman;
|
TArray _field_roman;
|
||||||
bool _stampa_registri;
|
bool _stampa_registri;
|
||||||
bool _tabella_comune;
|
bool _stampa_ca7; //tabella causali 770
|
||||||
|
bool _tabella_comune;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
virtual bool user_create() ;
|
|
||||||
virtual bool user_destroy() ;
|
virtual bool user_create() ;
|
||||||
virtual bool set_print(int) ;
|
virtual bool user_destroy() ;
|
||||||
|
virtual bool set_print(int) ;
|
||||||
virtual void set_page(int, int);
|
|
||||||
virtual bool preprocess_page (int, int);
|
virtual void set_page(int, int);
|
||||||
virtual bool preprocess_print(int file, int counter);
|
virtual bool preprocess_page (int, int);
|
||||||
|
virtual bool preprocess_print(int file, int counter);
|
||||||
void set_headers();
|
|
||||||
void set_rows();
|
void set_headers();
|
||||||
void set_footers();
|
void set_rows();
|
||||||
void set_translations();
|
void set_footers();
|
||||||
void set_relations();
|
void set_translations();
|
||||||
BA3200_application() {}
|
void set_relations();
|
||||||
virtual ~BA3200_application() {}
|
BA3200_application() {}
|
||||||
};
|
virtual ~BA3200_application() {}
|
||||||
|
};
|
||||||
|
|
||||||
bool BA3200_application::set_print(int)
|
|
||||||
{
|
bool BA3200_application::set_print(int)
|
||||||
TRectype from(_rel->lfile().curr()); from.zero();
|
{
|
||||||
TRectype to (from);
|
TRectype from(_rel->lfile().curr()); from.zero();
|
||||||
|
TRectype to (from);
|
||||||
if (_msk->run() == K_ENTER)
|
|
||||||
{
|
if (_msk->run() == K_ENTER)
|
||||||
const int campi_maschera = _msk->fields();
|
{
|
||||||
for (int i = 0; i < campi_maschera; i++)
|
const int campi_maschera = _msk->fields();
|
||||||
{
|
for (int i = 0; i < campi_maschera; i++)
|
||||||
const TMask_field& campo_maschera = _msk->fld(i);
|
{
|
||||||
const char* val = campo_maschera.get();
|
const TMask_field& campo_maschera = _msk->fld(i);
|
||||||
if (*val)
|
const char* val = campo_maschera.get();
|
||||||
{
|
if (*val)
|
||||||
const TFieldref* campo_ref = campo_maschera.field();
|
{
|
||||||
|
const TFieldref* campo_ref = campo_maschera.field();
|
||||||
if (campo_ref != NULL && campo_ref->ok())
|
|
||||||
{
|
if (campo_ref != NULL && campo_ref->ok())
|
||||||
if (campo_maschera.in_group(1)) campo_ref->write(val, from);
|
{
|
||||||
else
|
if (campo_maschera.in_group(1)) campo_ref->write(val, from);
|
||||||
if (campo_maschera.in_group(2)) campo_ref->write(val, to);
|
else
|
||||||
}
|
if (campo_maschera.in_group(2)) campo_ref->write(val, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_cur->setregion (from, to);
|
|
||||||
return TRUE;
|
_cur->setregion (from, to);
|
||||||
}
|
|
||||||
return FALSE;
|
set_background();
|
||||||
}
|
if (_stampa_ca7)
|
||||||
|
set_background("W1l{1 3 132 3}W1l{1 5 132 5}");
|
||||||
void BA3200_application::set_page (int , int )
|
else set_background("W1l{1 3 132 3}W1l{1 6 132 6}");
|
||||||
{
|
return TRUE;
|
||||||
_string_roman.destroy();
|
}
|
||||||
_field_roman.destroy();
|
return FALSE;
|
||||||
set_rows();
|
}
|
||||||
}
|
|
||||||
|
void BA3200_application::set_page (int , int )
|
||||||
bool BA3200_application::preprocess_page(int , int)
|
{
|
||||||
{
|
_string_roman.destroy();
|
||||||
const int items = _field_roman.items();
|
_field_roman.destroy();
|
||||||
|
set_rows();
|
||||||
if (items > 0)
|
}
|
||||||
{
|
|
||||||
for (int i = 0; i < items; i++)
|
bool BA3200_application::preprocess_page(int , int)
|
||||||
{
|
{
|
||||||
TString& fn = (TString &) _field_roman[i];
|
const int items = _field_roman.items();
|
||||||
TFieldref fld(fn, 0);
|
|
||||||
TString& s = (TString &) _string_roman[i];
|
if (items > 0)
|
||||||
|
{
|
||||||
const int n = atoi(fld.read(_rel));
|
for (int i = 0; i < items; i++)
|
||||||
s = itor(n);
|
{
|
||||||
}
|
TString& fn = (TString &) _field_roman[i];
|
||||||
}
|
TFieldref fld(fn, 0);
|
||||||
// Stampa tabella registri. Calcolo: pagine residue = pagine - stampate
|
TString& s = (TString &) _string_roman[i];
|
||||||
if (_stampa_registri)
|
|
||||||
{
|
const int n = atoi(fld.read(_rel));
|
||||||
const int pagine = _cur->file().get_int("I2");
|
s = itor(n);
|
||||||
const int stampate = _cur->file().get_int("I1");
|
}
|
||||||
const int residue = pagine - stampate;
|
}
|
||||||
if (residue > 0)
|
// Stampa tabella registri. Calcolo: pagine residue = pagine - stampate
|
||||||
set_row(1, "@126g%4d", residue);
|
if (_stampa_registri)
|
||||||
else
|
{
|
||||||
set_row(1, "@126g%4s", " ");
|
const int pagine = _cur->file().get_int("I2");
|
||||||
}
|
const int stampate = _cur->file().get_int("I1");
|
||||||
return TRUE;
|
const int residue = pagine - stampate;
|
||||||
}
|
if (residue > 0)
|
||||||
|
set_row(1, "@126g%4d", residue);
|
||||||
void BA3200_application::set_headers()
|
else
|
||||||
{
|
set_row(1, "@126g%4s", " ");
|
||||||
TString NomeTabella, sep, formato_intesta, testo_intesta;
|
}
|
||||||
int LungRiga, riga_intesta=0, last_riga=1;
|
return TRUE;
|
||||||
TToken_string line;
|
}
|
||||||
TString256 riga;
|
|
||||||
|
void BA3200_application::set_headers()
|
||||||
reset_header ();
|
{
|
||||||
|
TString NomeTabella, sep, formato_intesta, testo_intesta;
|
||||||
TScanner rpt(_rptname);
|
int LungRiga, riga_intesta=0, last_riga=1;
|
||||||
rpt.paragraph("Headers");
|
TToken_string line;
|
||||||
|
TString256 riga;
|
||||||
// Leggo la lunghezza della riga (usata per centrare l'intestazione)
|
|
||||||
line = rpt.line();
|
reset_header ();
|
||||||
LungRiga = line.get_int();
|
|
||||||
|
TScanner rpt(_rptname);
|
||||||
riga.spaces(LungRiga);
|
rpt.paragraph("Headers");
|
||||||
// Senno' nella stampa a 80 non ci sta ditta e data
|
|
||||||
|
// Leggo la lunghezza della riga (usata per centrare l'intestazione)
|
||||||
// Leggo il nome della tabella
|
line = rpt.line();
|
||||||
line = rpt.line();
|
LungRiga = line.get_int();
|
||||||
NomeTabella = line.get();
|
|
||||||
|
riga.spaces(LungRiga);
|
||||||
// Sulla prima riga di intestazione metto la ditta, la data e la pagina
|
// Senno' nella stampa a 80 non ci sta ditta e data
|
||||||
if (!_tabella_comune)
|
|
||||||
{
|
// Leggo il nome della tabella
|
||||||
const long codditta = get_firm();
|
line = rpt.line();
|
||||||
TString80 ragsoc;
|
NomeTabella = line.get();
|
||||||
TLocalisamfile nditte(LF_NDITTE);
|
|
||||||
|
// Sulla prima riga di intestazione metto la ditta, la data e la pagina
|
||||||
nditte.zero();
|
if (!_tabella_comune)
|
||||||
nditte.put(NDT_CODDITTA, codditta);
|
{
|
||||||
if (nditte.read() == NOERR)
|
const long codditta = get_firm();
|
||||||
{
|
TString80 ragsoc;
|
||||||
ragsoc = nditte.get(NDT_RAGSOC);
|
TLocalisamfile nditte(LF_NDITTE);
|
||||||
if (LungRiga < 100) ragsoc.cut(40);
|
|
||||||
}
|
nditte.zero();
|
||||||
riga.overwrite(format("Ditta %4ld %s", codditta,(const char *)ragsoc));
|
nditte.put(NDT_CODDITTA, codditta);
|
||||||
}
|
if (nditte.read() == NOERR)
|
||||||
|
{
|
||||||
riga.overwrite ("Data @< Pag. @#", riga.len()-22);
|
ragsoc = nditte.get(NDT_RAGSOC);
|
||||||
|
if (LungRiga < 100) ragsoc.cut(40);
|
||||||
set_header (last_riga++, "%s", (const char *)riga);
|
}
|
||||||
|
riga.overwrite(format("Ditta %4ld %s", codditta,(const char *)ragsoc));
|
||||||
// Centro il nome della tabella
|
}
|
||||||
// Per la stampa registri non va centrato.
|
|
||||||
// Lo lascio anche per le altre stampe
|
if (_stampa_ca7)
|
||||||
// if (_stampa_registri)
|
{
|
||||||
NomeTabella.left_just (LungRiga);
|
TDate d (_msk->get(F_DATASTAMPA));
|
||||||
/* else
|
printer().setdate(d);
|
||||||
NomeTabella.center_just (LungRiga); */
|
}
|
||||||
|
|
||||||
set_header (last_riga++, "%s", (const char *)NomeTabella);
|
riga.overwrite ("Data @< Pag. @#", riga.len()-22);
|
||||||
|
|
||||||
// Aggiungo una riga vuota per separare prima intestazione
|
set_header (last_riga++, "%s", (const char *)riga);
|
||||||
sep.fill ('-', LungRiga);
|
|
||||||
set_header (last_riga, "%s", (const char *)sep);
|
// Centro il nome della tabella
|
||||||
|
// Per la stampa registri non va centrato.
|
||||||
line = rpt.line();
|
// Lo lascio anche per le altre stampe
|
||||||
while ( (line != "") && (line[0] != '[') )
|
// if (_stampa_registri)
|
||||||
{
|
NomeTabella.left_just (LungRiga);
|
||||||
riga_intesta = atoi (line.get());
|
/* else
|
||||||
formato_intesta = line.get();
|
NomeTabella.center_just (LungRiga); */
|
||||||
testo_intesta = (const char *) line.get();
|
if (_stampa_ca7)
|
||||||
if (riga_intesta)
|
NomeTabella.center_just (LungRiga);
|
||||||
set_header (last_riga+riga_intesta, (const char *)formato_intesta,
|
|
||||||
(const char *)testo_intesta);
|
set_header (last_riga++, "@b%s", (const char *)NomeTabella);
|
||||||
line = rpt.line();
|
|
||||||
}
|
// Aggiungo una riga vuota per separare prima intestazione
|
||||||
|
//sep.fill ('-', LungRiga);
|
||||||
if (riga_intesta) last_riga += riga_intesta;
|
//set_header (last_riga, "%s", (const char *)sep);
|
||||||
last_riga++;
|
|
||||||
set_header (last_riga, (const char *)sep);
|
line = rpt.line();
|
||||||
last_riga++;
|
while ( (line != "") && (line[0] != '[') )
|
||||||
sep.fill(' ');
|
{
|
||||||
set_header (last_riga, (const char *)sep);
|
riga_intesta = atoi (line.get());
|
||||||
}
|
formato_intesta = line.get();
|
||||||
|
testo_intesta = (const char *) line.get();
|
||||||
void BA3200_application::set_rows()
|
if (riga_intesta)
|
||||||
{
|
set_header (last_riga+riga_intesta, (const char *)formato_intesta,
|
||||||
TToken_string line;
|
(const char *)testo_intesta);
|
||||||
TFieldref campo;
|
line = rpt.line();
|
||||||
int from, to, riga_record;
|
}
|
||||||
TString formato_campo, picture;
|
|
||||||
const char * name;
|
if (riga_intesta) last_riga += riga_intesta;
|
||||||
|
last_riga++;
|
||||||
TScanner rpt(_rptname);
|
//set_header (last_riga, (const char *)sep);
|
||||||
rpt.paragraph("Rows");
|
last_riga++;
|
||||||
|
sep.fill(' ');
|
||||||
line = rpt.line();
|
set_header (last_riga, (const char *)sep);
|
||||||
while ( (line != "") && (line[0] != '[') )
|
}
|
||||||
{
|
|
||||||
riga_record = line.get_int();
|
void BA3200_application::set_rows()
|
||||||
|
{
|
||||||
TString s(line.get());
|
TToken_string line;
|
||||||
|
TFieldref campo;
|
||||||
campo = s;
|
int from, to, riga_record;
|
||||||
from = campo.from();
|
TString formato_campo, picture;
|
||||||
to = campo.to();
|
const char * name;
|
||||||
name = campo.name();
|
|
||||||
int logicnum = campo.file() == 0 ? _logicnum : campo.file();
|
TScanner rpt(_rptname);
|
||||||
|
rpt.paragraph("Rows");
|
||||||
formato_campo = line.get();
|
|
||||||
formato_campo.trim();
|
line = rpt.line();
|
||||||
formato_campo.lower();
|
while ( (line != "") && (line[0] != '[') )
|
||||||
const int p = formato_campo.find("@m");
|
{
|
||||||
|
riga_record = line.get_int();
|
||||||
if (p != -1)
|
|
||||||
{
|
TString s(line.get());
|
||||||
formato_campo.cut(p);
|
|
||||||
formato_campo << "#t";
|
campo = s;
|
||||||
_string_roman.add(new TString);
|
from = campo.from();
|
||||||
_field_roman.add(s);
|
to = campo.to();
|
||||||
const int last = _string_roman.items() - 1;
|
name = campo.name();
|
||||||
|
int logicnum = campo.file() == 0 ? _logicnum : campo.file();
|
||||||
set_row (riga_record, formato_campo, _string_roman.objptr(last));
|
|
||||||
}
|
formato_campo = line.get();
|
||||||
else
|
formato_campo.trim();
|
||||||
{
|
formato_campo.lower();
|
||||||
if (formato_campo.find("@pn"))
|
const int p = formato_campo.find("@m");
|
||||||
picture = line.get();
|
|
||||||
else
|
if (p != -1)
|
||||||
picture = "";
|
{
|
||||||
|
formato_campo.cut(p);
|
||||||
if (to == -1)
|
formato_campo << "#t";
|
||||||
if (picture != "")
|
_string_roman.add(new TString);
|
||||||
set_row (riga_record, formato_campo, FLD(logicnum,name,picture) );
|
_field_roman.add(s);
|
||||||
else
|
const int last = _string_roman.items() - 1;
|
||||||
set_row (riga_record, formato_campo, FLD(logicnum,name) );
|
|
||||||
else
|
set_row (riga_record, formato_campo, _string_roman.objptr(last));
|
||||||
set_row (riga_record, formato_campo, FLD(logicnum,name,from,to) );
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
line = (const char *) rpt.line();
|
if (formato_campo.find("@pn"))
|
||||||
}
|
picture = line.get();
|
||||||
}
|
else
|
||||||
|
picture = "";
|
||||||
void BA3200_application::set_footers()
|
|
||||||
{
|
if (to == -1)
|
||||||
TToken_string line;
|
if (picture != "")
|
||||||
int footer_len, riga;
|
set_row (riga_record, formato_campo, FLD(logicnum,name,picture) );
|
||||||
TString formato, testo;
|
else
|
||||||
|
set_row (riga_record, formato_campo, FLD(logicnum,name) );
|
||||||
reset_footer();
|
else
|
||||||
|
set_row (riga_record, formato_campo, FLD(logicnum,name,from,to) );
|
||||||
TScanner rpt(_rptname);
|
}
|
||||||
rpt.paragraph("Footers");
|
|
||||||
|
line = (const char *) rpt.line();
|
||||||
line = rpt.line();
|
}
|
||||||
footer_len = line.get_int();
|
}
|
||||||
if (footer_len) printer().footerlen (footer_len);
|
|
||||||
|
void BA3200_application::set_footers()
|
||||||
line = rpt.line();
|
{
|
||||||
while ( (line != "") && (line[0] != '[') )
|
TToken_string line;
|
||||||
{
|
int footer_len, riga;
|
||||||
riga = line.get_int();
|
TString formato, testo;
|
||||||
formato = line.get();
|
|
||||||
testo = line.get();
|
reset_footer();
|
||||||
set_footer (riga, (const char *)formato, (const char*)testo);
|
|
||||||
line = rpt.line();
|
TScanner rpt(_rptname);
|
||||||
}
|
rpt.paragraph("Footers");
|
||||||
}
|
|
||||||
|
line = rpt.line();
|
||||||
void BA3200_application::set_translations()
|
footer_len = line.get_int();
|
||||||
{
|
if (footer_len) printer().footerlen (footer_len);
|
||||||
TString campo, from, to;
|
|
||||||
TToken_string line;
|
line = rpt.line();
|
||||||
int logicnum;
|
while ( (line != "") && (line[0] != '[') )
|
||||||
|
{
|
||||||
TScanner rpt(_rptname);
|
riga = line.get_int();
|
||||||
rpt.paragraph("Translations");
|
formato = line.get();
|
||||||
|
testo = line.get();
|
||||||
line = rpt.line();
|
set_footer (riga, (const char *)formato, (const char*)testo);
|
||||||
while ( (line != "") && (line[0] != '[') )
|
line = rpt.line();
|
||||||
{
|
}
|
||||||
logicnum = line.get_int();
|
}
|
||||||
campo = line.get();
|
|
||||||
from = line.get();
|
void BA3200_application::set_translations()
|
||||||
to = line.get();
|
{
|
||||||
set_translation (logicnum, (char*)(const char *)campo, (char*)(const char *)from, (char*)(const char *)to);
|
TString campo, from, to;
|
||||||
line = rpt.line();
|
TToken_string line;
|
||||||
}
|
int logicnum;
|
||||||
}
|
|
||||||
|
TScanner rpt(_rptname);
|
||||||
void BA3200_application::set_relations()
|
rpt.paragraph("Translations");
|
||||||
{
|
|
||||||
TToken_string line("", ',');
|
line = rpt.line();
|
||||||
TString tab(16), expr(40);
|
while ( (line != "") && (line[0] != '[') )
|
||||||
int key, linkto, alias, logicnum;
|
{
|
||||||
|
logicnum = line.get_int();
|
||||||
TScanner rpt(_rptname);
|
campo = line.get();
|
||||||
rpt.paragraph("Relations");
|
from = line.get();
|
||||||
|
to = line.get();
|
||||||
line = rpt.line();
|
set_translation (logicnum, (char*)(const char *)campo, (char*)(const char *)from, (char*)(const char *)to);
|
||||||
while ( (line != "") && (line[0] != '[') )
|
line = rpt.line();
|
||||||
{
|
}
|
||||||
tab = line.get();
|
}
|
||||||
logicnum = atoi(tab);
|
|
||||||
expr = line.get();
|
void BA3200_application::set_relations()
|
||||||
key = line.get_int();
|
{
|
||||||
if (key == 0) key = 1;
|
TToken_string line("", ',');
|
||||||
linkto = line.get_int();
|
TString tab(16), expr(40);
|
||||||
alias = line.get_int();
|
int key, linkto, alias, logicnum;
|
||||||
if (logicnum > 0)
|
|
||||||
_rel->add(logicnum, expr, key, linkto, alias);
|
TScanner rpt(_rptname);
|
||||||
else
|
rpt.paragraph("Relations");
|
||||||
_rel->add(tab, expr, key, linkto, alias);
|
|
||||||
|
line = rpt.line();
|
||||||
line = rpt.line();
|
while ( (line != "") && (line[0] != '[') )
|
||||||
}
|
{
|
||||||
}
|
tab = line.get();
|
||||||
bool BA3200_application::user_create()
|
logicnum = atoi(tab);
|
||||||
{
|
expr = line.get();
|
||||||
_tabname = argv(2);
|
key = line.get_int();
|
||||||
|
if (key == 0) key = 1;
|
||||||
TString16 t(_tabname);
|
linkto = line.get_int();
|
||||||
|
alias = line.get_int();
|
||||||
_tabella_comune = (t[0] == '%');
|
if (logicnum > 0)
|
||||||
if (_tabella_comune)
|
_rel->add(logicnum, expr, key, linkto, alias);
|
||||||
t.ltrim(1);
|
else
|
||||||
|
_rel->add(tab, expr, key, linkto, alias);
|
||||||
_rptname << "batb" << t << ".rpt" ;
|
|
||||||
|
line = rpt.line();
|
||||||
// Flag per la stampa tabella registri
|
}
|
||||||
_stampa_registri = (_tabname.upper() == "REG");
|
}
|
||||||
|
bool BA3200_application::user_create()
|
||||||
if (!fexist(_rptname))
|
{
|
||||||
fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname);
|
_tabname = argv(2);
|
||||||
|
|
||||||
_rel = new TRelation (_tabname);
|
TString16 t(_tabname);
|
||||||
_cur = new TCursor (_rel);
|
|
||||||
t = _tabname;
|
_tabella_comune = (t[0] == '%');
|
||||||
|
if (_tabella_comune)
|
||||||
if (t[0] == '%')
|
t.ltrim(1);
|
||||||
t.ltrim(1);
|
|
||||||
|
_rptname << "batb" << t << ".rpt" ;
|
||||||
|
|
||||||
_maskname << "bast" << t;
|
// Flag per la stampa tabella registri
|
||||||
_msk = new TMask (_maskname) ;
|
_stampa_registri = (_tabname.upper() == "REG");
|
||||||
|
_stampa_ca7 = (_tabname.upper() == "%CA7");
|
||||||
add_cursor (_cur);
|
|
||||||
add_file (_tabname);
|
if (!fexist(_rptname))
|
||||||
|
fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname);
|
||||||
_logicnum = _cur->file().num();
|
|
||||||
|
_rel = new TRelation (_tabname);
|
||||||
reset_print ();
|
_cur = new TCursor (_rel);
|
||||||
|
t = _tabname;
|
||||||
printer().footerlen (FOOTER_LEN);
|
|
||||||
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
|
if (t[0] == '%')
|
||||||
|
t.ltrim(1);
|
||||||
#ifdef DBG1
|
|
||||||
set_fillchar ('.');
|
|
||||||
#endif
|
_maskname << "bast" << t;
|
||||||
set_relations();
|
_msk = new TMask (_maskname) ;
|
||||||
return TRUE;
|
|
||||||
}
|
add_cursor (_cur);
|
||||||
|
add_file (_tabname);
|
||||||
bool BA3200_application::preprocess_print(int file, int counter)
|
|
||||||
{
|
_logicnum = _cur->file().num();
|
||||||
set_headers();
|
|
||||||
set_footers();
|
reset_print ();
|
||||||
set_translations();
|
|
||||||
return TRUE;
|
printer().footerlen (FOOTER_LEN);
|
||||||
}
|
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
|
||||||
|
|
||||||
bool BA3200_application::user_destroy()
|
#ifdef DBG1
|
||||||
{
|
set_fillchar ('.');
|
||||||
delete _msk;
|
#endif
|
||||||
delete _cur;
|
set_relations();
|
||||||
delete _rel;
|
return TRUE;
|
||||||
return TRUE;
|
}
|
||||||
}
|
|
||||||
|
bool BA3200_application::preprocess_print(int file, int counter)
|
||||||
int ba3200(int argc, char* argv[])
|
{
|
||||||
{
|
set_headers();
|
||||||
BA3200_application a;
|
set_footers();
|
||||||
a.run(argc, argv, "Stampa tabella");
|
set_translations();
|
||||||
return 0;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BA3200_application::user_destroy()
|
||||||
|
{
|
||||||
|
delete _msk;
|
||||||
|
delete _cur;
|
||||||
|
delete _rel;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ba3200(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
BA3200_application a;
|
||||||
|
a.run(argc, argv, "Stampa tabella");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
70
ba/ba3200.h
70
ba/ba3200.h
@ -1,34 +1,36 @@
|
|||||||
#ifndef __BA3200_H
|
#ifndef __BA3200_H
|
||||||
#define __BA3200_H
|
#define __BA3200_H
|
||||||
|
|
||||||
#define F_INIZIO0 100
|
#define F_INIZIO0 100
|
||||||
#define F_INIZIO1 101
|
#define F_INIZIO1 101
|
||||||
#define F_INIZIO2 102
|
#define F_INIZIO2 102
|
||||||
#define F_INIZIO3 103
|
#define F_INIZIO3 103
|
||||||
#define F_INIZIO4 104
|
#define F_INIZIO4 104
|
||||||
#define F_INIZIO5 105
|
#define F_INIZIO5 105
|
||||||
#define F_INIZIO6 106
|
#define F_INIZIO6 106
|
||||||
#define F_INIZIO7 107
|
#define F_INIZIO7 107
|
||||||
#define F_INIZIO8 108
|
#define F_INIZIO8 108
|
||||||
#define F_INIZIO9 109
|
#define F_INIZIO9 109
|
||||||
#define F_INIZIO10 110
|
#define F_INIZIO10 110
|
||||||
#define F_FINE1 201
|
#define F_FINE1 201
|
||||||
#define F_FINE2 202
|
#define F_FINE2 202
|
||||||
#define F_FINE3 203
|
#define F_FINE3 203
|
||||||
#define F_FINE4 204
|
#define F_FINE4 204
|
||||||
#define F_FINE5 205
|
#define F_FINE5 205
|
||||||
#define F_FINE6 206
|
#define F_FINE6 206
|
||||||
#define F_FINE7 207
|
#define F_FINE7 207
|
||||||
#define F_FINE8 208
|
#define F_FINE8 208
|
||||||
#define F_FINE9 209
|
#define F_FINE9 209
|
||||||
#define F_FINE10 210
|
#define F_FINE10 210
|
||||||
|
|
||||||
#define F_CODDITTA 211
|
#define F_CODDITTA 211
|
||||||
#define F_RAGSOC 212
|
#define F_RAGSOC 212
|
||||||
|
|
||||||
#endif
|
#define F_DATASTAMPA 213
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user