Modificato MainApp in main_app e aggiornati i vari TRelation::lfile()
git-svn-id: svn://10.65.10.50/trunk@273 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c71c0a1884
commit
53a4d0abbf
392
ba/ba1102.cpp
392
ba/ba1102.cpp
@ -1,196 +1,196 @@
|
||||
#include <relation.h>
|
||||
#include <mask.h>
|
||||
#include <sheet.h>
|
||||
#include <progind.h>
|
||||
#include <defmask.h>
|
||||
|
||||
#include "ba1100.h"
|
||||
|
||||
|
||||
|
||||
bool TEdit_file::browse(int logicnum, const char* name)
|
||||
{
|
||||
TRelation relation(logicnum);
|
||||
TCursor cursor(&relation);
|
||||
TRectype& curr = cursor.curr();
|
||||
TRectype svrec(cursor.curr());
|
||||
|
||||
TToken_string head(256);
|
||||
TToken_string trac(256);
|
||||
|
||||
const char* n;
|
||||
trac.add("");
|
||||
head.add("@1");
|
||||
|
||||
for(int i = 0; (n = curr.fieldname(i)) != NULL; i++)
|
||||
{
|
||||
trac.add(n);
|
||||
head.add(n);
|
||||
|
||||
int len = curr.length(n);
|
||||
if (curr.type(n) == _datefld) len = 10;
|
||||
if (len > strlen(n)) head << '@' << len;
|
||||
}
|
||||
|
||||
KEY ch;
|
||||
TCursor_sheet sheet(&cursor, trac, name, head, 6);
|
||||
|
||||
while ((ch = sheet.run()) != K_ESC)
|
||||
{
|
||||
if (ch == K_DEL && sheet.one_checked())
|
||||
{
|
||||
TProgind* pind = NULL;
|
||||
cursor.freeze(TRUE);
|
||||
bool go = FALSE;
|
||||
bool first = FALSE;
|
||||
int j;
|
||||
for (j = 0, cursor = 0; j < sheet.items(); ++cursor, j++)
|
||||
{
|
||||
if (sheet.checked(j))
|
||||
{
|
||||
if (!go && !first)
|
||||
go = yesno_box("Confermi la cancellazione dei %d "
|
||||
"record indicati?", sheet.checked());
|
||||
first = TRUE;
|
||||
|
||||
if (!pind)
|
||||
{
|
||||
pind = new TProgind(sheet.checked(),"Attendere...",
|
||||
TRUE, TRUE, 32);
|
||||
pind->addstatus(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pind->iscancelled()) break;
|
||||
pind->addstatus(1);
|
||||
}
|
||||
|
||||
if (go) cursor.file()->remove();
|
||||
sheet.uncheck(j);
|
||||
}
|
||||
}
|
||||
if (pind) delete pind;
|
||||
cursor.freeze(FALSE);
|
||||
|
||||
if (first) {sheet.select(1); continue;}
|
||||
}
|
||||
if (ch == K_ENTER || ch == K_DEL)
|
||||
cursor = sheet.selected();
|
||||
|
||||
switch(ch)
|
||||
{
|
||||
case K_ENTER: // edit fields
|
||||
svrec = curr;
|
||||
if (edit_record(curr, FALSE) == K_ENTER)
|
||||
{
|
||||
TString s(svrec.key(1));
|
||||
|
||||
if (s != curr.key(1))
|
||||
{
|
||||
cursor.file()->write();
|
||||
if (cursor.file()->good())
|
||||
{
|
||||
curr = svrec;
|
||||
cursor.file()->remove();
|
||||
}
|
||||
}
|
||||
else
|
||||
cursor.file()->rewrite();
|
||||
}
|
||||
break;
|
||||
case K_DEL: // delete record
|
||||
if (yesno_box("Confermare la cancellazione del record"))
|
||||
cursor.file()->remove();
|
||||
break;
|
||||
case K_INS: // insert new record
|
||||
curr.zero();
|
||||
if (edit_record(curr,FALSE) == K_ENTER)
|
||||
cursor.file()->write();
|
||||
break;
|
||||
}
|
||||
sheet.force_update();
|
||||
}
|
||||
return K_ESC;
|
||||
}
|
||||
|
||||
KEY TEdit_file::edit_record(TRectype& rec, bool readonly)
|
||||
{
|
||||
for(int recs = 0; rec.fieldname(recs) != NULL; recs++);
|
||||
|
||||
int rows = recs > 15 ? 20 : recs+4;
|
||||
int pages = recs/15 + (recs % 15 ? 1 : 0);
|
||||
TMask m("Modifica record", pages, 78, rows);
|
||||
|
||||
int curpage = 0, currow = 1, nid = 100;
|
||||
const char* cp;
|
||||
|
||||
for(int i = 0; (cp = rec.fieldname(i)) != NULL; i++)
|
||||
{
|
||||
// add fields ONE by ONE
|
||||
TString16 s(cp); s.left_just(16);
|
||||
int len = rec.length(cp);
|
||||
switch (rec.type(cp))
|
||||
{
|
||||
case _alfafld:
|
||||
m.add_string(nid++,curpage, s, 3, currow, len, "",
|
||||
len > 50 ? 50 : len);
|
||||
break;
|
||||
case _intfld:
|
||||
case _longfld:
|
||||
case _wordfld:
|
||||
case _realfld:
|
||||
m.add_number(nid++, curpage, s, 3, currow, len, "",
|
||||
rec.ndec(cp));
|
||||
break;
|
||||
case _datefld:
|
||||
m.add_date(nid++, curpage, s, 3, currow);
|
||||
break;
|
||||
case _charfld:
|
||||
case _boolfld:
|
||||
m.add_string(nid++,curpage, s, 3, currow, 1);
|
||||
break;
|
||||
case _intzerofld:
|
||||
case _longzerofld:
|
||||
m.add_number(nid++, curpage, s, 3, currow, len, "Z",
|
||||
rec.ndec(cp));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m.field(nid-1).set(rec.get(cp));
|
||||
|
||||
if (((i+1) % 15) == 0 || i == recs-1)
|
||||
{
|
||||
m.add_button(DLG_OK, curpage, "", -12, -1, 9, 2);
|
||||
m.add_button(DLG_CANCEL, curpage, "", -22, -1, 9, 2);
|
||||
curpage++; currow = 1;
|
||||
}
|
||||
else currow++;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
const int max = m.fields();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.class_id() != CLASS_BUTTON_FIELD)
|
||||
f.disable();
|
||||
}
|
||||
}
|
||||
|
||||
const KEY k = m.run();
|
||||
|
||||
if (k == K_ENTER && !readonly)
|
||||
{
|
||||
nid = 100;
|
||||
for(i = 0; (cp = rec.fieldname(i)) != NULL; i++)
|
||||
rec.put(cp, m.get(nid++));
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include <relation.h>
|
||||
#include <mask.h>
|
||||
#include <sheet.h>
|
||||
#include <progind.h>
|
||||
#include <defmask.h>
|
||||
|
||||
#include "ba1100.h"
|
||||
|
||||
|
||||
|
||||
bool TEdit_file::browse(int logicnum, const char* name)
|
||||
{
|
||||
TRelation relation(logicnum);
|
||||
TCursor cursor(&relation);
|
||||
TRectype& curr = cursor.curr();
|
||||
TRectype svrec(cursor.curr());
|
||||
|
||||
TToken_string head(256);
|
||||
TToken_string trac(256);
|
||||
|
||||
const char* n;
|
||||
trac.add("");
|
||||
head.add("@1");
|
||||
|
||||
for(int i = 0; (n = curr.fieldname(i)) != NULL; i++)
|
||||
{
|
||||
trac.add(n);
|
||||
head.add(n);
|
||||
|
||||
int len = curr.length(n);
|
||||
if (curr.type(n) == _datefld) len = 10;
|
||||
if (len > (int)strlen(n)) head << '@' << len;
|
||||
}
|
||||
|
||||
KEY ch;
|
||||
TCursor_sheet sheet(&cursor, trac, name, head, 6);
|
||||
|
||||
while ((ch = sheet.run()) != K_ESC)
|
||||
{
|
||||
if (ch == K_DEL && sheet.one_checked())
|
||||
{
|
||||
TProgind* pind = NULL;
|
||||
cursor.freeze(TRUE);
|
||||
bool go = FALSE;
|
||||
bool first = FALSE;
|
||||
int j;
|
||||
for (j = 0, cursor = 0; j < sheet.items(); ++cursor, j++)
|
||||
{
|
||||
if (sheet.checked(j))
|
||||
{
|
||||
if (!go && !first)
|
||||
go = yesno_box("Confermi la cancellazione dei %d "
|
||||
"record indicati?", sheet.checked());
|
||||
first = TRUE;
|
||||
|
||||
if (!pind)
|
||||
{
|
||||
pind = new TProgind(sheet.checked(),"Attendere...",
|
||||
TRUE, TRUE, 32);
|
||||
pind->addstatus(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pind->iscancelled()) break;
|
||||
pind->addstatus(1);
|
||||
}
|
||||
|
||||
if (go) cursor.file().remove();
|
||||
sheet.uncheck(j);
|
||||
}
|
||||
}
|
||||
if (pind) delete pind;
|
||||
cursor.freeze(FALSE);
|
||||
|
||||
if (first) {sheet.select(1); continue;}
|
||||
}
|
||||
if (ch == K_ENTER || ch == K_DEL)
|
||||
cursor = sheet.selected();
|
||||
|
||||
switch(ch)
|
||||
{
|
||||
case K_ENTER: // edit fields
|
||||
svrec = curr;
|
||||
if (edit_record(curr, FALSE) == K_ENTER)
|
||||
{
|
||||
TString s(svrec.key(1));
|
||||
|
||||
if (s != curr.key(1))
|
||||
{
|
||||
cursor.file().write();
|
||||
if (cursor.file().good())
|
||||
{
|
||||
curr = svrec;
|
||||
cursor.file().remove();
|
||||
}
|
||||
}
|
||||
else
|
||||
cursor.file().rewrite();
|
||||
}
|
||||
break;
|
||||
case K_DEL: // delete record
|
||||
if (yesno_box("Confermare la cancellazione del record"))
|
||||
cursor.file().remove();
|
||||
break;
|
||||
case K_INS: // insert new record
|
||||
curr.zero();
|
||||
if (edit_record(curr,FALSE) == K_ENTER)
|
||||
cursor.file().write();
|
||||
break;
|
||||
}
|
||||
sheet.force_update();
|
||||
}
|
||||
return K_ESC;
|
||||
}
|
||||
|
||||
KEY TEdit_file::edit_record(TRectype& rec, bool readonly)
|
||||
{
|
||||
for(int recs = 0; rec.fieldname(recs) != NULL; recs++);
|
||||
|
||||
int rows = recs > 15 ? 20 : recs+4;
|
||||
int pages = recs/15 + (recs % 15 ? 1 : 0);
|
||||
TMask m("Modifica record", pages, 78, rows);
|
||||
|
||||
int curpage = 0, currow = 1, nid = 100;
|
||||
const char* cp;
|
||||
|
||||
for(int i = 0; (cp = rec.fieldname(i)) != NULL; i++)
|
||||
{
|
||||
// add fields ONE by ONE
|
||||
TString16 s(cp); s.left_just(16);
|
||||
int len = rec.length(cp);
|
||||
switch (rec.type(cp))
|
||||
{
|
||||
case _alfafld:
|
||||
m.add_string(nid++,curpage, s, 3, currow, len, "",
|
||||
len > 50 ? 50 : len);
|
||||
break;
|
||||
case _intfld:
|
||||
case _longfld:
|
||||
case _wordfld:
|
||||
case _realfld:
|
||||
m.add_number(nid++, curpage, s, 3, currow, len, "",
|
||||
rec.ndec(cp));
|
||||
break;
|
||||
case _datefld:
|
||||
m.add_date(nid++, curpage, s, 3, currow);
|
||||
break;
|
||||
case _charfld:
|
||||
case _boolfld:
|
||||
m.add_string(nid++,curpage, s, 3, currow, 1);
|
||||
break;
|
||||
case _intzerofld:
|
||||
case _longzerofld:
|
||||
m.add_number(nid++, curpage, s, 3, currow, len, "Z",
|
||||
rec.ndec(cp));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m.field(nid-1).set(rec.get(cp));
|
||||
|
||||
if (((i+1) % 15) == 0 || i == recs-1)
|
||||
{
|
||||
m.add_button(DLG_OK, curpage, "", -12, -1, 9, 2);
|
||||
m.add_button(DLG_CANCEL, curpage, "", -22, -1, 9, 2);
|
||||
curpage++; currow = 1;
|
||||
}
|
||||
else currow++;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
const int max = m.fields();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.class_id() != CLASS_BUTTON_FIELD)
|
||||
f.disable();
|
||||
}
|
||||
}
|
||||
|
||||
const KEY k = m.run();
|
||||
|
||||
if (k == K_ENTER && !readonly)
|
||||
{
|
||||
nid = 100;
|
||||
for(i = 0; (cp = rec.fieldname(i)) != NULL; i++)
|
||||
rec.put(cp, m.get(nid++));
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
304
ba/ba3100.cpp
304
ba/ba3100.cpp
@ -1,152 +1,152 @@
|
||||
#include <relapp.h>
|
||||
#include <stdtypes.h>
|
||||
#include <lffiles.h>
|
||||
#include <tabutil.h>
|
||||
#include <execp.h>
|
||||
#include <utility.h>
|
||||
#include "ba3.h"
|
||||
#include "ba3100.h"
|
||||
#include "batbreg.h"
|
||||
|
||||
#define FPC "FPC"
|
||||
#define REG_JOURNAL 5
|
||||
|
||||
class BA3100_application : public TRelation_application
|
||||
{
|
||||
TMask* _msk;
|
||||
TRelation* _rel;
|
||||
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);
|
||||
|
||||
public:
|
||||
BA3100_application(const char* tabname) : _tabname(tabname) , _oldditta(-1), _oldanno(-1), _exist_journal(FALSE) {}
|
||||
virtual ~BA3100_application() {}
|
||||
bool exist_journal() {return _exist_journal;}
|
||||
void print();
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
long ditta = get_firm();
|
||||
int anno = atoi(m.get(F_ANNO));
|
||||
|
||||
if (ditta != _oldditta || anno != _oldanno)
|
||||
{
|
||||
_oldditta = ditta;
|
||||
_oldanno = anno;
|
||||
|
||||
TTable reg(_tabname);
|
||||
|
||||
reg.zero();
|
||||
reg.put("CODTAB", m.get(F_ANNO));
|
||||
|
||||
TRectype to(reg.curr());
|
||||
_exist_journal = FALSE;
|
||||
|
||||
for (reg.read(_isgteq); !_exist_journal && reg.good() && reg.curr() <= to; reg.next())
|
||||
_exist_journal = (reg.get_long("I0") == REG_JOURNAL);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if (!prot)
|
||||
{
|
||||
if (_tabname == "%IVD") // Impedisce la cancellazione di una classe se ha sottoclassi
|
||||
{
|
||||
const TRecnotype pos = _rel->lfile()->recno();
|
||||
const TString cod(rec.get("CODTAB"));
|
||||
const int err = _rel->lfile()->next();
|
||||
if (err == NOERR)
|
||||
{
|
||||
TString next(_rel->lfile()->get("CODTAB")); next.cut(cod.len());
|
||||
prot = cod == next;
|
||||
}
|
||||
_rel->lfile()->readat(pos);
|
||||
}
|
||||
}
|
||||
return prot;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
||||
|
||||
{
|
||||
if ((k == K_TAB || k == K_ENTER) &&
|
||||
((BA3100_application*) MainApp())->exist_journal() &&
|
||||
atoi(f.get()) == REG_JOURNAL)
|
||||
return error_box("Non e' possibile avere due registri giornale nello stesso anno");
|
||||
return TRUE;
|
||||
}
|
||||
bool BA3100_application::user_create()
|
||||
{
|
||||
_tabname.upper();
|
||||
TString m(16); m << "BATB" << _tabname;
|
||||
_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);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool BA3100_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ba3100(int argc, char* argv[])
|
||||
{
|
||||
BA3100_application a(argv[2]) ;
|
||||
a.run(argc, argv, "Tabella");
|
||||
return 0;
|
||||
}
|
||||
#include <relapp.h>
|
||||
#include <stdtypes.h>
|
||||
#include <tabutil.h>
|
||||
#include <execp.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "ba3.h"
|
||||
#include "ba3100.h"
|
||||
#include "batbreg.h"
|
||||
|
||||
#define FPC "FPC"
|
||||
#define REG_JOURNAL 5
|
||||
|
||||
class BA3100_application : public TRelation_application
|
||||
{
|
||||
TMask* _msk;
|
||||
TRelation* _rel;
|
||||
TString _tabname;
|
||||
long _oldditta;
|
||||
int _oldanno;
|
||||
bool _exist_journal;
|
||||
|
||||
bool user_create() ;
|
||||
bool user_destroy() ;
|
||||
virtual bool protected_record(const 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:
|
||||
BA3100_application(const char* tabname) : _tabname(tabname) , _oldditta(-1), _oldanno(-1), _exist_journal(FALSE) {}
|
||||
virtual ~BA3100_application() {}
|
||||
bool exist_journal() {return _exist_journal;}
|
||||
void print();
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
long ditta = get_firm();
|
||||
int anno = atoi(m.get(F_ANNO));
|
||||
|
||||
if (ditta != _oldditta || anno != _oldanno)
|
||||
{
|
||||
_oldditta = ditta;
|
||||
_oldanno = anno;
|
||||
|
||||
TTable reg(_tabname);
|
||||
|
||||
reg.zero();
|
||||
reg.put("CODTAB", m.get(F_ANNO));
|
||||
|
||||
TRectype to(reg.curr());
|
||||
_exist_journal = FALSE;
|
||||
|
||||
for (reg.read(_isgteq); !_exist_journal && reg.good() && reg.curr() <= to; reg.next())
|
||||
_exist_journal = (reg.get_long("I0") == REG_JOURNAL);
|
||||
}
|
||||
}
|
||||
|
||||
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(const TRectype& rec)
|
||||
{
|
||||
bool prot = rec.get_bool(FPC);
|
||||
if (!prot)
|
||||
{
|
||||
if (_tabname == "%IVD") // Impedisce la cancellazione di una classe se ha sottoclassi
|
||||
{
|
||||
const TRecnotype pos = _rel->lfile().recno();
|
||||
const TString cod(rec.get("CODTAB"));
|
||||
const int err = _rel->lfile().next();
|
||||
if (err == NOERR)
|
||||
{
|
||||
TString next(_rel->lfile().get("CODTAB")); next.cut(cod.len());
|
||||
prot = cod == next;
|
||||
}
|
||||
_rel->lfile().readat(pos);
|
||||
}
|
||||
}
|
||||
return prot;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
||||
|
||||
{
|
||||
if ((k == K_TAB || k == K_ENTER) &&
|
||||
((BA3100_application*) MainApp())->exist_journal() &&
|
||||
atoi(f.get()) == REG_JOURNAL)
|
||||
return error_box("Non e' possibile avere due registri giornale nello stesso anno");
|
||||
return TRUE;
|
||||
}
|
||||
bool BA3100_application::user_create()
|
||||
{
|
||||
_tabname.upper();
|
||||
TString m(16); m << "BATB" << _tabname;
|
||||
_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);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool BA3100_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ba3100(int argc, char* argv[])
|
||||
{
|
||||
BA3100_application a(argv[2]) ;
|
||||
a.run(argc, argv, "Tabella");
|
||||
return 0;
|
||||
}
|
||||
|
671
ba/ba3200.cpp
671
ba/ba3200.cpp
@ -1,337 +1,334 @@
|
||||
// ba3200 Stampa tabelle
|
||||
//
|
||||
// legge un file con estensione .rpt che descrive la stampa.
|
||||
// Vedi file leggimi.txt per il formato del file
|
||||
//
|
||||
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "ba3.h"
|
||||
#include "ba3200.h"
|
||||
|
||||
#define FOOTER_LEN 4 // se non ridefinito nel .rpt
|
||||
|
||||
class BA3200_application : public TPrintapp
|
||||
{
|
||||
TString _tabname;
|
||||
TFilename _rptname;
|
||||
TRelation* _rel;
|
||||
TCursor *_cur;
|
||||
TMask* _msk;
|
||||
TString _maskname;
|
||||
int _logicnum;
|
||||
TArray _string_roman;
|
||||
TArray _field_roman;
|
||||
|
||||
public:
|
||||
|
||||
virtual void user_create() ;
|
||||
virtual void user_destroy() ;
|
||||
virtual bool set_print(int) ;
|
||||
|
||||
virtual void set_page(int, int);
|
||||
virtual bool preprocess_page (int, int);
|
||||
|
||||
void leggi_rpt();
|
||||
void set_headers();
|
||||
void set_rows();
|
||||
void set_footers();
|
||||
void set_translations();
|
||||
void set_relations();
|
||||
BA3200_application(const char * tabname) : _tabname(tabname) {}
|
||||
virtual ~BA3200_application() {}
|
||||
};
|
||||
|
||||
|
||||
bool BA3200_application::set_print(int)
|
||||
{
|
||||
TRectype from(_rel->lfile()->curr()); from.zero();
|
||||
TRectype to (from);
|
||||
|
||||
if (_msk->run() == K_ENTER)
|
||||
{
|
||||
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();
|
||||
if (*val)
|
||||
{
|
||||
const TFieldref* campo_ref = campo_maschera.field();
|
||||
|
||||
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);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void BA3200_application::set_page (int , int )
|
||||
{
|
||||
_string_roman.destroy();
|
||||
_field_roman.destroy();
|
||||
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()
|
||||
{
|
||||
TString NomeTabella, sep, formato_intesta, testo_intesta;
|
||||
int LungRiga, riga_intesta=0, last_riga=1;
|
||||
TToken_string line;
|
||||
|
||||
reset_header ();
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Headers");
|
||||
|
||||
// Leggo la lunghezza della riga (usata per centrare l'intestazione)
|
||||
line = rpt.line();
|
||||
LungRiga = line.get_int();
|
||||
|
||||
// Leggo il nome della tabella
|
||||
line = rpt.line();
|
||||
NomeTabella = line.get();
|
||||
|
||||
// Centro il nome della tabella e aggiungo il numero di pagina
|
||||
NomeTabella.center_just (LungRiga);
|
||||
NomeTabella.overwrite ("Pag. @#", NomeTabella.len()-8);
|
||||
set_header (last_riga, "%s", (const char *)NomeTabella);
|
||||
last_riga++;
|
||||
|
||||
// Aggiungo una riga vuota per separare prima intestazione
|
||||
sep.fill ('-', LungRiga);
|
||||
set_header (last_riga, "%s", (const char *)sep);
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
riga_intesta = atoi (line.get());
|
||||
formato_intesta = line.get();
|
||||
testo_intesta = (const char *) line.get();
|
||||
if (riga_intesta)
|
||||
set_header (last_riga+riga_intesta, (const char *)formato_intesta,
|
||||
(const char *)testo_intesta);
|
||||
line = rpt.line();
|
||||
}
|
||||
|
||||
if (riga_intesta) last_riga += riga_intesta;
|
||||
last_riga++;
|
||||
set_header (last_riga, (const char *)sep);
|
||||
last_riga++;
|
||||
sep.fill(' ');
|
||||
set_header (last_riga, (const char *)sep);
|
||||
}
|
||||
|
||||
void BA3200_application::set_rows()
|
||||
{
|
||||
TToken_string line;
|
||||
TFieldref campo;
|
||||
int from, to, riga_record;
|
||||
TString formato_campo, picture;
|
||||
const char * name;
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Rows");
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
riga_record = line.get_int();
|
||||
|
||||
TString s(line.get());
|
||||
|
||||
campo = s;
|
||||
from = campo.from();
|
||||
to = campo.to();
|
||||
name = campo.name();
|
||||
int logicnum = campo.file() == 0 ? _logicnum : campo.file();
|
||||
|
||||
formato_campo = line.get();
|
||||
formato_campo.trim();
|
||||
formato_campo.lower();
|
||||
const int p = formato_campo.find("@m");
|
||||
|
||||
if (p != -1)
|
||||
{
|
||||
formato_campo.cut(p);
|
||||
formato_campo << "#t";
|
||||
_string_roman.add(new TString);
|
||||
_field_roman.add(s);
|
||||
const int last = _string_roman.items() - 1;
|
||||
|
||||
set_row (riga_record, formato_campo, _string_roman.objptr(last));
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void BA3200_application::set_footers()
|
||||
{
|
||||
TToken_string line;
|
||||
int footer_len, riga;
|
||||
TString formato, testo;
|
||||
|
||||
reset_footer();
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Footers");
|
||||
|
||||
line = rpt.line();
|
||||
footer_len = line.get_int();
|
||||
if (footer_len) printer().footerlen (footer_len);
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
riga = line.get_int();
|
||||
formato = line.get();
|
||||
testo = line.get();
|
||||
set_footer (riga, (const char *)formato, (const char*)testo);
|
||||
line = rpt.line();
|
||||
}
|
||||
}
|
||||
|
||||
void BA3200_application::set_translations()
|
||||
{
|
||||
TString campo, from, to;
|
||||
TToken_string line;
|
||||
int logicnum;
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Translations");
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
logicnum = line.get_int();
|
||||
campo = line.get();
|
||||
from = line.get();
|
||||
to = line.get();
|
||||
set_translation (logicnum, (char*)(const char *)campo, (char*)(const char *)from, (char*)(const char *)to);
|
||||
line = rpt.line();
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
set_rows();
|
||||
}
|
||||
|
||||
void BA3200_application::user_create()
|
||||
{
|
||||
_rptname << "batb" << _tabname << ".rpt" ;
|
||||
if (!fexist(_rptname))
|
||||
fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname);
|
||||
|
||||
|
||||
// _tab = new TTable (_tabname);
|
||||
_rel = new TRelation (_tabname);
|
||||
_cur = new TCursor (_rel);
|
||||
|
||||
_maskname << "bast" << _tabname;
|
||||
_msk = new TMask (_maskname) ;
|
||||
|
||||
add_cursor (_cur);
|
||||
add_file (_tabname);
|
||||
|
||||
_logicnum = _cur->file()->num();
|
||||
|
||||
reset_print ();
|
||||
|
||||
printer().footerlen (FOOTER_LEN);
|
||||
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
|
||||
|
||||
set_headers();
|
||||
set_footers();
|
||||
set_translations();
|
||||
set_relations();
|
||||
}
|
||||
|
||||
void BA3200_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _cur;
|
||||
delete _rel;
|
||||
// delete _tab;
|
||||
}
|
||||
|
||||
int ba3200(int argc, char* argv[])
|
||||
{
|
||||
BA3200_application a(argv[2]) ;
|
||||
a.run(argc, argv, "Stampa tabella");
|
||||
return 0;
|
||||
}
|
||||
// ba3200 Stampa tabelle
|
||||
//
|
||||
// legge un file con estensione .rpt che descrive la stampa.
|
||||
// Vedi file leggimi.txt per il formato del file
|
||||
//
|
||||
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "ba3.h"
|
||||
#include "ba3200.h"
|
||||
|
||||
#define FOOTER_LEN 4 // se non ridefinito nel .rpt
|
||||
|
||||
class BA3200_application : public TPrintapp
|
||||
{
|
||||
TString _tabname;
|
||||
TFilename _rptname;
|
||||
TRelation* _rel;
|
||||
TCursor *_cur;
|
||||
TMask* _msk;
|
||||
TString _maskname;
|
||||
int _logicnum;
|
||||
TArray _string_roman;
|
||||
TArray _field_roman;
|
||||
|
||||
public:
|
||||
|
||||
virtual void user_create() ;
|
||||
virtual void user_destroy() ;
|
||||
virtual bool set_print(int) ;
|
||||
|
||||
virtual void set_page(int, int);
|
||||
virtual bool preprocess_page (int, int);
|
||||
|
||||
void leggi_rpt();
|
||||
void set_headers();
|
||||
void set_rows();
|
||||
void set_footers();
|
||||
void set_translations();
|
||||
void set_relations();
|
||||
BA3200_application(const char * tabname) : _tabname(tabname) {}
|
||||
virtual ~BA3200_application() {}
|
||||
};
|
||||
|
||||
|
||||
bool BA3200_application::set_print(int)
|
||||
{
|
||||
TRectype from(_rel->lfile().curr()); from.zero();
|
||||
TRectype to (from);
|
||||
|
||||
if (_msk->run() == K_ENTER)
|
||||
{
|
||||
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();
|
||||
if (*val)
|
||||
{
|
||||
const TFieldref* campo_ref = campo_maschera.field();
|
||||
|
||||
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);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void BA3200_application::set_page (int , int )
|
||||
{
|
||||
_string_roman.destroy();
|
||||
_field_roman.destroy();
|
||||
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()
|
||||
{
|
||||
TString NomeTabella, sep, formato_intesta, testo_intesta;
|
||||
int LungRiga, riga_intesta=0, last_riga=1;
|
||||
TToken_string line;
|
||||
|
||||
reset_header ();
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Headers");
|
||||
|
||||
// Leggo la lunghezza della riga (usata per centrare l'intestazione)
|
||||
line = rpt.line();
|
||||
LungRiga = line.get_int();
|
||||
|
||||
// Leggo il nome della tabella
|
||||
line = rpt.line();
|
||||
NomeTabella = line.get();
|
||||
|
||||
// Centro il nome della tabella e aggiungo il numero di pagina
|
||||
NomeTabella.center_just (LungRiga);
|
||||
NomeTabella.overwrite ("Pag. @#", NomeTabella.len()-8);
|
||||
set_header (last_riga, "%s", (const char *)NomeTabella);
|
||||
last_riga++;
|
||||
|
||||
// Aggiungo una riga vuota per separare prima intestazione
|
||||
sep.fill ('-', LungRiga);
|
||||
set_header (last_riga, "%s", (const char *)sep);
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
riga_intesta = atoi (line.get());
|
||||
formato_intesta = line.get();
|
||||
testo_intesta = (const char *) line.get();
|
||||
if (riga_intesta)
|
||||
set_header (last_riga+riga_intesta, (const char *)formato_intesta,
|
||||
(const char *)testo_intesta);
|
||||
line = rpt.line();
|
||||
}
|
||||
|
||||
if (riga_intesta) last_riga += riga_intesta;
|
||||
last_riga++;
|
||||
set_header (last_riga, (const char *)sep);
|
||||
last_riga++;
|
||||
sep.fill(' ');
|
||||
set_header (last_riga, (const char *)sep);
|
||||
}
|
||||
|
||||
void BA3200_application::set_rows()
|
||||
{
|
||||
TToken_string line;
|
||||
TFieldref campo;
|
||||
int from, to, riga_record;
|
||||
TString formato_campo, picture;
|
||||
const char * name;
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Rows");
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
riga_record = line.get_int();
|
||||
|
||||
TString s(line.get());
|
||||
|
||||
campo = s;
|
||||
from = campo.from();
|
||||
to = campo.to();
|
||||
name = campo.name();
|
||||
int logicnum = campo.file() == 0 ? _logicnum : campo.file();
|
||||
|
||||
formato_campo = line.get();
|
||||
formato_campo.trim();
|
||||
formato_campo.lower();
|
||||
const int p = formato_campo.find("@m");
|
||||
|
||||
if (p != -1)
|
||||
{
|
||||
formato_campo.cut(p);
|
||||
formato_campo << "#t";
|
||||
_string_roman.add(new TString);
|
||||
_field_roman.add(s);
|
||||
const int last = _string_roman.items() - 1;
|
||||
|
||||
set_row (riga_record, formato_campo, _string_roman.objptr(last));
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void BA3200_application::set_footers()
|
||||
{
|
||||
TToken_string line;
|
||||
int footer_len, riga;
|
||||
TString formato, testo;
|
||||
|
||||
reset_footer();
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Footers");
|
||||
|
||||
line = rpt.line();
|
||||
footer_len = line.get_int();
|
||||
if (footer_len) printer().footerlen (footer_len);
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
riga = line.get_int();
|
||||
formato = line.get();
|
||||
testo = line.get();
|
||||
set_footer (riga, (const char *)formato, (const char*)testo);
|
||||
line = rpt.line();
|
||||
}
|
||||
}
|
||||
|
||||
void BA3200_application::set_translations()
|
||||
{
|
||||
TString campo, from, to;
|
||||
TToken_string line;
|
||||
int logicnum;
|
||||
|
||||
TScanner rpt(_rptname);
|
||||
rpt.paragraph("Translations");
|
||||
|
||||
line = rpt.line();
|
||||
while ( (line != "") && (line[0] != '[') )
|
||||
{
|
||||
logicnum = line.get_int();
|
||||
campo = line.get();
|
||||
from = line.get();
|
||||
to = line.get();
|
||||
set_translation (logicnum, (char*)(const char *)campo, (char*)(const char *)from, (char*)(const char *)to);
|
||||
line = rpt.line();
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
set_rows();
|
||||
}
|
||||
|
||||
void BA3200_application::user_create()
|
||||
{
|
||||
_rptname << "batb" << _tabname << ".rpt" ;
|
||||
if (!fexist(_rptname))
|
||||
fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname);
|
||||
|
||||
_rel = new TRelation (_tabname);
|
||||
_cur = new TCursor (_rel);
|
||||
|
||||
_maskname << "bast" << _tabname;
|
||||
_msk = new TMask (_maskname) ;
|
||||
|
||||
add_cursor (_cur);
|
||||
add_file (_tabname);
|
||||
|
||||
_logicnum = _cur->file().num();
|
||||
|
||||
reset_print ();
|
||||
|
||||
printer().footerlen (FOOTER_LEN);
|
||||
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
|
||||
|
||||
set_headers();
|
||||
set_footers();
|
||||
set_translations();
|
||||
set_relations();
|
||||
}
|
||||
|
||||
void BA3200_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _cur;
|
||||
delete _rel;
|
||||
}
|
||||
|
||||
int ba3200(int argc, char* argv[])
|
||||
{
|
||||
BA3200_application a(argv[2]) ;
|
||||
a.run(argc, argv, "Stampa tabella");
|
||||
return 0;
|
||||
}
|
||||
|
578
ba/ba3300.cpp
578
ba/ba3300.cpp
@ -1,289 +1,289 @@
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "ba3.h"
|
||||
#include "ba3300.h"
|
||||
|
||||
class BA3300_application : public TPrintapp
|
||||
{
|
||||
friend bool codice_handler(TMask_field& field, KEY key);
|
||||
|
||||
TMask* _msk;
|
||||
TTable* _tab; // Tabella dei registri
|
||||
TString _cod_reg, _comulc, _ragsoc, _indulc, _civulc, _capulc, _com, _prov, _cofi, _paiv, _tipoa;
|
||||
long _codice_ditta, _agg, _codanagr;
|
||||
long _num_pag, _pag_ini, _pag_fin;
|
||||
int _cod_anno;
|
||||
bool _inizia_dopo;
|
||||
TLocalisamfile* _nditte;
|
||||
TLocalisamfile* _anag;
|
||||
TLocalisamfile* _unloc;
|
||||
TLocalisamfile* _comuni;
|
||||
|
||||
public:
|
||||
|
||||
bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; }
|
||||
virtual void user_destroy();
|
||||
virtual void user_create() ;
|
||||
bool set_print(int);
|
||||
|
||||
const char* decodifica_reg ();
|
||||
|
||||
virtual void set_page (int, int);
|
||||
virtual print_action postprocess_page (int, int);
|
||||
|
||||
BA3300_application();
|
||||
};
|
||||
|
||||
print_action BA3300_application::postprocess_page(int, int counter)
|
||||
{
|
||||
if (counter == _num_pag - 1)
|
||||
{
|
||||
TString16 dep; dep.format("%04d%-3s", _cod_anno, (const char*)_cod_reg);
|
||||
_tab->curr().put("CODTAB", (const char*)dep);
|
||||
_tab->read();
|
||||
if (_tab->bad()) _tab->curr().zero();
|
||||
_agg = _tab->curr().get_long("I2");
|
||||
_agg = _agg + _num_pag;
|
||||
_tab->curr().put("I2", _agg);
|
||||
_tab->rewrite();
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
|
||||
void BA3300_application::set_page(int , int counter)
|
||||
{
|
||||
reset_print();
|
||||
|
||||
const TString80 descr(decodifica_reg());
|
||||
long contatore = _pag_ini + counter;
|
||||
|
||||
if (counter == 0)
|
||||
{
|
||||
if (!_inizia_dopo)
|
||||
{
|
||||
reset_row(8);
|
||||
set_row(8, "@65gPag.@70g%ld", contatore);
|
||||
}
|
||||
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
reset_row(3);
|
||||
reset_row(4);
|
||||
reset_row(5);
|
||||
reset_row(6);
|
||||
reset_row(7);
|
||||
|
||||
set_row (1, "@50g%-50s", (const char*) descr);
|
||||
set_row (2, "@50g%-50s", (const char*)_ragsoc);
|
||||
set_row (3, "@50g%-35s", (const char*)_indulc);
|
||||
set_row (3, "@90g%-10s", (const char*)_civulc);
|
||||
set_row (4, "@50g%5s", (const char*)_capulc);
|
||||
set_row (4, "@60g%-50s", (const char*)_com);
|
||||
set_row (4, "@115g%5s", (const char*)_prov);
|
||||
set_row (5, "@50g%16s", (const char*)_cofi);
|
||||
set_row (6, "@50g%11s", (const char*)_paiv);
|
||||
|
||||
}
|
||||
else if (counter==_num_pag-1)
|
||||
{
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
reset_row(3);
|
||||
reset_row(4);
|
||||
reset_row(5);
|
||||
reset_row(6);
|
||||
reset_row(7);
|
||||
reset_row(8);
|
||||
set_row (1, "@1gSocieta'@10g%-50s", (const char*) _ragsoc);
|
||||
set_row (1, "@62g%-29s", (const char*) _indulc);
|
||||
set_row (1, "@93g%-9s", (const char*) _civulc);
|
||||
set_row (1, "@103g%-5s", (const char*) _capulc);
|
||||
set_row (1, "@110g%-18s", (const char*) _com);
|
||||
set_row (1, "@130g%-3s", (const char*) _prov);
|
||||
set_row (2, "@1g%-50s", (const char*) descr);
|
||||
set_row (2, "@52g%16s", (const char*) _cofi);
|
||||
set_row (2, "@70g%11s", (const char*) _paiv);
|
||||
set_row (4, "@50gN. ........ DI REPERTORIO");
|
||||
set_row (5, "@50gIL PRESENTE LIBRO DELLA@75g%50s", (const char*) _ragsoc);
|
||||
set_row (6, "@50g%-35s", (const char*) _indulc);
|
||||
set_row (6, "@88g%10s", (const char*) _civulc);
|
||||
set_row (7, "@50g%5s", (const char*) _capulc);
|
||||
set_row (7, "@58g%50s", (const char*) _com);
|
||||
set_row (7, "@111g%5s", (const char*) _prov);
|
||||
set_row (8, "@120gPag.@125g%ld", contatore);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
reset_row(3);
|
||||
reset_row(4);
|
||||
reset_row(5);
|
||||
reset_row(6);
|
||||
reset_row(7);
|
||||
reset_row(8);
|
||||
set_row (1, "@1gSocieta'@10g%-50s", (const char*) _ragsoc);
|
||||
set_row (1, "@62g%-29s", (const char*) _indulc);
|
||||
// set_row (1, "@93g%-9s", (const char*) _civulc);
|
||||
// set_row (1, "@103g%-5s", (const char*) _capulc);
|
||||
set_row (1, "@110g%-18s", (const char*) _com);
|
||||
set_row (1, "@130g%-3s", (const char*) _prov);
|
||||
set_row (2, "@1g%-50s", (const char*) descr);
|
||||
set_row (2, "@52g%16s", (const char*) _cofi);
|
||||
set_row (2, "@70g%11s", (const char*) _paiv);
|
||||
set_row (3, "@85gPag.@90g%ld", contatore);
|
||||
}
|
||||
}
|
||||
|
||||
BA3300_application::BA3300_application()
|
||||
{
|
||||
}
|
||||
|
||||
bool BA3300_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
TString16 app;
|
||||
|
||||
_nditte->setkey(1);
|
||||
_codice_ditta = get_firm();
|
||||
_nditte->curr().zero();
|
||||
_nditte->curr().put(N_CODDITTA,_codice_ditta);
|
||||
_nditte->read();
|
||||
app=_nditte->curr().get(N_CODDITTA);
|
||||
_msk->set(F_CODDITTA,app);
|
||||
_ragsoc=_nditte->curr().get(N_RAGSOC);
|
||||
_tipoa =_nditte->curr().get(N_TIPOA);
|
||||
_codanagr =atol(_nditte->curr().get(N_CODANAGR));
|
||||
_msk->set(F_RAGSOC,_ragsoc);
|
||||
|
||||
_unloc->setkey(1);
|
||||
_unloc->curr().zero();
|
||||
_unloc->curr().put(N_CODDITTA,app);
|
||||
_unloc->curr().put(N_CODULC,"1");
|
||||
_unloc->read();
|
||||
_indulc=_unloc->curr().get(N_INDULC);
|
||||
_msk->set(F_INDIRIZZO,_indulc);
|
||||
_civulc=_unloc->curr().get(N_CIVULC);
|
||||
_msk->set(F_CIV,_civulc);
|
||||
_capulc=_unloc->curr().get(N_CAPULC);
|
||||
_msk->set(F_CAP,_capulc);
|
||||
_comulc=_unloc->curr().get(N_COMULC);
|
||||
_msk->set(F_CODCOM,_comulc);
|
||||
|
||||
_comuni->setkey(1);
|
||||
_comuni->curr().zero();
|
||||
_comuni->curr().put(N_CODCOM,_comulc);
|
||||
_comuni->read();
|
||||
_com=_comuni->curr().get(N_COM);
|
||||
_msk->set(F_COM,_com);
|
||||
_prov=_comuni->curr().get(N_PROV);
|
||||
_msk->set(F_PROV,_prov);
|
||||
|
||||
_anag->setkey(1);
|
||||
_anag->curr().zero();
|
||||
_anag->curr().put(N_TIPOA,_tipoa);
|
||||
_anag->curr().put(N_CODANAGR,_codanagr);
|
||||
_anag->read();
|
||||
_cofi=_anag->curr().get(N_COFI);
|
||||
_msk->set(F_COFI,_cofi);
|
||||
_paiv=_anag->curr().get(N_PAIV);
|
||||
_msk->set(F_PAIV,_paiv);
|
||||
|
||||
_msk->set(F_LUNG,66);
|
||||
|
||||
tasto = _msk->run();
|
||||
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_cod_reg = _msk->get(F_CODICE);
|
||||
_cod_anno = _msk->get_int(F_ANNO);
|
||||
_pag_ini = _msk->get_long(F_NPAGINI);
|
||||
_pag_fin = _msk->get_long(F_NPAGFI);
|
||||
_inizia_dopo = _msk->get_bool(F_PRIMO);
|
||||
_num_pag = (_pag_fin - _pag_ini) + 1;
|
||||
enable_print_menu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool codice_handler (TMask_field& field, KEY key)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{
|
||||
const TEdit_field& e = (const TEdit_field&)field;
|
||||
const TLocalisamfile* t = e.browse()->cursor()->file();
|
||||
const long num = t->get_long("I2");
|
||||
field.mask().set(F_NPAGINI, num+1);
|
||||
field.mask().set(F_NPAGFI, 0L);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const char* BA3300_application::decodifica_reg ()
|
||||
{
|
||||
TString16 dep; dep.format("%04d%-3s", _cod_anno, (const char*)_cod_reg);
|
||||
|
||||
_tab->curr().put("CODTAB", (const char*)dep);
|
||||
_tab->read();
|
||||
if (_tab->bad()) _tab->curr().zero();
|
||||
return _tab->curr().get ("S0");
|
||||
}
|
||||
|
||||
void BA3300_application::user_create()
|
||||
{
|
||||
enable_print_menu();
|
||||
|
||||
_nditte = new TLocalisamfile (LF_NDITTE);
|
||||
_unloc = new TLocalisamfile (LF_UNLOC);
|
||||
_comuni = new TLocalisamfile (LF_COMUNI);
|
||||
_anag = new TLocalisamfile (LF_ANAG);
|
||||
_tab = new TTable(TAB_REG);
|
||||
|
||||
_msk = new TMask ("ba3300a") ;
|
||||
_msk->set_handler(F_CODICE, codice_handler);
|
||||
|
||||
add_cursor (NULL);
|
||||
set_auto_ff (TRUE);
|
||||
}
|
||||
|
||||
void BA3300_application::user_destroy() // releasev e arrmask
|
||||
{
|
||||
delete _msk;
|
||||
delete _nditte;
|
||||
delete _unloc;
|
||||
delete _comuni;
|
||||
delete _anag;
|
||||
delete _tab;
|
||||
}
|
||||
|
||||
int ba3300(int argc, char* argv[])
|
||||
{
|
||||
BA3300_application a;
|
||||
a.run(argc, argv, "Stampa fogli libro bollato");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "ba3.h"
|
||||
#include "ba3300.h"
|
||||
|
||||
class BA3300_application : public TPrintapp
|
||||
{
|
||||
friend bool codice_handler(TMask_field& field, KEY key);
|
||||
|
||||
TMask* _msk;
|
||||
TTable* _tab; // Tabella dei registri
|
||||
TString _cod_reg, _comulc, _ragsoc, _indulc, _civulc, _capulc, _com, _prov, _cofi, _paiv, _tipoa;
|
||||
long _codice_ditta, _agg, _codanagr;
|
||||
long _num_pag, _pag_ini, _pag_fin;
|
||||
int _cod_anno;
|
||||
bool _inizia_dopo;
|
||||
TLocalisamfile* _nditte;
|
||||
TLocalisamfile* _anag;
|
||||
TLocalisamfile* _unloc;
|
||||
TLocalisamfile* _comuni;
|
||||
|
||||
public:
|
||||
|
||||
bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; }
|
||||
virtual void user_destroy();
|
||||
virtual void user_create() ;
|
||||
bool set_print(int);
|
||||
|
||||
const char* decodifica_reg ();
|
||||
|
||||
virtual void set_page (int, int);
|
||||
virtual print_action postprocess_page (int, int);
|
||||
|
||||
BA3300_application();
|
||||
};
|
||||
|
||||
print_action BA3300_application::postprocess_page(int, int counter)
|
||||
{
|
||||
if (counter == _num_pag - 1)
|
||||
{
|
||||
TString16 dep; dep.format("%04d%-3s", _cod_anno, (const char*)_cod_reg);
|
||||
_tab->curr().put("CODTAB", (const char*)dep);
|
||||
_tab->read();
|
||||
if (_tab->bad()) _tab->curr().zero();
|
||||
_agg = _tab->curr().get_long("I2");
|
||||
_agg = _agg + _num_pag;
|
||||
_tab->curr().put("I2", _agg);
|
||||
_tab->rewrite();
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
|
||||
void BA3300_application::set_page(int , int counter)
|
||||
{
|
||||
reset_print();
|
||||
|
||||
const TString80 descr(decodifica_reg());
|
||||
long contatore = _pag_ini + counter;
|
||||
|
||||
if (counter == 0)
|
||||
{
|
||||
if (!_inizia_dopo)
|
||||
{
|
||||
reset_row(8);
|
||||
set_row(8, "@65gPag.@70g%ld", contatore);
|
||||
}
|
||||
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
reset_row(3);
|
||||
reset_row(4);
|
||||
reset_row(5);
|
||||
reset_row(6);
|
||||
reset_row(7);
|
||||
|
||||
set_row (1, "@50g%-50s", (const char*) descr);
|
||||
set_row (2, "@50g%-50s", (const char*)_ragsoc);
|
||||
set_row (3, "@50g%-35s", (const char*)_indulc);
|
||||
set_row (3, "@90g%-10s", (const char*)_civulc);
|
||||
set_row (4, "@50g%5s", (const char*)_capulc);
|
||||
set_row (4, "@60g%-50s", (const char*)_com);
|
||||
set_row (4, "@115g%5s", (const char*)_prov);
|
||||
set_row (5, "@50g%16s", (const char*)_cofi);
|
||||
set_row (6, "@50g%11s", (const char*)_paiv);
|
||||
|
||||
}
|
||||
else if (counter==_num_pag-1)
|
||||
{
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
reset_row(3);
|
||||
reset_row(4);
|
||||
reset_row(5);
|
||||
reset_row(6);
|
||||
reset_row(7);
|
||||
reset_row(8);
|
||||
set_row (1, "@1gSocieta'@10g%-50s", (const char*) _ragsoc);
|
||||
set_row (1, "@62g%-29s", (const char*) _indulc);
|
||||
set_row (1, "@93g%-9s", (const char*) _civulc);
|
||||
set_row (1, "@103g%-5s", (const char*) _capulc);
|
||||
set_row (1, "@110g%-18s", (const char*) _com);
|
||||
set_row (1, "@130g%-3s", (const char*) _prov);
|
||||
set_row (2, "@1g%-50s", (const char*) descr);
|
||||
set_row (2, "@52g%16s", (const char*) _cofi);
|
||||
set_row (2, "@70g%11s", (const char*) _paiv);
|
||||
set_row (4, "@50gN. ........ DI REPERTORIO");
|
||||
set_row (5, "@50gIL PRESENTE LIBRO DELLA@75g%50s", (const char*) _ragsoc);
|
||||
set_row (6, "@50g%-35s", (const char*) _indulc);
|
||||
set_row (6, "@88g%10s", (const char*) _civulc);
|
||||
set_row (7, "@50g%5s", (const char*) _capulc);
|
||||
set_row (7, "@58g%50s", (const char*) _com);
|
||||
set_row (7, "@111g%5s", (const char*) _prov);
|
||||
set_row (8, "@120gPag.@125g%ld", contatore);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
reset_row(3);
|
||||
reset_row(4);
|
||||
reset_row(5);
|
||||
reset_row(6);
|
||||
reset_row(7);
|
||||
reset_row(8);
|
||||
set_row (1, "@1gSocieta'@10g%-50s", (const char*) _ragsoc);
|
||||
set_row (1, "@62g%-29s", (const char*) _indulc);
|
||||
// set_row (1, "@93g%-9s", (const char*) _civulc);
|
||||
// set_row (1, "@103g%-5s", (const char*) _capulc);
|
||||
set_row (1, "@110g%-18s", (const char*) _com);
|
||||
set_row (1, "@130g%-3s", (const char*) _prov);
|
||||
set_row (2, "@1g%-50s", (const char*) descr);
|
||||
set_row (2, "@52g%16s", (const char*) _cofi);
|
||||
set_row (2, "@70g%11s", (const char*) _paiv);
|
||||
set_row (3, "@85gPag.@90g%ld", contatore);
|
||||
}
|
||||
}
|
||||
|
||||
BA3300_application::BA3300_application()
|
||||
{
|
||||
}
|
||||
|
||||
bool BA3300_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
TString16 app;
|
||||
|
||||
_nditte->setkey(1);
|
||||
_codice_ditta = get_firm();
|
||||
_nditte->curr().zero();
|
||||
_nditte->curr().put(N_CODDITTA,_codice_ditta);
|
||||
_nditte->read();
|
||||
app=_nditte->curr().get(N_CODDITTA);
|
||||
_msk->set(F_CODDITTA,app);
|
||||
_ragsoc=_nditte->curr().get(N_RAGSOC);
|
||||
_tipoa =_nditte->curr().get(N_TIPOA);
|
||||
_codanagr =atol(_nditte->curr().get(N_CODANAGR));
|
||||
_msk->set(F_RAGSOC,_ragsoc);
|
||||
|
||||
_unloc->setkey(1);
|
||||
_unloc->curr().zero();
|
||||
_unloc->curr().put(N_CODDITTA,app);
|
||||
_unloc->curr().put(N_CODULC,"1");
|
||||
_unloc->read();
|
||||
_indulc=_unloc->curr().get(N_INDULC);
|
||||
_msk->set(F_INDIRIZZO,_indulc);
|
||||
_civulc=_unloc->curr().get(N_CIVULC);
|
||||
_msk->set(F_CIV,_civulc);
|
||||
_capulc=_unloc->curr().get(N_CAPULC);
|
||||
_msk->set(F_CAP,_capulc);
|
||||
_comulc=_unloc->curr().get(N_COMULC);
|
||||
_msk->set(F_CODCOM,_comulc);
|
||||
|
||||
_comuni->setkey(1);
|
||||
_comuni->curr().zero();
|
||||
_comuni->curr().put(N_CODCOM,_comulc);
|
||||
_comuni->read();
|
||||
_com=_comuni->curr().get(N_COM);
|
||||
_msk->set(F_COM,_com);
|
||||
_prov=_comuni->curr().get(N_PROV);
|
||||
_msk->set(F_PROV,_prov);
|
||||
|
||||
_anag->setkey(1);
|
||||
_anag->curr().zero();
|
||||
_anag->curr().put(N_TIPOA,_tipoa);
|
||||
_anag->curr().put(N_CODANAGR,_codanagr);
|
||||
_anag->read();
|
||||
_cofi=_anag->curr().get(N_COFI);
|
||||
_msk->set(F_COFI,_cofi);
|
||||
_paiv=_anag->curr().get(N_PAIV);
|
||||
_msk->set(F_PAIV,_paiv);
|
||||
|
||||
_msk->set(F_LUNG,66);
|
||||
|
||||
tasto = _msk->run();
|
||||
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_cod_reg = _msk->get(F_CODICE);
|
||||
_cod_anno = _msk->get_int(F_ANNO);
|
||||
_pag_ini = _msk->get_long(F_NPAGINI);
|
||||
_pag_fin = _msk->get_long(F_NPAGFI);
|
||||
_inizia_dopo = _msk->get_bool(F_PRIMO);
|
||||
_num_pag = (_pag_fin - _pag_ini) + 1;
|
||||
enable_print_menu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool codice_handler (TMask_field& field, KEY key)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{
|
||||
const TEdit_field& e = (const TEdit_field&)field;
|
||||
const TLocalisamfile& t = e.browse()->cursor()->file();
|
||||
const long num = t.get_long("I2");
|
||||
field.mask().set(F_NPAGINI, num+1);
|
||||
field.mask().set(F_NPAGFI, 0L);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const char* BA3300_application::decodifica_reg ()
|
||||
{
|
||||
TString16 dep; dep.format("%04d%-3s", _cod_anno, (const char*)_cod_reg);
|
||||
|
||||
_tab->curr().put("CODTAB", (const char*)dep);
|
||||
_tab->read();
|
||||
if (_tab->bad()) _tab->curr().zero();
|
||||
return _tab->curr().get ("S0");
|
||||
}
|
||||
|
||||
void BA3300_application::user_create()
|
||||
{
|
||||
enable_print_menu();
|
||||
|
||||
_nditte = new TLocalisamfile (LF_NDITTE);
|
||||
_unloc = new TLocalisamfile (LF_UNLOC);
|
||||
_comuni = new TLocalisamfile (LF_COMUNI);
|
||||
_anag = new TLocalisamfile (LF_ANAG);
|
||||
_tab = new TTable(TAB_REG);
|
||||
|
||||
_msk = new TMask ("ba3300a") ;
|
||||
_msk->set_handler(F_CODICE, codice_handler);
|
||||
|
||||
add_cursor (NULL);
|
||||
set_auto_ff (TRUE);
|
||||
}
|
||||
|
||||
void BA3300_application::user_destroy() // releasev e arrmask
|
||||
{
|
||||
delete _msk;
|
||||
delete _nditte;
|
||||
delete _unloc;
|
||||
delete _comuni;
|
||||
delete _anag;
|
||||
delete _tab;
|
||||
}
|
||||
|
||||
int ba3300(int argc, char* argv[])
|
||||
{
|
||||
BA3300_application a;
|
||||
a.run(argc, argv, "Stampa fogli libro bollato");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
113
ba/ba3500.cpp
113
ba/ba3500.cpp
@ -113,23 +113,24 @@ TMask* BA3500_application::get_mask(int mode)
|
||||
|
||||
void BA3500_application::read_tabinl(TMask& m)
|
||||
{
|
||||
long paginilib,pagfinlib,codditta,paginiut,pagfinut,annoreg;
|
||||
int mesereg;
|
||||
long paginilib,pagfinlib,codditta,paginiut,pagfinut;
|
||||
int mesereg,annoreg;
|
||||
TString codvidim,codreg;
|
||||
bool stampa_bol = FALSE;
|
||||
bool pagine_ann = FALSE;
|
||||
bool ok = FALSE;
|
||||
// TTable* tab_inl = (TTable*)_rel->lfile(TAB_INL);
|
||||
TTable* tab_inl = (TTable*)_rel->lfile(-ALIAS);
|
||||
long numrig, anno;
|
||||
TTable& tab_inl = (TTable&)_rel->lfile(-ALIAS);
|
||||
long numrig;
|
||||
int anno;
|
||||
TString codlib;
|
||||
|
||||
anno = atol(m.get(F_ANNO));
|
||||
anno = m.get_int(F_ANNO);
|
||||
codlib = m.get(F_CODLIB);
|
||||
|
||||
_rel->update();
|
||||
|
||||
_righe_gia_presenti = new TRighe_gia_presenti(tab_inl->items());
|
||||
_righe_gia_presenti = new TRighe_gia_presenti(tab_inl.items());
|
||||
_righe_gia_presenti->reset();
|
||||
|
||||
// int lognum = name2log(TAB_INL); //trasformo il nome della tab in un logicnum
|
||||
@ -138,19 +139,19 @@ void BA3500_application::read_tabinl(TMask& m)
|
||||
|
||||
while (ok)
|
||||
{
|
||||
TRecfield num (tab_inl->curr(),"CODTAB",7,12);
|
||||
TRecfield num (tab_inl.curr(),"CODTAB",7,12);
|
||||
numrig = long(num);
|
||||
annoreg = tab_inl->get_long("I0");
|
||||
mesereg = tab_inl->get_int ("I1");
|
||||
paginilib = tab_inl->get_long("I2");
|
||||
pagfinlib = tab_inl->get_long("I3");
|
||||
codditta = tab_inl->get_long("I4");
|
||||
codreg = tab_inl->get("S0");
|
||||
paginiut = tab_inl->get_long("I5");
|
||||
pagfinut = tab_inl->get_long("I6");
|
||||
codvidim = tab_inl->get("S1");
|
||||
stampa_bol = tab_inl->get_bool("B0");
|
||||
pagine_ann = tab_inl->get_bool("B1");
|
||||
annoreg = tab_inl.get_int("I0");
|
||||
mesereg = tab_inl.get_int ("I1");
|
||||
paginilib = tab_inl.get_long("I2");
|
||||
pagfinlib = tab_inl.get_long("I3");
|
||||
codditta = tab_inl.get_long("I4");
|
||||
codreg = tab_inl.get("S0");
|
||||
paginiut = tab_inl.get_long("I5");
|
||||
pagfinut = tab_inl.get_long("I6");
|
||||
codvidim = tab_inl.get("S1");
|
||||
stampa_bol = tab_inl.get_bool("B0");
|
||||
pagine_ann = tab_inl.get_bool("B1");
|
||||
|
||||
_righe_tabinl.add_riga(annoreg,mesereg,paginilib,pagfinlib,codditta,codreg,paginiut,pagfinut,codvidim,stampa_bol,pagine_ann);
|
||||
_righe_gia_presenti->set(numrig);
|
||||
@ -224,7 +225,7 @@ int BA3500_application::rewrite(const TMask& m)
|
||||
{
|
||||
long items;
|
||||
// TTable *tab_inl = (TTable*)_rel->lfile(TAB_INL);
|
||||
TTable *tab_inl = (TTable*)_rel->lfile(-ALIAS);
|
||||
TTable& tab_inl = (TTable&)_rel->lfile(-ALIAS);
|
||||
|
||||
int anno = m.get_int(F_ANNO);
|
||||
TString cod_lib = m.get(F_CODLIB);
|
||||
@ -242,25 +243,25 @@ int BA3500_application::rewrite(const TMask& m)
|
||||
long year = atol(riga.get(0));
|
||||
if (year != 0)
|
||||
{
|
||||
tab_inl->put ("CODTAB", codtab);
|
||||
tab_inl->put ("I0", year);
|
||||
tab_inl->put ("I1", riga.get());
|
||||
tab_inl->put ("I2", riga.get());
|
||||
tab_inl->put ("I3", riga.get());
|
||||
tab_inl->put ("I4", riga.get());
|
||||
tab_inl->put ("S0", riga.get());
|
||||
tab_inl->put ("I5", riga.get());
|
||||
tab_inl->put ("I6", riga.get());
|
||||
tab_inl->put ("S1", riga.get());
|
||||
tab_inl->put ("B0", riga.get());
|
||||
tab_inl->put ("B1", riga.get());
|
||||
tab_inl.put ("CODTAB", codtab);
|
||||
tab_inl.put ("I0", year);
|
||||
tab_inl.put ("I1", riga.get());
|
||||
tab_inl.put ("I2", riga.get());
|
||||
tab_inl.put ("I3", riga.get());
|
||||
tab_inl.put ("I4", riga.get());
|
||||
tab_inl.put ("S0", riga.get());
|
||||
tab_inl.put ("I5", riga.get());
|
||||
tab_inl.put ("I6", riga.get());
|
||||
tab_inl.put ("S1", riga.get());
|
||||
tab_inl.put ("B0", riga.get());
|
||||
tab_inl.put ("B1", riga.get());
|
||||
if (_righe_gia_presenti->IS_IN(i))
|
||||
{
|
||||
tab_inl->rewrite();
|
||||
tab_inl.rewrite();
|
||||
_righe_gia_presenti->togli(i);
|
||||
}
|
||||
else
|
||||
tab_inl->write();
|
||||
tab_inl.write();
|
||||
}
|
||||
}
|
||||
return _rel->rewrite();
|
||||
@ -270,7 +271,7 @@ int BA3500_application::write(const TMask& m)
|
||||
{
|
||||
long items;
|
||||
// TTable *tab_inl = (TTable*)_rel->lfile(TAB_INL);
|
||||
TTable *tab_inl = (TTable*)_rel->lfile(-ALIAS);
|
||||
TTable& tab_inl = (TTable&)_rel->lfile(-ALIAS);
|
||||
|
||||
int anno = m.get_int(F_ANNO);
|
||||
TString cod_lib = m.get(F_CODLIB);
|
||||
@ -281,7 +282,7 @@ int BA3500_application::write(const TMask& m)
|
||||
|
||||
items = cs.items();
|
||||
|
||||
tab_inl->zero();
|
||||
tab_inl.zero();
|
||||
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
@ -290,19 +291,19 @@ int BA3500_application::write(const TMask& m)
|
||||
long year = atol(riga.get(0));
|
||||
if (year != 0)
|
||||
{
|
||||
tab_inl->put ("CODTAB", codtab);
|
||||
tab_inl->put ("I0", year);
|
||||
tab_inl->put ("I1", riga.get());
|
||||
tab_inl->put ("I2", riga.get());
|
||||
tab_inl->put ("I3", riga.get());
|
||||
tab_inl->put ("I4", riga.get());
|
||||
tab_inl->put ("S0", riga.get());
|
||||
tab_inl->put ("I5", riga.get());
|
||||
tab_inl->put ("I6", riga.get());
|
||||
tab_inl->put ("S1", riga.get());
|
||||
tab_inl->put ("B0", riga.get());
|
||||
tab_inl->put ("B1", riga.get());
|
||||
tab_inl->write();
|
||||
tab_inl.put ("CODTAB", codtab);
|
||||
tab_inl.put ("I0", year);
|
||||
tab_inl.put ("I1", riga.get());
|
||||
tab_inl.put ("I2", riga.get());
|
||||
tab_inl.put ("I3", riga.get());
|
||||
tab_inl.put ("I4", riga.get());
|
||||
tab_inl.put ("S0", riga.get());
|
||||
tab_inl.put ("I5", riga.get());
|
||||
tab_inl.put ("I6", riga.get());
|
||||
tab_inl.put ("S1", riga.get());
|
||||
tab_inl.put ("B0", riga.get());
|
||||
tab_inl.put ("B1", riga.get());
|
||||
tab_inl.write();
|
||||
}
|
||||
}
|
||||
return _rel->write();
|
||||
@ -322,9 +323,9 @@ bool BA3500_application::remove()
|
||||
|
||||
int BA3500_application::cancella(long items)
|
||||
{
|
||||
TTable *tab_inl = (TTable*)_rel->lfile(-ALIAS);
|
||||
TRecfield an (_rel->lfile(-ALIAS)->curr(),"CODTAB",0,3);
|
||||
TRecfield cl (_rel->lfile(-ALIAS)->curr(),"CODTAB",4,6);
|
||||
TTable& tab_inl = (TTable&)_rel->lfile(-ALIAS);
|
||||
TRecfield an(tab_inl.curr(),"CODTAB",0,3);
|
||||
TRecfield cl(tab_inl.curr(),"CODTAB",4,6);
|
||||
long anno;
|
||||
TString codlib, dep;
|
||||
|
||||
@ -332,15 +333,15 @@ int BA3500_application::cancella(long items)
|
||||
codlib = (const char*)cl;
|
||||
for (long i = 0; i < items; i++)
|
||||
{
|
||||
tab_inl->zero();
|
||||
tab_inl.zero();
|
||||
dep = format ("%04d", anno);
|
||||
dep << format ("%-3s" , (const char*) codlib);
|
||||
dep << format ("%6d" , i);
|
||||
tab_inl->put("CODTAB", dep);
|
||||
if (tab_inl->read(_isequal, _lock) == NOERR)
|
||||
tab_inl->remove();
|
||||
tab_inl.put("CODTAB", dep);
|
||||
if (tab_inl.read(_isequal, _lock) == NOERR)
|
||||
tab_inl.remove();
|
||||
}
|
||||
return tab_inl->status();
|
||||
return tab_inl.status();
|
||||
}
|
||||
|
||||
/*********
|
||||
|
1880
ba/ba3700.cpp
1880
ba/ba3700.cpp
File diff suppressed because it is too large
Load Diff
1006
ba/ba4200.cpp
1006
ba/ba4200.cpp
File diff suppressed because it is too large
Load Diff
847
ba/ba4300.cpp
847
ba/ba4300.cpp
@ -1,424 +1,423 @@
|
||||
#include <relapp.h>
|
||||
#include <mailbox.h>
|
||||
#include <execp.h>
|
||||
#include <utility.h>
|
||||
#include <prefix.h>
|
||||
#include <tabutil.h>
|
||||
#include <files.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include "ba4.h"
|
||||
#include "ba4300.h"
|
||||
|
||||
#define FLD_UL1_CODDITTA 133
|
||||
#define FLD_UL1_CODDITTA_NDITTE_RAGSOC 100
|
||||
#define FLD_AT1_CODDITTA 102
|
||||
#define FLD_AT1_CODDITTAH 198
|
||||
#define FLD_AT1_PROGD_NDITTE_RAGSOC 105
|
||||
#define FLD_SC1_CODDITTA 143
|
||||
#define FLD_SC1_CODANAGRSOH 147
|
||||
#define FLD_SC1_CODDITTA_NDITTE_RAGSOC 144
|
||||
#define FLD_UL1_CODULC 125
|
||||
|
||||
const char* CODDITTA = "CODDITTA";
|
||||
const char* CODATTPREV = "CODATTPREV";
|
||||
const char* TIPOA = "TIPOA";
|
||||
const char* CODANAGR = "CODANAGR";
|
||||
|
||||
const char* CODATT = "CODATT";
|
||||
|
||||
const char* COMRF = "COMRF";
|
||||
const char* INDRF = "INDRF";
|
||||
const char* CIVRF = "CIVRF";
|
||||
const char* CAPRF = "CAPRF";
|
||||
const char* COMRES = "COMRES";
|
||||
const char* INDRES = "INDRES";
|
||||
const char* CIVRES = "CIVRES";
|
||||
const char* CAPRES = "CAPRES";
|
||||
|
||||
const char* CODULC = "CODULC";
|
||||
const char* COMULC = "COMULC";
|
||||
const char* INDULC = "INDULC";
|
||||
const char* CIVULC = "CIVULC";
|
||||
const char* CAPULC = "CAPULC";
|
||||
const char* COMCCIAA = "COMCCIAA";
|
||||
const char* COMTRIB = "COMTRIB";
|
||||
|
||||
#define TABATT "%ais"
|
||||
#define CODTAB "CODTAB"
|
||||
#define S0 "S0"
|
||||
#define DESCR "DESCR"
|
||||
|
||||
class BA4300_application : public TRelation_application
|
||||
{
|
||||
TMask* _msk;
|
||||
TRelation *_rel;
|
||||
TLocalisamfile* _anag;
|
||||
TLocalisamfile* _unloc;
|
||||
TLocalisamfile* _attiv;
|
||||
TLocalisamfile* _tabcom;
|
||||
|
||||
protected:
|
||||
bool user_create() ;
|
||||
bool user_destroy() ;
|
||||
virtual TMask* get_mask(int) { return _msk;}
|
||||
virtual bool changing_mask(int) { return FALSE;}
|
||||
virtual void init_query_mode(TMask& m) ;
|
||||
virtual void init_insert_mode(TMask& m) ;
|
||||
virtual void init_modify_mode(TMask& m) ;
|
||||
|
||||
bool build_firm_data(long cod, bool flagcom);
|
||||
|
||||
public:
|
||||
BA4300_application();
|
||||
virtual TRelation* get_relation() const { return _rel;}
|
||||
virtual int write(const TMask& m);
|
||||
virtual ~BA4300_application() {}
|
||||
};
|
||||
|
||||
bool ba4300_handler(TMask& m, KEY k)
|
||||
|
||||
{
|
||||
if (k != K_F5 && k != K_F6 && k != K_F7 && k != K_F8)
|
||||
return TRUE;
|
||||
if (m.mode() == MODE_MOD || m.mode() == MODE_INS)
|
||||
{
|
||||
BA4300_application* app = (BA4300_application*) MainApp();
|
||||
if (m.mode() == MODE_INS)
|
||||
{
|
||||
if (!m.check_fields()) return FALSE;
|
||||
if (app->write(m) != NOERR) return TRUE;
|
||||
m.stop_run(K_ESC);
|
||||
}
|
||||
TString appname;
|
||||
int fld = 0, fld1 = 0, fldbrowse = 0;
|
||||
|
||||
if (k == K_F5)
|
||||
{
|
||||
appname = "ba4 -3";
|
||||
fld = FLD_UL1_CODDITTA;
|
||||
fld1 = FLD_UL1_CODDITTA_NDITTE_RAGSOC;
|
||||
fldbrowse = FLD_UL1_CODULC;
|
||||
}
|
||||
if (k == K_F6)
|
||||
{
|
||||
appname = "ba4 -4";
|
||||
fld = FLD_AT1_CODDITTA;
|
||||
fld1 = FLD_AT1_PROGD_NDITTE_RAGSOC;
|
||||
fldbrowse = FLD_AT1_CODDITTAH;
|
||||
}
|
||||
if (k == K_F7)
|
||||
{
|
||||
appname = "ba4 -5";
|
||||
fld = FLD_SC1_CODDITTA;
|
||||
fld1 = FLD_SC1_CODDITTA_NDITTE_RAGSOC;
|
||||
fldbrowse = FLD_SC1_CODANAGRSOH;
|
||||
}
|
||||
if (k == K_F8) { appname = "ba3 -0 reg"; fld = 0;fldbrowse = 0;}
|
||||
if (appname.not_empty())
|
||||
{
|
||||
TString body(16);
|
||||
TLocalisamfile* d = app->get_relation()->lfile();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (k != K_F8) appname.insert("a", 3);
|
||||
#endif
|
||||
if (fldbrowse)
|
||||
body << fldbrowse << "|";
|
||||
if (fld)
|
||||
body << fld << "=" << m.get(FLD_GD1_CODDITTA) ;
|
||||
if (fld1)
|
||||
body << "|" << fld1 << "=" ;
|
||||
if (fldbrowse || fld)
|
||||
{
|
||||
TMessage msg(cmd2name(appname), MSG_FS, (const char*) body);
|
||||
|
||||
TMailbox mb;
|
||||
mb.send(msg);
|
||||
}
|
||||
d->setkey(1);
|
||||
d->zero();
|
||||
d->put("CODDITTA", m.get(FLD_GD1_CODDITTA));
|
||||
d->read(_isequal, _unlock) ;
|
||||
TExternal_app a(appname);
|
||||
long oldditta = prefhndl->get_codditta();
|
||||
if (k == K_F8) prefhndl->set_codditta(atol(m.get(FLD_GD1_CODDITTA)), TRUE);
|
||||
a.run();
|
||||
if (k == K_F8) prefhndl->set_codditta(oldditta, TRUE);
|
||||
d->read(_iscurr, _lock) ;
|
||||
m.set_focus();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool BA4300_application::build_firm_data(long codditta, bool flagcom)
|
||||
|
||||
{
|
||||
const TString ndir(firm2dir(codditta));
|
||||
const char* ntrrec = "trc.gen";
|
||||
const TFilename s1(format("%s/%s", (const char*) ndir, ntrrec));
|
||||
const char* nd = "dir.gen";
|
||||
const TFilename s2(format("%s/%s", (const char*) ndir, nd));
|
||||
|
||||
if (fexist(s1) && fexist(s2))
|
||||
return TRUE;
|
||||
if (fexist(ndir))
|
||||
{
|
||||
const bool ok = yesno_box("Direttorio %s esistente, lo ricostruisco", (const char*) ndir);
|
||||
if (!ok) return TRUE;
|
||||
}
|
||||
else
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
if (mkdir(ndir, 0777) == -1)
|
||||
#else
|
||||
if (mkdir(ndir) == -1)
|
||||
#endif
|
||||
return error_box("non posso creare il direttorio della ditta %ld (%s)",
|
||||
codditta, (const char*) ndir);
|
||||
if (!fexist(s1))
|
||||
if (!fcopy(ntrrec, s1))
|
||||
return error_box("non posso copiare il file %s della ditta %ld",
|
||||
ntrrec, codditta);
|
||||
if (!fexist(s2))
|
||||
if (!fcopy(nd, s2))
|
||||
return error_box("non posso copiare il file %s della ditta %ld",
|
||||
nd, codditta);
|
||||
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
const long old_firm = get_firm();
|
||||
TDir dir, dir1;
|
||||
TTrec rec;
|
||||
|
||||
prefhndl->set("");
|
||||
dir1.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
const long maxeod0 = dir1.eod();
|
||||
|
||||
prefhndl->set_codditta(codditta);
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
if (dir.eod() == 0)
|
||||
{
|
||||
dir1.eod() = 1L;
|
||||
dir1.put(LF_DIR, _nordir, _sysdirop);
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
}
|
||||
const long maxeod1 = dir.eod();
|
||||
|
||||
if (maxeod0 > maxeod1)
|
||||
{
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
dir.eod() = maxeod0;
|
||||
dir.put(LF_DIR, _nordir, _sysdirop);
|
||||
rec.zero();
|
||||
}
|
||||
for (int i = LF_DIR + 1; i <= maxeod0; i++)
|
||||
{
|
||||
dir.get(i, _nolock, _nordir, _sysdirop);
|
||||
if (dir.eod() == 0L && dir.eox() == 0L)
|
||||
{
|
||||
prefhndl->set("");
|
||||
dir.get(i, _nolock, _nordir, _sysdirop);
|
||||
rec.get(i);
|
||||
prefhndl->set_codditta(codditta);
|
||||
const char* name = dir.name();
|
||||
dir.flags() = 0L;
|
||||
const bool valid_file = *name && dir.len() > 0;
|
||||
const bool create_now = flagcom ? *name == '%' : *name != '%';
|
||||
if (valid_file && create_now)
|
||||
{
|
||||
dir.put(i, _nordir, _sysdirop);
|
||||
rec.put(i);
|
||||
TSystemisamfile f(i);
|
||||
|
||||
f.build(30); // cambiare
|
||||
BA4300_application* app = (BA4300_application*) MainApp();
|
||||
for (int j = 0 ; j < 99 ; j++)
|
||||
{
|
||||
if (app->has_module(j))
|
||||
{
|
||||
const TString s(format("std/f%04d%02d.txt", i, j));
|
||||
if (fexist(s)) f.load(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flagcom)
|
||||
{
|
||||
dir.len() = 0;
|
||||
rec.zero();
|
||||
}
|
||||
dir.put(i, _nordir, _sysdirop);
|
||||
rec.put(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_firm(old_firm);
|
||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BA4300_application::BA4300_application()
|
||||
{}
|
||||
|
||||
|
||||
bool BA4300_application::user_create() // initvar e arrmask
|
||||
{
|
||||
_msk = new TMask("ba4300a") ;
|
||||
_msk->set_handler(ba4300_handler);
|
||||
_rel = new TRelation(LF_NDITTE);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_unloc = new TLocalisamfile(LF_UNLOC);
|
||||
_attiv = new TLocalisamfile(LF_ATTIV);
|
||||
_tabcom = new TLocalisamfile(LF_TABCOM);
|
||||
set_search_field(FLD_GD1_CODDITTA);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool BA4300_application::user_destroy() // releasev e arrmask
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _anag;
|
||||
delete _unloc;
|
||||
delete _attiv;
|
||||
delete _tabcom;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int BA4300_application::write(const TMask& m)
|
||||
{
|
||||
_rel->zero();
|
||||
m.autosave();
|
||||
_rel->write();
|
||||
if (_rel->bad())
|
||||
return _rel->status();
|
||||
|
||||
TRectype& ditte=_rel->curr();
|
||||
|
||||
TString codditta(ditte.get(CODDITTA)) ;
|
||||
|
||||
_attiv->zero() ;
|
||||
_attiv->put(CODDITTA, (const char*) codditta) ;
|
||||
_attiv->put(CODATT, ditte.get(CODATTPREV)) ;
|
||||
|
||||
TTable* tabatt = new TTable(TABATT);
|
||||
tabatt->zero();
|
||||
tabatt->put(CODTAB, ditte.get(CODATTPREV)) ;
|
||||
tabatt->read();
|
||||
if (tabatt->good()) _attiv->put(DESCR, tabatt->curr().get(S0)) ;
|
||||
delete tabatt;
|
||||
|
||||
_attiv->write();
|
||||
|
||||
_anag->zero() ;
|
||||
_anag->put(TIPOA, ditte.get(TIPOA));
|
||||
_anag->put(CODANAGR, ditte.get(CODANAGR));
|
||||
_anag->read();
|
||||
if (_anag->good())
|
||||
{
|
||||
_unloc->zero() ;
|
||||
_unloc->put(CODDITTA, (const char*) codditta) ;
|
||||
_unloc->put(CODULC, (int) 1) ;
|
||||
TString s(_anag->get(COMRF));
|
||||
if (s.empty())
|
||||
{
|
||||
_unloc->put(COMULC, _anag->get(COMRES));
|
||||
_unloc->put(INDULC, _anag->get(INDRES));
|
||||
_unloc->put(CIVULC, _anag->get(CIVRES));
|
||||
_unloc->put(CAPULC, _anag->get(CAPRES));
|
||||
_unloc->put(COMCCIAA, _anag->get(COMRES));
|
||||
_unloc->put(COMTRIB, _anag->get(COMRES));
|
||||
}
|
||||
else
|
||||
{
|
||||
_unloc->put(COMULC, (const char*) s);
|
||||
_unloc->put(INDULC, _anag->get(INDRF));
|
||||
_unloc->put(CIVULC, _anag->get(CIVRF));
|
||||
_unloc->put(CAPULC, _anag->get(CAPRF));
|
||||
_unloc->put(COMCCIAA, (const char*) s);
|
||||
_unloc->put(COMTRIB, (const char*) s);
|
||||
}
|
||||
_unloc->write();
|
||||
}
|
||||
build_firm_data(atol(codditta), FALSE);
|
||||
return NOERR;
|
||||
}
|
||||
|
||||
|
||||
void BA4300_application::init_query_mode(TMask& m)
|
||||
{
|
||||
if (filtered())
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
m.hide(FLD_GD1_CODDITTA);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTA);
|
||||
m.hide(FLD_GD1_CODDITTAH);
|
||||
}
|
||||
init_insert_mode(m);
|
||||
}
|
||||
|
||||
void BA4300_application::init_insert_mode(TMask& m)
|
||||
{
|
||||
if (!filtered())
|
||||
{
|
||||
m.enable(FLD_GD1_TIPOA);
|
||||
m.enable(FLD_GD1_CODANAGR);
|
||||
m.enable(FLD_GD1_CODANAGR_ANAGR_RAGSOC);
|
||||
m.show(FLD_GD1_CODDITTA);
|
||||
m.hide(FLD_GD1_CODDITTAH);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
m.hide(FLD_GD1_CODDITTA);
|
||||
}
|
||||
m.disable(DLG_ATT);
|
||||
m.disable(DLG_ULC);
|
||||
m.disable(DLG_SOC);
|
||||
m.disable(DLG_REG);
|
||||
}
|
||||
|
||||
void BA4300_application::init_modify_mode(TMask& m)
|
||||
{
|
||||
m.disable(FLD_GD1_TIPOA);
|
||||
m.disable(FLD_GD1_CODANAGR);
|
||||
m.disable(FLD_GD1_CODANAGR_ANAGR_RAGSOC);
|
||||
if (filtered())
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
m.hide(FLD_GD1_CODDITTA);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTA);
|
||||
m.hide(FLD_GD1_CODDITTAH);
|
||||
}
|
||||
m.enable(DLG_ATT);
|
||||
m.enable(DLG_ULC);
|
||||
m.enable(DLG_SOC);
|
||||
m.enable(DLG_REG);
|
||||
}
|
||||
|
||||
int ba4300(int argc, char* argv[])
|
||||
{
|
||||
|
||||
BA4300_application a ;
|
||||
a.run(argc, argv, "Anagrafica Ditta");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <relapp.h>
|
||||
#include <mailbox.h>
|
||||
#include <execp.h>
|
||||
#include <utility.h>
|
||||
#include <prefix.h>
|
||||
#include <tabutil.h>
|
||||
#include <files.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include "ba4.h"
|
||||
#include "ba4300.h"
|
||||
|
||||
#define FLD_UL1_CODDITTA 133
|
||||
#define FLD_UL1_CODDITTA_NDITTE_RAGSOC 100
|
||||
#define FLD_AT1_CODDITTA 102
|
||||
#define FLD_AT1_CODDITTAH 198
|
||||
#define FLD_AT1_PROGD_NDITTE_RAGSOC 105
|
||||
#define FLD_SC1_CODDITTA 143
|
||||
#define FLD_SC1_CODANAGRSOH 147
|
||||
#define FLD_SC1_CODDITTA_NDITTE_RAGSOC 144
|
||||
#define FLD_UL1_CODULC 125
|
||||
|
||||
const char* CODDITTA = "CODDITTA";
|
||||
const char* CODATTPREV = "CODATTPREV";
|
||||
const char* TIPOA = "TIPOA";
|
||||
const char* CODANAGR = "CODANAGR";
|
||||
|
||||
const char* CODATT = "CODATT";
|
||||
|
||||
const char* COMRF = "COMRF";
|
||||
const char* INDRF = "INDRF";
|
||||
const char* CIVRF = "CIVRF";
|
||||
const char* CAPRF = "CAPRF";
|
||||
const char* COMRES = "COMRES";
|
||||
const char* INDRES = "INDRES";
|
||||
const char* CIVRES = "CIVRES";
|
||||
const char* CAPRES = "CAPRES";
|
||||
|
||||
const char* CODULC = "CODULC";
|
||||
const char* COMULC = "COMULC";
|
||||
const char* INDULC = "INDULC";
|
||||
const char* CIVULC = "CIVULC";
|
||||
const char* CAPULC = "CAPULC";
|
||||
const char* COMCCIAA = "COMCCIAA";
|
||||
const char* COMTRIB = "COMTRIB";
|
||||
|
||||
#define TABATT "%ais"
|
||||
#define CODTAB "CODTAB"
|
||||
#define S0 "S0"
|
||||
#define DESCR "DESCR"
|
||||
|
||||
class BA4300_application : public TRelation_application
|
||||
{
|
||||
TMask* _msk;
|
||||
TRelation *_rel;
|
||||
TLocalisamfile* _anag;
|
||||
TLocalisamfile* _unloc;
|
||||
TLocalisamfile* _attiv;
|
||||
TLocalisamfile* _tabcom;
|
||||
|
||||
protected:
|
||||
bool user_create() ;
|
||||
bool user_destroy() ;
|
||||
virtual TMask* get_mask(int) { return _msk;}
|
||||
virtual bool changing_mask(int) { return FALSE;}
|
||||
virtual void init_query_mode(TMask& m) ;
|
||||
virtual void init_insert_mode(TMask& m) ;
|
||||
virtual void init_modify_mode(TMask& m) ;
|
||||
|
||||
bool build_firm_data(long cod, bool flagcom);
|
||||
|
||||
public:
|
||||
BA4300_application();
|
||||
virtual TRelation* get_relation() const { return _rel;}
|
||||
virtual int write(const TMask& m);
|
||||
virtual ~BA4300_application() {}
|
||||
};
|
||||
|
||||
bool ba4300_handler(TMask& m, KEY k)
|
||||
|
||||
{
|
||||
if (k != K_F5 && k != K_F6 && k != K_F7 && k != K_F8)
|
||||
return TRUE;
|
||||
if (m.mode() == MODE_MOD || m.mode() == MODE_INS)
|
||||
{
|
||||
BA4300_application& app = (BA4300_application&)main_app();
|
||||
if (m.mode() == MODE_INS)
|
||||
{
|
||||
if (!m.check_fields()) return FALSE;
|
||||
if (app.write(m) != NOERR) return TRUE;
|
||||
m.stop_run(K_ESC);
|
||||
}
|
||||
TString appname;
|
||||
int fld = 0, fld1 = 0, fldbrowse = 0;
|
||||
|
||||
if (k == K_F5)
|
||||
{
|
||||
appname = "ba4 -3";
|
||||
fld = FLD_UL1_CODDITTA;
|
||||
fld1 = FLD_UL1_CODDITTA_NDITTE_RAGSOC;
|
||||
fldbrowse = FLD_UL1_CODULC;
|
||||
}
|
||||
if (k == K_F6)
|
||||
{
|
||||
appname = "ba4 -4";
|
||||
fld = FLD_AT1_CODDITTA;
|
||||
fld1 = FLD_AT1_PROGD_NDITTE_RAGSOC;
|
||||
fldbrowse = FLD_AT1_CODDITTAH;
|
||||
}
|
||||
if (k == K_F7)
|
||||
{
|
||||
appname = "ba4 -5";
|
||||
fld = FLD_SC1_CODDITTA;
|
||||
fld1 = FLD_SC1_CODDITTA_NDITTE_RAGSOC;
|
||||
fldbrowse = FLD_SC1_CODANAGRSOH;
|
||||
}
|
||||
if (k == K_F8) { appname = "ba3 -0 reg"; fld = 0;fldbrowse = 0;}
|
||||
if (appname.not_empty())
|
||||
{
|
||||
TString body(16);
|
||||
TLocalisamfile& d = app.get_relation()->lfile();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (k != K_F8) appname.insert("a", 3);
|
||||
#endif
|
||||
if (fldbrowse)
|
||||
body << fldbrowse << "|";
|
||||
if (fld)
|
||||
body << fld << "=" << m.get(FLD_GD1_CODDITTA) ;
|
||||
if (fld1)
|
||||
body << "|" << fld1 << "=" ;
|
||||
if (fldbrowse || fld)
|
||||
{
|
||||
TMessage msg(cmd2name(appname), MSG_FS, (const char*) body);
|
||||
|
||||
TMailbox mb;
|
||||
mb.send(msg);
|
||||
}
|
||||
d.setkey(1);
|
||||
d.zero();
|
||||
d.put("CODDITTA", m.get(FLD_GD1_CODDITTA));
|
||||
d.read(_isequal, _unlock) ;
|
||||
TExternal_app a(appname);
|
||||
const long oldditta = main_app().get_firm();
|
||||
if (k == K_F8) main_app().set_firm(m.get_long(FLD_GD1_CODDITTA));
|
||||
a.run();
|
||||
if (k == K_F8) main_app().set_firm(oldditta);
|
||||
d.read(_iscurr, _lock) ;
|
||||
m.set_focus();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool BA4300_application::build_firm_data(long codditta, bool flagcom)
|
||||
|
||||
{
|
||||
const TString ndir(firm2dir(codditta));
|
||||
const char* ntrrec = "trc.gen";
|
||||
const TFilename s1(format("%s/%s", (const char*) ndir, ntrrec));
|
||||
const char* nd = "dir.gen";
|
||||
const TFilename s2(format("%s/%s", (const char*) ndir, nd));
|
||||
|
||||
if (fexist(s1) && fexist(s2))
|
||||
return TRUE;
|
||||
if (fexist(ndir))
|
||||
{
|
||||
const bool ok = yesno_box("Direttorio %s esistente, lo ricostruisco", (const char*) ndir);
|
||||
if (!ok) return TRUE;
|
||||
}
|
||||
else
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
if (mkdir(ndir, 0777) == -1)
|
||||
#else
|
||||
if (mkdir(ndir) == -1)
|
||||
#endif
|
||||
return error_box("Impossibile creare il direttorio della ditta %ld (%s)",
|
||||
codditta, (const char*) ndir);
|
||||
if (!fexist(s1))
|
||||
if (!fcopy(ntrrec, s1))
|
||||
return error_box("Impossibile copiare il file %s della ditta %ld",
|
||||
ntrrec, codditta);
|
||||
if (!fexist(s2))
|
||||
if (!fcopy(nd, s2))
|
||||
return error_box("Impossibile copiare il file %s della ditta %ld",
|
||||
nd, codditta);
|
||||
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
const long old_firm = get_firm();
|
||||
TDir dir, dir1;
|
||||
TTrec rec;
|
||||
|
||||
prefhndl->set("");
|
||||
dir1.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
const long maxeod0 = dir1.eod();
|
||||
|
||||
prefhndl->set_codditta(codditta);
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
if (dir.eod() == 0)
|
||||
{
|
||||
dir1.eod() = 1L;
|
||||
dir1.put(LF_DIR, _nordir, _sysdirop);
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
}
|
||||
const long maxeod1 = dir.eod();
|
||||
|
||||
if (maxeod0 > maxeod1)
|
||||
{
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
dir.eod() = maxeod0;
|
||||
dir.put(LF_DIR, _nordir, _sysdirop);
|
||||
rec.zero();
|
||||
}
|
||||
for (int i = LF_DIR + 1; i <= maxeod0; i++)
|
||||
{
|
||||
dir.get(i, _nolock, _nordir, _sysdirop);
|
||||
if (dir.eod() == 0L && dir.eox() == 0L)
|
||||
{
|
||||
prefhndl->set("");
|
||||
dir.get(i, _nolock, _nordir, _sysdirop);
|
||||
rec.get(i);
|
||||
prefhndl->set_codditta(codditta);
|
||||
const char* name = dir.name();
|
||||
dir.flags() = 0L;
|
||||
const bool valid_file = *name && dir.len() > 0;
|
||||
const bool create_now = flagcom ? *name == '%' : *name != '%';
|
||||
if (valid_file && create_now)
|
||||
{
|
||||
dir.put(i, _nordir, _sysdirop);
|
||||
rec.put(i);
|
||||
TSystemisamfile f(i);
|
||||
|
||||
f.build(30); // cambiare
|
||||
BA4300_application& app = (BA4300_application&) main_app();
|
||||
for (int j = 0 ; j < 99 ; j++)
|
||||
{
|
||||
if (app.has_module(j))
|
||||
{
|
||||
const TString s(format("std/f%04d%02d.txt", i, j));
|
||||
if (fexist(s)) f.load(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flagcom)
|
||||
{
|
||||
dir.len() = 0;
|
||||
rec.zero();
|
||||
}
|
||||
dir.put(i, _nordir, _sysdirop);
|
||||
rec.put(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_firm(old_firm);
|
||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BA4300_application::BA4300_application()
|
||||
{}
|
||||
|
||||
|
||||
bool BA4300_application::user_create() // initvar e arrmask
|
||||
{
|
||||
_msk = new TMask("ba4300a") ;
|
||||
_msk->set_handler(ba4300_handler);
|
||||
_rel = new TRelation(LF_NDITTE);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_unloc = new TLocalisamfile(LF_UNLOC);
|
||||
_attiv = new TLocalisamfile(LF_ATTIV);
|
||||
_tabcom = new TLocalisamfile(LF_TABCOM);
|
||||
set_search_field(FLD_GD1_CODDITTA);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool BA4300_application::user_destroy() // releasev e arrmask
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _anag;
|
||||
delete _unloc;
|
||||
delete _attiv;
|
||||
delete _tabcom;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int BA4300_application::write(const TMask& m)
|
||||
{
|
||||
_rel->zero();
|
||||
m.autosave();
|
||||
_rel->write();
|
||||
if (_rel->bad())
|
||||
return _rel->status();
|
||||
|
||||
TRectype& ditte=_rel->curr();
|
||||
|
||||
TString codditta(ditte.get(CODDITTA)) ;
|
||||
|
||||
_attiv->zero() ;
|
||||
_attiv->put(CODDITTA, (const char*) codditta) ;
|
||||
_attiv->put(CODATT, ditte.get(CODATTPREV)) ;
|
||||
|
||||
TTable* tabatt = new TTable(TABATT);
|
||||
tabatt->zero();
|
||||
tabatt->put(CODTAB, ditte.get(CODATTPREV)) ;
|
||||
tabatt->read();
|
||||
if (tabatt->good()) _attiv->put(DESCR, tabatt->curr().get(S0)) ;
|
||||
delete tabatt;
|
||||
|
||||
_attiv->write();
|
||||
|
||||
_anag->zero() ;
|
||||
_anag->put(TIPOA, ditte.get(TIPOA));
|
||||
_anag->put(CODANAGR, ditte.get(CODANAGR));
|
||||
_anag->read();
|
||||
if (_anag->good())
|
||||
{
|
||||
_unloc->zero() ;
|
||||
_unloc->put(CODDITTA, (const char*) codditta) ;
|
||||
_unloc->put(CODULC, (int) 1) ;
|
||||
TString s(_anag->get(COMRF));
|
||||
if (s.empty())
|
||||
{
|
||||
_unloc->put(COMULC, _anag->get(COMRES));
|
||||
_unloc->put(INDULC, _anag->get(INDRES));
|
||||
_unloc->put(CIVULC, _anag->get(CIVRES));
|
||||
_unloc->put(CAPULC, _anag->get(CAPRES));
|
||||
_unloc->put(COMCCIAA, _anag->get(COMRES));
|
||||
_unloc->put(COMTRIB, _anag->get(COMRES));
|
||||
}
|
||||
else
|
||||
{
|
||||
_unloc->put(COMULC, (const char*) s);
|
||||
_unloc->put(INDULC, _anag->get(INDRF));
|
||||
_unloc->put(CIVULC, _anag->get(CIVRF));
|
||||
_unloc->put(CAPULC, _anag->get(CAPRF));
|
||||
_unloc->put(COMCCIAA, (const char*) s);
|
||||
_unloc->put(COMTRIB, (const char*) s);
|
||||
}
|
||||
_unloc->write();
|
||||
}
|
||||
build_firm_data(atol(codditta), FALSE);
|
||||
return NOERR;
|
||||
}
|
||||
|
||||
|
||||
void BA4300_application::init_query_mode(TMask& m)
|
||||
{
|
||||
if (filtered())
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
m.hide(FLD_GD1_CODDITTA);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTA);
|
||||
m.hide(FLD_GD1_CODDITTAH);
|
||||
}
|
||||
init_insert_mode(m);
|
||||
}
|
||||
|
||||
void BA4300_application::init_insert_mode(TMask& m)
|
||||
{
|
||||
if (!filtered())
|
||||
{
|
||||
m.enable(FLD_GD1_TIPOA);
|
||||
m.enable(FLD_GD1_CODANAGR);
|
||||
m.enable(FLD_GD1_CODANAGR_ANAGR_RAGSOC);
|
||||
m.show(FLD_GD1_CODDITTA);
|
||||
m.hide(FLD_GD1_CODDITTAH);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
m.hide(FLD_GD1_CODDITTA);
|
||||
}
|
||||
m.disable(DLG_ATT);
|
||||
m.disable(DLG_ULC);
|
||||
m.disable(DLG_SOC);
|
||||
m.disable(DLG_REG);
|
||||
}
|
||||
|
||||
void BA4300_application::init_modify_mode(TMask& m)
|
||||
{
|
||||
m.disable(FLD_GD1_TIPOA);
|
||||
m.disable(FLD_GD1_CODANAGR);
|
||||
m.disable(FLD_GD1_CODANAGR_ANAGR_RAGSOC);
|
||||
if (filtered())
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
m.hide(FLD_GD1_CODDITTA);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTA);
|
||||
m.hide(FLD_GD1_CODDITTAH);
|
||||
}
|
||||
m.enable(DLG_ATT);
|
||||
m.enable(DLG_ULC);
|
||||
m.enable(DLG_SOC);
|
||||
m.enable(DLG_REG);
|
||||
}
|
||||
|
||||
int ba4300(int argc, char* argv[])
|
||||
{
|
||||
BA4300_application a ;
|
||||
a.run(argc, argv, "Anagrafica Ditte");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
1131
ba/ba6100.cpp
1131
ba/ba6100.cpp
File diff suppressed because it is too large
Load Diff
1700
ba/ba6101.cpp
1700
ba/ba6101.cpp
File diff suppressed because it is too large
Load Diff
571
ba/ba6200.cpp
571
ba/ba6200.cpp
@ -1,286 +1,285 @@
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <sort.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
#include <comuni.h>
|
||||
|
||||
#include "ba6.h"
|
||||
#include "ba6200.h"
|
||||
|
||||
const MAXSTR = 128;
|
||||
static char __tmp [MAXSTR];
|
||||
static TFixed_string tmp (__tmp, MAXSTR);
|
||||
|
||||
class BA6200_application : public TPrintapp
|
||||
{
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TLocalisamfile* _comuni;
|
||||
TParagraph_string * _descr_comune;
|
||||
|
||||
int _cur1, _cur2;
|
||||
TString _provcom_msk, _com, _dencom, _provcom, _capcom;
|
||||
TString _codistat;
|
||||
int _uffiidd1, _uffiidd2, _uffiidd3, _uffiva1, _uffiva2, _uffiva3;
|
||||
int _uffreg, _uffconc, _uffcserv, _uffesprov, _uffescom, _terrmon;
|
||||
real _alqici;
|
||||
TDate _data_stampa;
|
||||
|
||||
protected:
|
||||
virtual void user_create() ;
|
||||
virtual void user_destroy();
|
||||
virtual bool set_print(int m);
|
||||
|
||||
virtual bool preprocess_page (int,int);
|
||||
|
||||
public:
|
||||
void crea_intestazione();
|
||||
void setta_righe_descr(TParagraph_string*);
|
||||
|
||||
BA6200_application();
|
||||
};
|
||||
|
||||
bool BA6200_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
|
||||
reset_print();
|
||||
|
||||
if (counter)
|
||||
return TRUE;
|
||||
|
||||
if (file == LF_COMUNI)
|
||||
{
|
||||
_provcom = current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
|
||||
|
||||
if ((_provcom == _provcom_msk) || (_provcom_msk == ""))
|
||||
{
|
||||
_com = current_cursor()->curr(LF_COMUNI).get(COM_COM);
|
||||
_dencom = current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
|
||||
*_descr_comune = (const char*) _dencom;
|
||||
_capcom = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM);
|
||||
_codistat = current_cursor()->curr(LF_COMUNI).get(COM_CODISTAT);
|
||||
_uffiidd1 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIIDD1);
|
||||
_uffiidd2 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIIDD2);
|
||||
_uffiidd3 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIIDD3);
|
||||
_uffiva1 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIVA1);
|
||||
_uffiva2 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIVA2);
|
||||
_uffiva3 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIVA3);
|
||||
_uffreg = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFREG);
|
||||
_uffconc = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFCONC);
|
||||
_uffcserv = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFCSERV);
|
||||
_uffesprov = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFESPROV);
|
||||
_uffescom = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFESCOM);
|
||||
_alqici = current_cursor()->curr(LF_COMUNI).get_real(COM_ALIQICI);
|
||||
_terrmon = current_cursor()->curr(LF_COMUNI).get_int(COM_TERRMON);
|
||||
|
||||
setta_righe_descr(_descr_comune);
|
||||
|
||||
set_row (1,"@0g%4s", (const char*) _com);
|
||||
set_row (1,"@33g%5s", (const char*) _provcom);
|
||||
set_row (1,"@39g%5s", (const char*) _capcom);
|
||||
set_row (1,"@46g%6s", (const char*) _codistat);
|
||||
set_row (1,"@54g%r", &_alqici);
|
||||
|
||||
if (_terrmon != 0)
|
||||
set_row (1,"@63g%d", _terrmon);
|
||||
|
||||
if (_uffiidd1 != 0)
|
||||
set_row (1,"@72g%03d", _uffiidd1);
|
||||
|
||||
if (_uffiidd2 != 0)
|
||||
set_row (1,"@76g%03d", _uffiidd2);
|
||||
|
||||
if (_uffiidd3 != 0)
|
||||
set_row (1,"@80g%03d", _uffiidd3);
|
||||
|
||||
if (_uffiva1 != 0)
|
||||
set_row (1,"@85g%03d", _uffiva1);
|
||||
|
||||
if (_uffiva2 != 0)
|
||||
set_row (1,"@89g%03d", _uffiva2);
|
||||
|
||||
if (_uffiva3 != 0)
|
||||
set_row (1,"@93g%03d", _uffiva3);
|
||||
|
||||
if (_uffreg != 0)
|
||||
set_row (1,"@98g%03d", _uffreg);
|
||||
|
||||
if (_uffconc != 0)
|
||||
set_row (1,"@104g%03d", _uffconc);
|
||||
|
||||
if (_uffcserv != 0)
|
||||
set_row (1,"@110g%03d", _uffcserv);
|
||||
|
||||
if (_uffesprov != 0)
|
||||
set_row (1,"@115g%03d", _uffesprov);
|
||||
|
||||
if (_uffescom != 0)
|
||||
set_row (1,"@119g%03d", _uffescom);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void BA6200_application::setta_righe_descr(TParagraph_string* str)
|
||||
{
|
||||
const char* r;
|
||||
int i = 1;
|
||||
|
||||
while ((r = str->get()) != NULL)
|
||||
{
|
||||
set_row (i,"@7g%s", r);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
BA6200_application::BA6200_application()
|
||||
{
|
||||
}
|
||||
|
||||
bool BA6200_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
TLocalisamfile* fl;
|
||||
TString statoini,statofine,codiceini,codicefine,denomini,denomfine;
|
||||
|
||||
tasto = _msk->run();
|
||||
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_data_stampa = _msk->get (F_DATA);
|
||||
int scelta = _msk->get_int (F_SCELTA);
|
||||
_provcom_msk = _msk->get (F_PROVCOM);
|
||||
|
||||
if (scelta == 1)
|
||||
{
|
||||
statoini = _msk->get(F_STATOINI);
|
||||
codiceini = _msk->get(F_CODICEINI);
|
||||
statofine = _msk->get(F_STATOFINE);
|
||||
codicefine = _msk->get(F_CODICEFINE);
|
||||
|
||||
reset_files(); //resetta l'albero di stampa
|
||||
add_file(LF_COMUNI);
|
||||
|
||||
select_cursor(_cur1);
|
||||
fl = current_cursor()->file(LF_COMUNI);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
|
||||
da.put(COM_STATO,statoini);
|
||||
da.put(COM_COM ,codiceini);
|
||||
|
||||
a.put(COM_STATO,statofine);
|
||||
a.put(COM_COM ,codicefine);
|
||||
|
||||
current_cursor()->setregion(da, a);
|
||||
}
|
||||
else
|
||||
if (scelta == 2)
|
||||
{
|
||||
denomini = _msk->get(F_NOMEINI);
|
||||
denomfine = _msk->get(F_NOMEFINE);
|
||||
|
||||
select_cursor(_cur2);
|
||||
|
||||
reset_files();
|
||||
add_file(LF_COMUNI);
|
||||
|
||||
fl = current_cursor()->file(LF_COMUNI);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
|
||||
da.put(COM_DENCOM, denomini);
|
||||
|
||||
a.put (COM_DENCOM, denomfine);
|
||||
|
||||
current_cursor()->setregion(da, a);
|
||||
}
|
||||
|
||||
//set_print_zero();
|
||||
crea_intestazione();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void BA6200_application::crea_intestazione()
|
||||
{
|
||||
TString sep(132);
|
||||
TString data_stampa;
|
||||
|
||||
reset_header();
|
||||
|
||||
sep.fill('-');
|
||||
set_header (1, (const char *) sep);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
sep.right_just(132);
|
||||
set_header (2,(const char*) sep);
|
||||
|
||||
set_header (2,"@0gARCHIVIO COMUNI@91gSTUDIO@104gDATA");
|
||||
data_stampa = _data_stampa.string();
|
||||
set_header (2,"@109g%10s", (const char*) data_stampa);
|
||||
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header (3, (const char *) sep);
|
||||
|
||||
set_header(5,"@0gCodice@7gDenominazione@33gProv.@40gCap@45gCd.Istat@54gAl.ICI@61gMont.@67gUff.@74gII.DD.@87gI.V.A.@97gRegi.@103gConc.@109gServ.@115gEsatt.");
|
||||
set_header (6,"@0g------@7g-------------------------@33g-----@39g-----");
|
||||
set_header (6,"@45g--------@54g------@61g-----@72g-----------");
|
||||
set_header (6,"@85g------------@97g-----@103g-----@109g-----@115g-------");
|
||||
}
|
||||
|
||||
void BA6200_application::user_create()
|
||||
{
|
||||
_rel = new TRelation (LF_COMUNI);
|
||||
|
||||
_cur1 = add_cursor(new TCursor(_rel,"",1));
|
||||
|
||||
_cur2 = add_cursor(new TCursor(_rel,"",2));
|
||||
|
||||
_comuni = new TLocalisamfile (LF_COMUNI);
|
||||
|
||||
_descr_comune = new TParagraph_string ("",25);
|
||||
|
||||
_msk = new TMask("ba6200a");
|
||||
}
|
||||
|
||||
void BA6200_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _comuni;
|
||||
delete _descr_comune;
|
||||
}
|
||||
|
||||
int ba6200(int argc, char* argv[])
|
||||
{
|
||||
|
||||
BA6200_application a;
|
||||
|
||||
a.run(argc, argv, "Stampa Comuni");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <sort.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
#include <comuni.h>
|
||||
|
||||
#include "ba6.h"
|
||||
#include "ba6200.h"
|
||||
|
||||
const MAXSTR = 128;
|
||||
static char __tmp [MAXSTR];
|
||||
static TFixed_string tmp (__tmp, MAXSTR);
|
||||
|
||||
class BA6200_application : public TPrintapp
|
||||
{
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TLocalisamfile* _comuni;
|
||||
TParagraph_string * _descr_comune;
|
||||
|
||||
int _cur1, _cur2;
|
||||
TString _provcom_msk, _com, _dencom, _provcom, _capcom;
|
||||
TString _codistat;
|
||||
int _uffiidd1, _uffiidd2, _uffiidd3, _uffiva1, _uffiva2, _uffiva3;
|
||||
int _uffreg, _uffconc, _uffcserv, _uffesprov, _uffescom, _terrmon;
|
||||
real _alqici;
|
||||
TDate _data_stampa;
|
||||
|
||||
protected:
|
||||
virtual void user_create() ;
|
||||
virtual void user_destroy();
|
||||
virtual bool set_print(int m);
|
||||
|
||||
virtual bool preprocess_page (int,int);
|
||||
|
||||
public:
|
||||
void crea_intestazione();
|
||||
void setta_righe_descr(TParagraph_string*);
|
||||
|
||||
BA6200_application();
|
||||
};
|
||||
|
||||
bool BA6200_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
|
||||
reset_print();
|
||||
|
||||
if (counter)
|
||||
return TRUE;
|
||||
|
||||
if (file == LF_COMUNI)
|
||||
{
|
||||
_provcom = current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
|
||||
|
||||
if ((_provcom == _provcom_msk) || (_provcom_msk == ""))
|
||||
{
|
||||
_com = current_cursor()->curr(LF_COMUNI).get(COM_COM);
|
||||
_dencom = current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
|
||||
*_descr_comune = (const char*) _dencom;
|
||||
_capcom = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM);
|
||||
_codistat = current_cursor()->curr(LF_COMUNI).get(COM_CODISTAT);
|
||||
_uffiidd1 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIIDD1);
|
||||
_uffiidd2 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIIDD2);
|
||||
_uffiidd3 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIIDD3);
|
||||
_uffiva1 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIVA1);
|
||||
_uffiva2 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIVA2);
|
||||
_uffiva3 = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFIVA3);
|
||||
_uffreg = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFREG);
|
||||
_uffconc = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFCONC);
|
||||
_uffcserv = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFCSERV);
|
||||
_uffesprov = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFESPROV);
|
||||
_uffescom = current_cursor()->curr(LF_COMUNI).get_int(COM_UFFESCOM);
|
||||
_alqici = current_cursor()->curr(LF_COMUNI).get_real(COM_ALIQICI);
|
||||
_terrmon = current_cursor()->curr(LF_COMUNI).get_int(COM_TERRMON);
|
||||
|
||||
setta_righe_descr(_descr_comune);
|
||||
|
||||
set_row (1,"@0g%4s", (const char*) _com);
|
||||
set_row (1,"@33g%5s", (const char*) _provcom);
|
||||
set_row (1,"@39g%5s", (const char*) _capcom);
|
||||
set_row (1,"@46g%6s", (const char*) _codistat);
|
||||
set_row (1,"@54g%r", &_alqici);
|
||||
|
||||
if (_terrmon != 0)
|
||||
set_row (1,"@63g%d", _terrmon);
|
||||
|
||||
if (_uffiidd1 != 0)
|
||||
set_row (1,"@72g%03d", _uffiidd1);
|
||||
|
||||
if (_uffiidd2 != 0)
|
||||
set_row (1,"@76g%03d", _uffiidd2);
|
||||
|
||||
if (_uffiidd3 != 0)
|
||||
set_row (1,"@80g%03d", _uffiidd3);
|
||||
|
||||
if (_uffiva1 != 0)
|
||||
set_row (1,"@85g%03d", _uffiva1);
|
||||
|
||||
if (_uffiva2 != 0)
|
||||
set_row (1,"@89g%03d", _uffiva2);
|
||||
|
||||
if (_uffiva3 != 0)
|
||||
set_row (1,"@93g%03d", _uffiva3);
|
||||
|
||||
if (_uffreg != 0)
|
||||
set_row (1,"@98g%03d", _uffreg);
|
||||
|
||||
if (_uffconc != 0)
|
||||
set_row (1,"@104g%03d", _uffconc);
|
||||
|
||||
if (_uffcserv != 0)
|
||||
set_row (1,"@110g%03d", _uffcserv);
|
||||
|
||||
if (_uffesprov != 0)
|
||||
set_row (1,"@115g%03d", _uffesprov);
|
||||
|
||||
if (_uffescom != 0)
|
||||
set_row (1,"@119g%03d", _uffescom);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void BA6200_application::setta_righe_descr(TParagraph_string* str)
|
||||
{
|
||||
const char* r;
|
||||
int i = 1;
|
||||
|
||||
while ((r = str->get()) != NULL)
|
||||
{
|
||||
set_row (i,"@7g%s", r);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
BA6200_application::BA6200_application()
|
||||
{
|
||||
}
|
||||
|
||||
bool BA6200_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
TString statoini,statofine,codiceini,codicefine,denomini,denomfine;
|
||||
|
||||
tasto = _msk->run();
|
||||
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_data_stampa = _msk->get (F_DATA);
|
||||
int scelta = _msk->get_int (F_SCELTA);
|
||||
_provcom_msk = _msk->get (F_PROVCOM);
|
||||
|
||||
if (scelta == 1)
|
||||
{
|
||||
statoini = _msk->get(F_STATOINI);
|
||||
codiceini = _msk->get(F_CODICEINI);
|
||||
statofine = _msk->get(F_STATOFINE);
|
||||
codicefine = _msk->get(F_CODICEFINE);
|
||||
|
||||
reset_files(); //resetta l'albero di stampa
|
||||
add_file(LF_COMUNI);
|
||||
|
||||
select_cursor(_cur1);
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_COMUNI);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
|
||||
da.put(COM_STATO,statoini);
|
||||
da.put(COM_COM ,codiceini);
|
||||
|
||||
a.put(COM_STATO,statofine);
|
||||
a.put(COM_COM ,codicefine);
|
||||
|
||||
current_cursor()->setregion(da, a);
|
||||
}
|
||||
else
|
||||
if (scelta == 2)
|
||||
{
|
||||
denomini = _msk->get(F_NOMEINI);
|
||||
denomfine = _msk->get(F_NOMEFINE);
|
||||
|
||||
select_cursor(_cur2);
|
||||
|
||||
reset_files();
|
||||
add_file(LF_COMUNI);
|
||||
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_COMUNI);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
|
||||
da.put(COM_DENCOM, denomini);
|
||||
|
||||
a.put (COM_DENCOM, denomfine);
|
||||
|
||||
current_cursor()->setregion(da, a);
|
||||
}
|
||||
|
||||
//set_print_zero();
|
||||
crea_intestazione();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void BA6200_application::crea_intestazione()
|
||||
{
|
||||
TString sep(132);
|
||||
TString data_stampa;
|
||||
|
||||
reset_header();
|
||||
|
||||
sep.fill('-');
|
||||
set_header (1, (const char *) sep);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
sep.right_just(132);
|
||||
set_header (2,(const char*) sep);
|
||||
|
||||
set_header (2,"@0gARCHIVIO COMUNI@91gSTUDIO@104gDATA");
|
||||
data_stampa = _data_stampa.string();
|
||||
set_header (2,"@109g%10s", (const char*) data_stampa);
|
||||
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header (3, (const char *) sep);
|
||||
|
||||
set_header(5,"@0gCodice@7gDenominazione@33gProv.@40gCap@45gCd.Istat@54gAl.ICI@61gMont.@67gUff.@74gII.DD.@87gI.V.A.@97gRegi.@103gConc.@109gServ.@115gEsatt.");
|
||||
set_header (6,"@0g------@7g-------------------------@33g-----@39g-----");
|
||||
set_header (6,"@45g--------@54g------@61g-----@72g-----------");
|
||||
set_header (6,"@85g------------@97g-----@103g-----@109g-----@115g-------");
|
||||
}
|
||||
|
||||
void BA6200_application::user_create()
|
||||
{
|
||||
_rel = new TRelation (LF_COMUNI);
|
||||
|
||||
_cur1 = add_cursor(new TCursor(_rel,"",1));
|
||||
|
||||
_cur2 = add_cursor(new TCursor(_rel,"",2));
|
||||
|
||||
_comuni = new TLocalisamfile (LF_COMUNI);
|
||||
|
||||
_descr_comune = new TParagraph_string ("",25);
|
||||
|
||||
_msk = new TMask("ba6200a");
|
||||
}
|
||||
|
||||
void BA6200_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _comuni;
|
||||
delete _descr_comune;
|
||||
}
|
||||
|
||||
int ba6200(int argc, char* argv[])
|
||||
{
|
||||
|
||||
BA6200_application a;
|
||||
|
||||
a.run(argc, argv, "Stampa Comuni");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
243
ba/bast%ivd.uml
243
ba/bast%ivd.uml
@ -1,119 +1,124 @@
|
||||
#include "ba3200.h"
|
||||
|
||||
PAGE "Stampa Tabella IV direttiva CEE" -1 -1 69 8
|
||||
|
||||
STRING F_INIZIO1 1
|
||||
BEGIN
|
||||
PROMPT 2 1 "Da sezione "
|
||||
FLAGS "U"
|
||||
HELP "Inserire il codice d'inizio "
|
||||
FIELD CODTAB[1,1]
|
||||
USE %IVD
|
||||
INPUT CODTAB[1,1] F_INIZIO1
|
||||
INPUT CODTAB[2,2] F_INIZIO2
|
||||
INPUT CODTAB[3,6] F_INIZIO3
|
||||
INPUT CODTAB[7,8] F_INIZIO4
|
||||
DISPLAY "Sezione" CODTAB[1,1]
|
||||
DISPLAY "Lettera" CODTAB[2,2]
|
||||
DISPLAY "Classe " CODTAB[3,6]
|
||||
DISPLAY "Numero" CODTAB[7,8]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_INIZIO1 CODTAB[1,1]
|
||||
OUTPUT F_INIZIO2 CODTAB[2,2]
|
||||
OUTPUT F_INIZIO3 CODTAB[3,6]
|
||||
OUTPUT F_INIZIO4 CODTAB[7,8]
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_INIZIO2 1
|
||||
BEGIN
|
||||
PROMPT 17 1 "Da lettera "
|
||||
FLAGS "U"
|
||||
HELP "Inserire il codice d'inizio "
|
||||
FIELD CODTAB[2,2]
|
||||
COPY ALL F_INIZIO1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_INIZIO3 8 4
|
||||
BEGIN
|
||||
PROMPT 32 1 "Da classe "
|
||||
FLAGS "UM"
|
||||
HELP "Inserire il codice d'inizio "
|
||||
FIELD CODTAB[3,6]
|
||||
COPY ALL F_INIZIO1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_INIZIO4 2
|
||||
BEGIN
|
||||
PROMPT 53 1 "Da numero "
|
||||
FLAGS "RZ"
|
||||
HELP "Inserire il codice d'inizio "
|
||||
FIELD CODTAB[7,8]
|
||||
COPY ALL F_INIZIO1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_FINE1 1
|
||||
BEGIN
|
||||
PROMPT 2 3 "A sezione "
|
||||
HELP "Inserire il codice di fine "
|
||||
FIELD CODTAB[1,1]
|
||||
FLAGS "U"
|
||||
COPY USE F_INIZIO1
|
||||
INPUT CODTAB[1,1] F_FINE1
|
||||
INPUT CODTAB[2,2] F_FINE2
|
||||
INPUT CODTAB[3,6] F_FINE3
|
||||
INPUT CODTAB[7,8] F_FINE4
|
||||
COPY DISPLAY F_INIZIO1
|
||||
OUTPUT F_FINE1 CODTAB[1,1]
|
||||
OUTPUT F_FINE2 CODTAB[2,2]
|
||||
OUTPUT F_FINE3 CODTAB[3,6]
|
||||
OUTPUT F_FINE4 CODTAB[7,8]
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_FINE2 1
|
||||
BEGIN
|
||||
PROMPT 17 3 "A lettera "
|
||||
FLAGS "U"
|
||||
COPY ALL F_FINE1
|
||||
HELP "Inserire il codice di fine "
|
||||
FIELD CODTAB[2,2]
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
NUMBER F_FINE3 8 4
|
||||
BEGIN
|
||||
PROMPT 32 3 "A classe "
|
||||
FLAGS "UM"
|
||||
HELP "Inserire il codice di fine "
|
||||
FIELD CODTAB[3,6]
|
||||
COPY ALL F_FINE1
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
NUMBER F_FINE4 2
|
||||
BEGIN
|
||||
PROMPT 53 3 "A numero "
|
||||
FLAGS "RZ"
|
||||
HELP "Inserire il codice di fine "
|
||||
FIELD CODTAB[7,8]
|
||||
COPY ALL F_FINE1
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 8 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
#include "ba3200.h"
|
||||
|
||||
PAGE "Stampa Tabella IV direttiva CEE" -1 -1 68 9
|
||||
|
||||
GROUPBOX DLG_NULL 66 3
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bDa codice"
|
||||
END
|
||||
|
||||
STRING F_INIZIO1 1
|
||||
BEGIN
|
||||
PROMPT 2 2 "Sezione "
|
||||
FLAGS "U"
|
||||
HELP "Codice da cui iniziare la stampa"
|
||||
FIELD CODTAB[1,1]
|
||||
USE %IVD
|
||||
INPUT CODTAB[1,1] F_INIZIO1
|
||||
INPUT CODTAB[2,2] F_INIZIO2
|
||||
INPUT CODTAB[3,6] F_INIZIO3
|
||||
INPUT CODTAB[7,8] F_INIZIO4
|
||||
DISPLAY "Sezione" CODTAB[1,1]
|
||||
DISPLAY "Lettera" CODTAB[2,2]
|
||||
DISPLAY "Classe " CODTAB[3,6]
|
||||
DISPLAY "Numero" CODTAB[7,8]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_INIZIO1 CODTAB[1,1]
|
||||
OUTPUT F_INIZIO2 CODTAB[2,2]
|
||||
OUTPUT F_INIZIO3 CODTAB[3,6]
|
||||
OUTPUT F_INIZIO4 CODTAB[7,8]
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_INIZIO2 1
|
||||
BEGIN
|
||||
PROMPT 17 2 "Lettera "
|
||||
FLAGS "U"
|
||||
FIELD CODTAB[2,2]
|
||||
COPY ALL F_INIZIO1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_INIZIO3 8 4
|
||||
BEGIN
|
||||
PROMPT 31 2 "Classe "
|
||||
FLAGS "UM"
|
||||
FIELD CODTAB[3,6]
|
||||
COPY ALL F_INIZIO1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_INIZIO4 2
|
||||
BEGIN
|
||||
PROMPT 52 2 "Numero "
|
||||
FLAGS "RZ"
|
||||
FIELD CODTAB[7,8]
|
||||
COPY ALL F_INIZIO1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 66 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "@bA Codice"
|
||||
END
|
||||
|
||||
STRING F_FINE1 1
|
||||
BEGIN
|
||||
PROMPT 2 5 "Sezione "
|
||||
HELP "Codice finale da stampare"
|
||||
FIELD CODTAB[1,1]
|
||||
FLAGS "U"
|
||||
COPY USE F_INIZIO1
|
||||
INPUT CODTAB[1,1] F_FINE1
|
||||
INPUT CODTAB[2,2] F_FINE2
|
||||
INPUT CODTAB[3,6] F_FINE3
|
||||
INPUT CODTAB[7,8] F_FINE4
|
||||
COPY DISPLAY F_INIZIO1
|
||||
OUTPUT F_FINE1 CODTAB[1,1]
|
||||
OUTPUT F_FINE2 CODTAB[2,2]
|
||||
OUTPUT F_FINE3 CODTAB[3,6]
|
||||
OUTPUT F_FINE4 CODTAB[7,8]
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_FINE2 1
|
||||
BEGIN
|
||||
PROMPT 17 5 "Lettera "
|
||||
FLAGS "U"
|
||||
COPY ALL F_FINE1
|
||||
FIELD CODTAB[2,2]
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
NUMBER F_FINE3 8 4
|
||||
BEGIN
|
||||
PROMPT 31 5 "Classe "
|
||||
FLAGS "UM"
|
||||
FIELD CODTAB[3,6]
|
||||
COPY ALL F_FINE1
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
NUMBER F_FINE4 2
|
||||
BEGIN
|
||||
PROMPT 52 5 "Numero "
|
||||
FLAGS "RZ"
|
||||
FIELD CODTAB[7,8]
|
||||
COPY ALL F_FINE1
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
BUTTON DLG_PRINT 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 "~Stampa"
|
||||
MESSAGE EXIT,K_ENTER
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
|
262
ba/prassi.mnu
262
ba/prassi.mnu
@ -1,130 +1,132 @@
|
||||
0|Menu Principale|
|
||||
0|Anagrafiche|1
|
||||
0|Contabilita'|4
|
||||
0|Manutenzione|ba1
|
||||
1|Gestione Anagrafiche|1
|
||||
1|Persone fisiche|ba4 -1 F
|
||||
1|Persone giuridiche|ba4 -1 G
|
||||
1|Ditte|ba4 -2
|
||||
1|Unita' Locali|ba4 -3
|
||||
1|Attivita'|ba4 -4
|
||||
1|Soci|ba4 -5
|
||||
1|Ricerca Soci|ba5
|
||||
1|Tabelle ministeriali|11
|
||||
1|Tabelle|2
|
||||
1|Stampa anagrafiche|ba6 -0
|
||||
1|Stampa tabelle|3
|
||||
1|Stampa tabelle ministeriali|12
|
||||
1|Stampa numerazione registri|ba3 -2
|
||||
2|Tabelle|1
|
||||
2|Codici IVA|ba3 -0 %iva
|
||||
2|Codici Attivita'|ba3 -0 %ais
|
||||
2|Cond. di pagamento|ba3 -0 %cpg
|
||||
2|Libri sociali|ba3 -0 %itl
|
||||
2|Banche|ba3 -0 %ban
|
||||
2|Codici statistici|ba3 -0 %stt
|
||||
2|Cariche sociali|ba3 -0 %crs
|
||||
2|Vecchi cod.Attivita'|ba3 -0 %ois
|
||||
2|Stati esteri|ba3 -0 %sta
|
||||
2|Valute|ba3 -0 %val
|
||||
2|Lingue|ba3 -0 %lng
|
||||
3|Stampa tabelle|3
|
||||
3|Codici IVA|ba3 -1 %iva
|
||||
3|Codici Attivita'|ba3 -1 %ais
|
||||
3|Cond. di pagamento|ba3 -1 %cpg
|
||||
3|Libri sociali|ba3 -1 %itl
|
||||
3|Banche|ba3 -1 %ban
|
||||
3|Codici statistici|ba3 -1 %stt
|
||||
3|Cariche sociali|ba3 -1 %crs
|
||||
3|Vecchi cod.Attivita'|ba3 -1 %ois
|
||||
3|Stati esteri|ba3 -1 %sta
|
||||
3|Valute|ba3 -1 %val
|
||||
3|Lingue|ba3 -1 %lng
|
||||
4|Contabilita'|2
|
||||
4|Persone fisiche|ba4 -1 F
|
||||
4|Persone giuridiche|ba4 -1 G
|
||||
4|Ditte|ba4 -2
|
||||
4|Tabelle studio|5
|
||||
4|Stampa tabelle studio|6
|
||||
4|Scelta contabilita'|13|F
|
||||
4|IVA|10
|
||||
4|Parametri di studio|cg5 -0
|
||||
4|Gestione Libro Unico|14
|
||||
5|Tabelle studio|
|
||||
5|Tipi documento|ba3 -0 %tpd
|
||||
5|Cond. di pagamento|ba3 -0 %cpg
|
||||
5|Descrizioni aggiuntive|ba3 -0 %dpn
|
||||
5|Codici IVA|ba3 -0 %iva
|
||||
5|Codici Attivita'|ba3 -0 %ais
|
||||
5|Uffici IVA|ba3 -0 %uiv
|
||||
5|Libri sociali|ba3 -0 %itl
|
||||
5|Banche|ba3 -0 %ban
|
||||
5|IV direttiva CEE|ba3 -0 %ivd
|
||||
5|Valute|ba3 -0 %val
|
||||
5|Lingue|ba3 -0 %lng
|
||||
6|Stampa tabelle studio|
|
||||
6|Cond. di pagamento|ba3 -1 %cpg
|
||||
6|Descrizioni aggiuntive|ba3 -1 %dpn
|
||||
6|Codici IVA|ba3 -1 %iva
|
||||
6|Codici Attivita'|ba3 -1 %ais
|
||||
6|Uffici IVA|ba3 -1 %uiv
|
||||
6|Libri sociali|ba3 -1 %itl
|
||||
6|Banche|ba3 -1 %ban
|
||||
6|IV direttiva CEE|ba3 -1 %ivd
|
||||
6|Valute|ba3 -1 %val
|
||||
6|Lingue|ba3 -1 %lng
|
||||
7|Tabelle ditta|
|
||||
7|Parametri ditta|cg5 -1
|
||||
7|Registri|ba3 -0 reg
|
||||
7|Piano dei conti|cg0 -0
|
||||
7|Causali|cg0 -4
|
||||
7|Clienti/Fornitori|cg0 -1
|
||||
7|Banche|ba3 -0 %ban
|
||||
7|Esercizi|ba3 -0 esc
|
||||
8|Stampa tabelle ditta|3
|
||||
8|Registri|ba3 -1 reg
|
||||
8|Piano dei conti|cg1 -0
|
||||
8|Causali|cg1 -6
|
||||
8|Clienti/Fornitori|cg1 -1
|
||||
8|Banche|ba3 -1 %ban
|
||||
9|Prima nota|2
|
||||
9|Prima nota|cg2 -0
|
||||
9|Ricalcolo saldi|cg4 -0
|
||||
9|IVA|10
|
||||
9|Lista movimenti|cg3 -0
|
||||
9|Mastrini|cg3 -1
|
||||
9|Riepiloghi|cg3 -4
|
||||
9|Bilancio|cg1 -4
|
||||
9|Bilancio IV direttiva CEE|cg1 -5
|
||||
9|Giornale|cg3 -3
|
||||
10|IVA|2
|
||||
10|Liquidazione|cg4 -2
|
||||
10|Deleghe|ba3 -0 %del
|
||||
10|Stampa deleghe|cg1 -3
|
||||
10|Riepilogo progressivi|cg0 -3
|
||||
10|Stampa registri|cg4 -3
|
||||
10|Progressivi allegati|cg0 -2
|
||||
10|Stampa allegati|cg3 -2
|
||||
11|Tabelle ministeriali|
|
||||
11|Comuni|ba4 -0
|
||||
11|Uffici concessioni|ba3 -0 %ucc
|
||||
11|Uffici imposte dirette|ba3 -0 %uid
|
||||
11|Uffici IVA|ba3 -0 %uiv
|
||||
11|Uffici registro|ba3 -0 %ure
|
||||
11|Centri servizio|ba3 -0 %ucs
|
||||
12|Stampa tabelle ministeriali|
|
||||
12|Comuni|ba6 -1
|
||||
12|Uffici concessioni|ba3 -1 %ucc
|
||||
12|Uffici imposte dirette|ba3 -1 %uid
|
||||
12|Uffici IVA|ba3 -1 %uiv
|
||||
12|Uffici registro|ba3 -1 %ure
|
||||
12|Centri servizio|ba3 -1 %ucs
|
||||
13|Scelta Contabilita'|
|
||||
13|Tabelle ditta|7
|
||||
13|Stampa tabelle ditta|8
|
||||
13|Prima nota|9
|
||||
14|Gestione Libro Unico
|
||||
14|Tabella Libro Unico|ba3 -4
|
||||
14|Tabella Vidimazioni|ba3 -0 %vid
|
||||
14|Stampa Indici Libro Unico|ba3 -5
|
||||
|
||||
0|Menu Principale|
|
||||
0|Anagrafiche|1
|
||||
0|Contabilita'|4
|
||||
0|Terreni e fabbricati|tefa -t
|
||||
0|Modello 740|.\740 -t
|
||||
0|Manutenzione|ba1
|
||||
1|Gestione Anagrafiche|1
|
||||
1|Persone fisiche|ba4 -1 F
|
||||
1|Persone giuridiche|ba4 -1 G
|
||||
1|Ditte|ba4 -2
|
||||
1|Unita' Locali|ba4 -3
|
||||
1|Attivita'|ba4 -4
|
||||
1|Soci|ba4 -5
|
||||
1|Ricerca Soci|ba5
|
||||
1|Tabelle ministeriali|11
|
||||
1|Tabelle|2
|
||||
1|Stampa anagrafiche|ba6 -0
|
||||
1|Stampa tabelle|3
|
||||
1|Stampa tabelle ministeriali|12
|
||||
1|Stampa numerazione registri|ba3 -2
|
||||
2|Tabelle|1
|
||||
2|Codici IVA|ba3 -0 %iva
|
||||
2|Codici Attivita'|ba3 -0 %ais
|
||||
2|Cond. di pagamento|ba3 -0 %cpg
|
||||
2|Libri sociali|ba3 -0 %itl
|
||||
2|Banche|ba3 -0 %ban
|
||||
2|Codici statistici|ba3 -0 %stt
|
||||
2|Cariche sociali|ba3 -0 %crs
|
||||
2|Vecchi cod.Attivita'|ba3 -0 %ois
|
||||
2|Stati esteri|ba3 -0 %sta
|
||||
2|Valute|ba3 -0 %val
|
||||
2|Lingue|ba3 -0 %lng
|
||||
3|Stampa tabelle|3
|
||||
3|Codici IVA|ba3 -1 %iva
|
||||
3|Codici Attivita'|ba3 -1 %ais
|
||||
3|Cond. di pagamento|ba3 -1 %cpg
|
||||
3|Libri sociali|ba3 -1 %itl
|
||||
3|Banche|ba3 -1 %ban
|
||||
3|Codici statistici|ba3 -1 %stt
|
||||
3|Cariche sociali|ba3 -1 %crs
|
||||
3|Vecchi cod.Attivita'|ba3 -1 %ois
|
||||
3|Stati esteri|ba3 -1 %sta
|
||||
3|Valute|ba3 -1 %val
|
||||
3|Lingue|ba3 -1 %lng
|
||||
4|Contabilita'|2
|
||||
4|Persone fisiche|ba4 -1 F
|
||||
4|Persone giuridiche|ba4 -1 G
|
||||
4|Ditte|ba4 -2
|
||||
4|Tabelle studio|5
|
||||
4|Stampa tabelle studio|6
|
||||
4|Scelta contabilita'|13|F
|
||||
4|IVA|10
|
||||
4|Parametri di studio|cg5 -0
|
||||
4|Gestione Libro Unico|14
|
||||
5|Tabelle studio|1
|
||||
5|Tipi documento|ba3 -0 %tpd
|
||||
5|Cond. di pagamento|ba3 -0 %cpg
|
||||
5|Descrizioni aggiuntive|ba3 -0 %dpn
|
||||
5|Codici IVA|ba3 -0 %iva
|
||||
5|Codici Attivita'|ba3 -0 %ais
|
||||
5|Uffici IVA|ba3 -0 %uiv
|
||||
5|Libri sociali|ba3 -0 %itl
|
||||
5|Banche|ba3 -0 %ban
|
||||
5|IV direttiva CEE|ba3 -0 %ivd
|
||||
5|Valute|ba3 -0 %val
|
||||
5|Lingue|ba3 -0 %lng
|
||||
6|Stampa tabelle studio|3
|
||||
6|Cond. di pagamento|ba3 -1 %cpg
|
||||
6|Descrizioni aggiuntive|ba3 -1 %dpn
|
||||
6|Codici IVA|ba3 -1 %iva
|
||||
6|Codici Attivita'|ba3 -1 %ais
|
||||
6|Uffici IVA|ba3 -1 %uiv
|
||||
6|Libri sociali|ba3 -1 %itl
|
||||
6|Banche|ba3 -1 %ban
|
||||
6|IV direttiva CEE|ba3 -1 %ivd
|
||||
6|Valute|ba3 -1 %val
|
||||
6|Lingue|ba3 -1 %lng
|
||||
7|Tabelle ditta|2
|
||||
7|Parametri ditta|cg5 -1
|
||||
7|Registri|ba3 -0 reg
|
||||
7|Piano dei conti|cg0 -0
|
||||
7|Causali|cg0 -4
|
||||
7|Clienti/Fornitori|cg0 -1
|
||||
7|Banche|ba3 -0 %ban
|
||||
7|Esercizi|ba3 -0 esc
|
||||
8|Stampa tabelle ditta|3
|
||||
8|Registri|ba3 -1 reg
|
||||
8|Piano dei conti|cg1 -0
|
||||
8|Causali|cg1 -6
|
||||
8|Clienti/Fornitori|cg1 -1
|
||||
8|Banche|ba3 -1 %ban
|
||||
9|Prima nota|2
|
||||
9|Prima nota|cg2 -0
|
||||
9|Ricalcolo saldi|cg4 -0
|
||||
9|IVA|10
|
||||
9|Lista movimenti|cg3 -0
|
||||
9|Mastrini|cg3 -1
|
||||
9|Riepiloghi|cg3 -4
|
||||
9|Bilancio|cg1 -4
|
||||
9|Bilancio IV direttiva CEE|cg1 -5
|
||||
9|Giornale|cg3 -3
|
||||
10|IVA|2
|
||||
10|Liquidazione|cg4 -2
|
||||
10|Deleghe|ba3 -0 %del
|
||||
10|Stampa deleghe|cg1 -3
|
||||
10|Riepilogo progressivi|cg0 -3
|
||||
10|Stampa registri|cg4 -3
|
||||
10|Progressivi allegati|cg0 -2
|
||||
10|Stampa allegati|cg3 -2
|
||||
11|Tabelle ministeriali|1
|
||||
11|Comuni|ba4 -0
|
||||
11|Uffici concessioni|ba3 -0 %ucc
|
||||
11|Uffici imposte dirette|ba3 -0 %uid
|
||||
11|Uffici IVA|ba3 -0 %uiv
|
||||
11|Uffici registro|ba3 -0 %ure
|
||||
11|Centri servizio|ba3 -0 %ucs
|
||||
12|Stampa tabelle ministeriali|3
|
||||
12|Comuni|ba6 -1
|
||||
12|Uffici concessioni|ba3 -1 %ucc
|
||||
12|Uffici imposte dirette|ba3 -1 %uid
|
||||
12|Uffici IVA|ba3 -1 %uiv
|
||||
12|Uffici registro|ba3 -1 %ure
|
||||
12|Centri servizio|ba3 -1 %ucs
|
||||
13|Scelta Contabilita'|
|
||||
13|Tabelle ditta|7
|
||||
13|Stampa tabelle ditta|8
|
||||
13|Prima nota|9
|
||||
14|Gestione Libro Unico|1
|
||||
14|Tabella Libro Unico|ba3 -4
|
||||
14|Tabella Vidimazioni|ba3 -0 %vid
|
||||
14|Stampa Indici Libro Unico|ba3 -5
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user