Correzioni AGA n.134-145
git-svn-id: svn://10.65.10.50/trunk@146 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
291307af56
commit
af9ae417a7
124
ba/ba3200.cpp
124
ba/ba3200.cpp
@ -17,15 +17,15 @@
|
|||||||
|
|
||||||
class BA3200_application : public TPrintapp
|
class BA3200_application : public TPrintapp
|
||||||
{
|
{
|
||||||
// TTable* _tab;
|
|
||||||
TString _tabname;
|
TString _tabname;
|
||||||
TFilename _rptname;
|
TFilename _rptname;
|
||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
TCursor *_cur;
|
TCursor *_cur;
|
||||||
TMask* _msk;
|
TMask* _msk;
|
||||||
TString _maskname;
|
TString _maskname;
|
||||||
// TScanner *_rpt;
|
|
||||||
int _logicnum;
|
int _logicnum;
|
||||||
|
TArray _string_roman;
|
||||||
|
TArray _field_roman;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -34,12 +34,14 @@ public:
|
|||||||
virtual bool set_print(int) ;
|
virtual bool set_print(int) ;
|
||||||
|
|
||||||
virtual void set_page(int, int);
|
virtual void set_page(int, int);
|
||||||
|
virtual bool preprocess_page (int, int);
|
||||||
|
|
||||||
void leggi_rpt();
|
void leggi_rpt();
|
||||||
void set_headers();
|
void set_headers();
|
||||||
void set_rows();
|
void set_rows();
|
||||||
void set_footers();
|
void set_footers();
|
||||||
void set_translations();
|
void set_translations();
|
||||||
|
void set_relations();
|
||||||
BA3200_application(const char * tabname) : _tabname(tabname) {}
|
BA3200_application(const char * tabname) : _tabname(tabname) {}
|
||||||
virtual ~BA3200_application() {}
|
virtual ~BA3200_application() {}
|
||||||
};
|
};
|
||||||
@ -47,26 +49,27 @@ public:
|
|||||||
|
|
||||||
bool BA3200_application::set_print(int)
|
bool BA3200_application::set_print(int)
|
||||||
{
|
{
|
||||||
TRectype from(_rel->lfile()->curr());
|
TRectype from(_rel->lfile()->curr()); from.zero();
|
||||||
TRectype to (_rel->lfile()->curr());
|
TRectype to (from);
|
||||||
|
|
||||||
from.zero();
|
if (_msk->run() == K_ENTER)
|
||||||
to.zero();
|
|
||||||
const KEY tasto = _msk->run();
|
|
||||||
|
|
||||||
if (tasto == K_ENTER)
|
|
||||||
{
|
{
|
||||||
const int campi_maschera = _msk->fields(); // - 2; Tolgo bottoni...
|
const int campi_maschera = _msk->fields();
|
||||||
for (int i = 0; i < campi_maschera; i++)
|
for (int i = 0; i < campi_maschera; i++)
|
||||||
{
|
{
|
||||||
const TMask_field& campo_maschera = _msk->fld(i);
|
const TMask_field& campo_maschera = _msk->fld(i);
|
||||||
const char* val = campo_maschera.get();
|
const char* val = campo_maschera.get();
|
||||||
const TFieldref* campo_ref = campo_maschera.field();
|
if (*val)
|
||||||
if (*val && campo_ref != NULL && campo_ref->ok())
|
|
||||||
{
|
{
|
||||||
if (campo_maschera.in_group(1)) campo_ref->write(val, from); else
|
const TFieldref* campo_ref = campo_maschera.field();
|
||||||
if (campo_maschera.in_group(2)) campo_ref->write(val, to);
|
|
||||||
}
|
if (campo_ref != NULL && campo_ref->ok())
|
||||||
|
{
|
||||||
|
if (campo_maschera.in_group(1)) campo_ref->write(val, from);
|
||||||
|
else
|
||||||
|
if (campo_maschera.in_group(2)) campo_ref->write(val, to);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_cur->setregion (from, to);
|
_cur->setregion (from, to);
|
||||||
@ -77,9 +80,30 @@ bool BA3200_application::set_print(int)
|
|||||||
|
|
||||||
void BA3200_application::set_page (int , int )
|
void BA3200_application::set_page (int , int )
|
||||||
{
|
{
|
||||||
|
_string_roman.destroy();
|
||||||
|
_field_roman.destroy();
|
||||||
leggi_rpt();
|
leggi_rpt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BA3200_application::preprocess_page(int , int)
|
||||||
|
{
|
||||||
|
const int items = _field_roman.items();
|
||||||
|
|
||||||
|
if (items > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < items; i++)
|
||||||
|
{
|
||||||
|
TString& fn = (TString &) _field_roman[i];
|
||||||
|
TFieldref fld(fn, 0);
|
||||||
|
TString& s = (TString &) _string_roman[i];
|
||||||
|
|
||||||
|
const int n = atoi(fld.read(_rel));
|
||||||
|
s = itor(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void BA3200_application::set_headers()
|
void BA3200_application::set_headers()
|
||||||
{
|
{
|
||||||
TString NomeTabella, sep, formato_intesta, testo_intesta;
|
TString NomeTabella, sep, formato_intesta, testo_intesta;
|
||||||
@ -145,26 +169,44 @@ void BA3200_application::set_rows()
|
|||||||
{
|
{
|
||||||
riga_record = line.get_int();
|
riga_record = line.get_int();
|
||||||
|
|
||||||
campo = line.get();
|
TString s(line.get());
|
||||||
|
|
||||||
|
campo = s;
|
||||||
from = campo.from();
|
from = campo.from();
|
||||||
to = campo.to();
|
to = campo.to();
|
||||||
name = campo.name();
|
name = campo.name();
|
||||||
|
int logicnum = campo.file() == 0 ? _logicnum : campo.file();
|
||||||
|
|
||||||
formato_campo = line.get();
|
formato_campo = line.get();
|
||||||
formato_campo.trim();
|
formato_campo.trim();
|
||||||
|
formato_campo.lower();
|
||||||
|
const int p = formato_campo.find("@m");
|
||||||
|
|
||||||
if (formato_campo.lower() == "@pn")
|
if (p != -1)
|
||||||
picture = line.get();
|
{
|
||||||
else
|
formato_campo.cut(p);
|
||||||
picture = "";
|
formato_campo << "#t";
|
||||||
|
_string_roman.add(new TString);
|
||||||
|
_field_roman.add(s);
|
||||||
|
const int last = _string_roman.items() - 1;
|
||||||
|
|
||||||
if (to == -1)
|
set_row (riga_record, formato_campo, _string_roman.objptr(last));
|
||||||
if (picture != "")
|
}
|
||||||
set_row (riga_record, formato_campo, FLD(_logicnum,name,picture) );
|
|
||||||
else
|
|
||||||
set_row (riga_record, formato_campo, FLD(_logicnum,name) );
|
|
||||||
else
|
else
|
||||||
set_row (riga_record, formato_campo, FLD(_logicnum,name,from,to) );
|
{
|
||||||
|
if (formato_campo.find("@pn"))
|
||||||
|
picture = line.get();
|
||||||
|
else
|
||||||
|
picture = "";
|
||||||
|
|
||||||
|
if (to == -1)
|
||||||
|
if (picture != "")
|
||||||
|
set_row (riga_record, formato_campo, FLD(logicnum,name,picture) );
|
||||||
|
else
|
||||||
|
set_row (riga_record, formato_campo, FLD(logicnum,name) );
|
||||||
|
else
|
||||||
|
set_row (riga_record, formato_campo, FLD(logicnum,name,from,to) );
|
||||||
|
}
|
||||||
|
|
||||||
line = (const char *) rpt.line();
|
line = (const char *) rpt.line();
|
||||||
}
|
}
|
||||||
@ -217,6 +259,33 @@ void BA3200_application::set_translations()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BA3200_application::set_relations()
|
||||||
|
{
|
||||||
|
TToken_string line("", ',');
|
||||||
|
TString tab(16), expr(40);
|
||||||
|
int key, linkto, alias, logicnum;
|
||||||
|
|
||||||
|
TScanner rpt(_rptname);
|
||||||
|
rpt.paragraph("Relations");
|
||||||
|
|
||||||
|
line = rpt.line();
|
||||||
|
while ( (line != "") && (line[0] != '[') )
|
||||||
|
{
|
||||||
|
tab = line.get();
|
||||||
|
logicnum = atoi(tab);
|
||||||
|
expr = line.get();
|
||||||
|
key = line.get_int();
|
||||||
|
if (key == 0) key = 1;
|
||||||
|
linkto = line.get_int();
|
||||||
|
alias = line.get_int();
|
||||||
|
if (logicnum > 0)
|
||||||
|
_rel->add(logicnum, expr, key, linkto, alias);
|
||||||
|
else
|
||||||
|
_rel->add(tab, expr, key, linkto, alias);
|
||||||
|
|
||||||
|
line = rpt.line();
|
||||||
|
}
|
||||||
|
}
|
||||||
void BA3200_application::leggi_rpt()
|
void BA3200_application::leggi_rpt()
|
||||||
{
|
{
|
||||||
set_rows();
|
set_rows();
|
||||||
@ -249,6 +318,7 @@ void BA3200_application::user_create()
|
|||||||
set_headers();
|
set_headers();
|
||||||
set_footers();
|
set_footers();
|
||||||
set_translations();
|
set_translations();
|
||||||
|
set_relations();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BA3200_application::user_destroy()
|
void BA3200_application::user_destroy()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user