Aggiunta la funzione setfiler.

Aggiornato l'uso della funzione filter e setregion


git-svn-id: svn://10.65.10.50/trunk@72 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1994-08-26 14:06:07 +00:00
parent fe146577cf
commit 10cb8b20f6
17 changed files with 4639 additions and 4555 deletions

View File

@ -1,4 +1,4 @@
// ba3200 Stampa tabelle // ba3200 Stampa tabelle
// //
// legge un file con estensione .rpt che descrive la stampa. // legge un file con estensione .rpt che descrive la stampa.
// Vedi file leggimi.txt per il formato del file // Vedi file leggimi.txt per il formato del file
@ -17,25 +17,25 @@
class BA3200_application : public TPrintapp class BA3200_application : public TPrintapp
{ {
// TTable* _tab; // TTable* _tab;
TString _tabname; TString _tabname;
TFilename _rptname; TFilename _rptname;
TRelation* _rel; TRelation* _rel;
TCursor *_cur; TCursor *_cur;
TMask* _msk; TMask* _msk;
TString _maskname; TString _maskname;
// TScanner *_rpt; // TScanner *_rpt;
int _logicnum; int _logicnum;
public: public:
virtual void user_create() ; virtual void user_create() ;
virtual void user_destroy() ; virtual void user_destroy() ;
virtual bool set_print(int) ; virtual bool set_print(int) ;
virtual void set_page(int, int); virtual void set_page(int, int);
void leggi_rpt(); void leggi_rpt();
void set_headers(); void set_headers();
void set_rows(); void set_rows();
void set_footers(); void set_footers();
@ -61,15 +61,15 @@ bool BA3200_application::set_print(int)
{ {
const TMask_field& campo_maschera = _msk->fld(i); const TMask_field& campo_maschera = _msk->fld(i);
const char* val = campo_maschera.get(); const char* val = campo_maschera.get();
const TFieldref* campo_ref = campo_maschera.field(); const TFieldref* campo_ref = campo_maschera.field();
if (*val && campo_ref != NULL && campo_ref->ok()) if (*val && campo_ref != NULL && campo_ref->ok())
{ {
if (campo_maschera.in_group(1)) campo_ref->write(val, from); else if (campo_maschera.in_group(1)) campo_ref->write(val, from); else
if (campo_maschera.in_group(2)) campo_ref->write(val, to); if (campo_maschera.in_group(2)) campo_ref->write(val, to);
} }
} }
_cur->filter ("", from.empty() ? NULL : &from, to.empty() ? NULL : &to); _cur->setregion (from, to);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -77,14 +77,14 @@ bool BA3200_application::set_print(int)
void BA3200_application::set_page (int , int ) void BA3200_application::set_page (int , int )
{ {
leggi_rpt(); leggi_rpt();
} }
void BA3200_application::set_headers() void BA3200_application::set_headers()
{ {
TString NomeTabella, sep, formato_intesta, testo_intesta; TString NomeTabella, sep, formato_intesta, testo_intesta;
int LungRiga, riga_intesta=0, last_riga=1; int LungRiga, riga_intesta=0, last_riga=1;
TToken_string line; TToken_string line;
reset_header (); reset_header ();
@ -117,7 +117,7 @@ void BA3200_application::set_headers()
testo_intesta = (const char *) line.get(); testo_intesta = (const char *) line.get();
if (riga_intesta) if (riga_intesta)
set_header (last_riga+riga_intesta, (const char *)formato_intesta, set_header (last_riga+riga_intesta, (const char *)formato_intesta,
(const char *)testo_intesta); (const char *)testo_intesta);
line = rpt.line(); line = rpt.line();
} }
@ -131,8 +131,8 @@ void BA3200_application::set_headers()
void BA3200_application::set_rows() void BA3200_application::set_rows()
{ {
TToken_string line; TToken_string line;
TFieldref campo; TFieldref campo;
int from, to, riga_record; int from, to, riga_record;
TString formato_campo, picture; TString formato_campo, picture;
const char * name; const char * name;
@ -150,7 +150,7 @@ void BA3200_application::set_rows()
to = campo.to(); to = campo.to();
name = campo.name(); name = campo.name();
formato_campo = line.get(); formato_campo = line.get();
formato_campo.trim(); formato_campo.trim();
if (formato_campo.lower() == "@pn") if (formato_campo.lower() == "@pn")
@ -229,7 +229,7 @@ void BA3200_application::user_create()
fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname); fatal_box("Impossibile aprire il file '%s'", (const char*)_rptname);
// _tab = new TTable (_tabname); // _tab = new TTable (_tabname);
_rel = new TRelation (_tabname); _rel = new TRelation (_tabname);
_cur = new TCursor (_rel); _cur = new TCursor (_rel);
@ -256,7 +256,7 @@ void BA3200_application::user_destroy()
delete _msk; delete _msk;
delete _cur; delete _cur;
delete _rel; delete _rel;
// delete _tab; // delete _tab;
} }
int ba3200(int argc, char* argv[]) int ba3200(int argc, char* argv[])

View File

@ -43,7 +43,7 @@ BEGIN
INPUT TIPOA "G" INPUT TIPOA "G"
INPUT CODANAGR FLD_CODANAGR INPUT CODANAGR FLD_CODANAGR
DISPLAY "Codice" CODANAGR DISPLAY "Codice" CODANAGR
DISPLAY "Denominazione@50" RAGSOC DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Codice Fiscale@16" COFI DISPLAY "Codice Fiscale@16" COFI
OUTPUT FLD_CODANAGR CODANAGR OUTPUT FLD_CODANAGR CODANAGR
OUTPUT FLD_AG1_RAGSOC RAGSOC OUTPUT FLD_AG1_RAGSOC RAGSOC
@ -64,7 +64,7 @@ BEGIN
INPUT TIPOA "G" INPUT TIPOA "G"
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
INPUT RAGSOC FLD_AG1_RAGSOC INPUT RAGSOC FLD_AG1_RAGSOC
DISPLAY "Denominazione@50" RAGSOC DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Codice" CODANAGR DISPLAY "Codice" CODANAGR
DISPLAY "Codice Fiscale " COFI DISPLAY "Codice Fiscale " COFI
COPY OUTPUT FLD_CODANAGR COPY OUTPUT FLD_CODANAGR
@ -115,7 +115,7 @@ BEGIN
INPUT TIPOA "G" INPUT TIPOA "G"
INPUT COFI FLD_AG1_COFI INPUT COFI FLD_AG1_COFI
DISPLAY "Codice Fiscale@16" COFI DISPLAY "Codice Fiscale@16" COFI
DISPLAY "Denominazione@50" RAGSOC DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Codice" CODANAGR DISPLAY "Codice" CODANAGR
COPY OUTPUT FLD_CODANAGR COPY OUTPUT FLD_CODANAGR
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
@ -1071,7 +1071,7 @@ END
STRING F_IMP_PROVCOM 5 STRING F_IMP_PROVCOM 5
BEGIN BEGIN
PROMPT 64 6 "Prov." PROMPT 62 6 "Prov."
FLAGS "D" FLAGS "D"
END END
@ -1092,10 +1092,15 @@ BEGIN
WARNING "Ufficio imposte assente" WARNING "Ufficio imposte assente"
END END
STRINF F_DENUFFIIDD 50 STRINF F_DENUFFIIDD 50 48
BEGIN BEGIN
PROMPT 23 7 " " PROMPT 23 7 " "
FLAGS "D" USE %UID KEY 2
INPUT S0 F_DENUFFIIDD
DISPLAY "Denominazione@50" S0
DISPLAY "Ufficio" CODTAB
DISPLAY "C.C.@8" S4
COPY OUTPUT F_UFFIIDD
END END
STRING F_CC_ESATTORIA 8 STRING F_CC_ESATTORIA 8
@ -1115,7 +1120,7 @@ BEGIN
FLAGS "UDG" FLAGS "UDG"
END END
STRING F_DENUFFREG 50 STRING F_DENUFFREG 50 48
BEGIN BEGIN
PROMPT 24 9 "" PROMPT 24 9 ""
FLAGS "D" FLAGS "D"
@ -1132,7 +1137,7 @@ BEGIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
STRING F_DENUFFCONC 50 STRING F_DENUFFCONC 50 48
BEGIN BEGIN
PROMPT 24 10 "" PROMPT 24 10 ""
FLAGS "D" FLAGS "D"
@ -1149,7 +1154,7 @@ BEGIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
STRING F_DENUFFSERV 50 STRING F_DENUFFSERV 50 48
BEGIN BEGIN
PROMPT 24 11 "" PROMPT 24 11 ""
FLAGS "D" FLAGS "D"

View File

@ -309,7 +309,7 @@ STRING FLD_GD1_COMAA_COMUNI_DESCR 50
BEGIN BEGIN
PROMPT 8 12 ": Nome " PROMPT 8 12 ": Nome "
USE LF_COMUNI KEY 2 SELECT STATO="" USE LF_COMUNI KEY 2 SELECT STATO=""
INPUT COM FLD_GD1_COMAA_COMUNI_DESCR INPUT DENCOM FLD_GD1_COMAA_COMUNI_DESCR
#include <comdden.h> #include <comdden.h>
OUTPUT FLD_GD1_COMAA COM OUTPUT FLD_GD1_COMAA COM
OUTPUT FLD_GD1_COMAA_COMUNI_DESCR DENCOM OUTPUT FLD_GD1_COMAA_COMUNI_DESCR DENCOM

View File

@ -15,19 +15,19 @@ TRectype& BA6100_App::look_com(const char* cod)
{ {
_comuni->curr().zero(); _comuni->curr().zero();
if (*cod) if (*cod)
{ {
_comuni->curr().put("COM",cod); _comuni->curr().put("COM",cod);
_comuni->read(); _comuni->read();
if (_comuni->bad()) if (_comuni->bad())
_comuni->curr().zero(); _comuni->curr().zero();
} }
return _comuni->curr(); return _comuni->curr();
} }
const char* BA6100_App::look_tab(const char* tabname, const char* cod, const char* BA6100_App::look_tab(const char* tabname, const char* cod,
const char* fld) const char* fld)
{ {
if (*cod == 0) return ""; if (*cod == 0) return "";
TTable tab(tabname); TTable tab(tabname);
tab.curr().zero(); tab.curr().zero();
tab.curr().put("CODTAB",cod); tab.curr().put("CODTAB",cod);
@ -40,24 +40,24 @@ const char* BA6100_App::look_tab(const char* tabname, const char* cod,
void BA6100_App::process_link(int id, const char* txt) void BA6100_App::process_link(int id, const char* txt)
{ {
if (id == _ana_link) if (id == _ana_link)
{ {
TString ss = "1|"; ss << txt; TString ss = "1|"; ss << txt;
TMessage fs(cmd2name("ba4","-1"), MSG_LN, ss); TMessage fs(cmd2name("ba4","-1"), MSG_LN, ss);
TMailbox m; TMailbox m;
m.send(fs); m.send(fs);
TExternal_app ba4(_pr_what == anafis ? "ba4 -1 F" : "ba4 -1 G"); TExternal_app ba4(_pr_what == anafis ? "ba4 -1 F" : "ba4 -1 G");
if (ba4.run()) beep(); if (ba4.run()) beep();
} }
else if (id == _dit_link) else if (id == _dit_link)
{ {
TString ss = "1|"; ss << txt << "|" << txt; TString ss = "1|"; ss << txt << "|" << txt;
TMessage fs(cmd2name("ba4","-2"), MSG_LN, ss); TMessage fs(cmd2name("ba4","-2"), MSG_LN, ss);
TMailbox m; TMailbox m;
m.send(fs); m.send(fs);
TExternal_app ba4("ba4 -2"); TExternal_app ba4("ba4 -2");
if (ba4.run()) beep(); if (ba4.run()) beep();
} }
} }
// ---- here we go ------------------------------------------------- // ---- here we go -------------------------------------------------
@ -65,40 +65,40 @@ void BA6100_App::process_link(int id, const char* txt)
void BA6100_App::set_page(int file, int cnt) void BA6100_App::set_page(int file, int cnt)
{ {
switch(file) switch(file)
{
case LF_ANAG:
case LF_NDITTE:
if (_pr_type == elenco)
{ {
case LF_ANAG: if (_pr_what != nditte && file == LF_NDITTE)
case LF_NDITTE: {
if (_pr_type == elenco) set_row(1,"@50g$[r]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"),
{ FLD(LF_NDITTE,"RAGSOC"));
if (_pr_what != nditte && file == LF_NDITTE) set_row(2,"");
{ }
set_row(1,"@50g$[r]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), else
FLD(LF_NDITTE,"RAGSOC")); set_elenco();
set_row(2,"");
}
else
set_elenco();
}
else if (_pr_type == rubriche) set_rubriche();
else if (_pr_type == schede)
{
if (_pr_what != nditte && file == LF_NDITTE)
set_scheda_ditta();
else
set_schede();
}
else if (_pr_type == etichette) set_etichette();
break;
case LF_ATTIV:
set_scheda_attiv();
break;
case LF_UNLOC:
set_scheda_unloc();
break;
case LF_SOCI:
set_scheda_socio();
break;
} }
else if (_pr_type == rubriche) set_rubriche();
else if (_pr_type == schede)
{
if (_pr_what != nditte && file == LF_NDITTE)
set_scheda_ditta();
else
set_schede();
}
else if (_pr_type == etichette) set_etichette();
break;
case LF_ATTIV:
set_scheda_attiv();
break;
case LF_UNLOC:
set_scheda_unloc();
break;
case LF_SOCI:
set_scheda_socio();
break;
}
} }
@ -108,26 +108,26 @@ bool BA6100_App::preprocess_page(int file, int counter)
// che la stampa a fianco dell'anagrafica // che la stampa a fianco dell'anagrafica
if (file == LF_NDITTE && _pr_type == elenco && _inclditte if (file == LF_NDITTE && _pr_type == elenco && _inclditte
&& _pr_what != nditte) && _pr_what != nditte)
if (current_cursor()->is_first_match(LF_NDITTE)) if (current_cursor()->is_first_match(LF_NDITTE))
return FALSE; return FALSE;
if (_pr_type == rubriche) if (_pr_type == rubriche)
{ {
// vale per ditte, anagiu, anafis // vale per ditte, anagiu, anafis
_com = current_cursor()->curr(LF_ANAG).get("COMRES"); _com = current_cursor()->curr(LF_ANAG).get("COMRES");
if (_com.empty()) if (_com.empty())
_com = current_cursor()->curr(LF_ANAG).get("COMRF"); _com = current_cursor()->curr(LF_ANAG).get("COMRF");
_phone = current_cursor()->curr(LF_ANAG).get("PTELRF"); _phone = current_cursor()->curr(LF_ANAG).get("PTELRF");
_phone.trim(); _phone.trim();
if (!_phone.empty()) _phone << '/'; if (!_phone.empty()) _phone << '/';
_phone << current_cursor()->curr(LF_ANAG).get("TELRF"); _phone << current_cursor()->curr(LF_ANAG).get("TELRF");
TRectype& cc = look_com(_com); TRectype& cc = look_com(_com);
_com = cc.get("DENCOM"); _com = cc.get("DENCOM");
_cap = cc.get("CAPCOM"); _cap = cc.get("CAPCOM");
_prov = cc.get("PROVCOM"); _prov = cc.get("PROVCOM");
} }
else if (_pr_type == etichette) else if (_pr_type == etichette)
preprocess_etichette(); preprocess_etichette();
return TRUE; return TRUE;
} }
@ -136,19 +136,19 @@ bool BA6100_App::preprocess_page(int file, int counter)
bool mask_reset_fields(TMask_field& mf, KEY k) bool mask_reset_fields(TMask_field& mf, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
{ {
BA6100_App* a = (BA6100_App*)MainApp(); BA6100_App* a = (BA6100_App*)MainApp();
mf.mask().field(FLD_BA6B_INDROW).set(format("%d",a->_ind_row)); mf.mask().field(FLD_BA6B_INDROW).set(format("%d",a->_ind_row));
mf.mask().field(FLD_BA6B_INDCOL).set(format("%d",a->_ind_col)); mf.mask().field(FLD_BA6B_INDCOL).set(format("%d",a->_ind_col));
mf.mask().field(FLD_BA6B_PIVROW).set(format("%d",a->_piv_row)); mf.mask().field(FLD_BA6B_PIVROW).set(format("%d",a->_piv_row));
mf.mask().field(FLD_BA6B_PIVCOL).set(format("%d",a->_piv_col)); mf.mask().field(FLD_BA6B_PIVCOL).set(format("%d",a->_piv_col));
mf.mask().field(FLD_BA6B_CODROW).set(format("%d",a->_cod_row)); mf.mask().field(FLD_BA6B_CODROW).set(format("%d",a->_cod_row));
mf.mask().field(FLD_BA6B_CODCOL).set(format("%d",a->_cod_col)); mf.mask().field(FLD_BA6B_CODCOL).set(format("%d",a->_cod_col));
mf.mask().field(FLD_BA6B_TOTROW).set(format("%d",a->_rows_et)); mf.mask().field(FLD_BA6B_TOTROW).set(format("%d",a->_rows_et));
mf.mask().field(FLD_BA6B_TOTCOL).set(format("%d",a->_cols_et)); mf.mask().field(FLD_BA6B_TOTCOL).set(format("%d",a->_cols_et));
mf.mask().field(CHK_BA6B_PIVA).set(a->_is_piv ? "X" : " "); mf.mask().field(CHK_BA6B_PIVA).set(a->_is_piv ? "X" : " ");
mf.mask().field(CHK_BA6B_CODICE).set(a->_is_cod ?"X": " "); mf.mask().field(CHK_BA6B_CODICE).set(a->_is_cod ?"X": " ");
} }
return TRUE; return TRUE;
} }
@ -164,388 +164,387 @@ void BA6100_App::preprocess_etichette()
_cofi = get_field(LF_ANAG,"PAIV"); _cofi = get_field(LF_ANAG,"PAIV");
if (_pr_what == anafis) if (_pr_what == anafis)
{ {
_surname = _name.mid(30,50); _surname.trim(); _surname = _name.mid(30,50); _surname.trim();
_name = _name.mid(0,30); _name.trim(); _name = _name.mid(0,30); _name.trim();
} }
switch (_ind_what) switch (_ind_what)
{ {
case corrispondenza: case corrispondenza:
_address = get_field(LF_ANAG,"INDCORR"); _address = get_field(LF_ANAG,"INDCORR");
_civ = get_field(LF_ANAG,"CIVCORR"); _civ = get_field(LF_ANAG,"CIVCORR");
_stato = look_tab("%STA",get_field(LF_ANAG,"STATOCORR")); _stato = look_tab("%STA",get_field(LF_ANAG,"STATOCORR"));
_cap = get_field(LF_ANAG,"CAPCORR"); _cap = get_field(LF_ANAG,"CAPCORR");
_com = cc.get("DENCOM"); _com = cc.get("DENCOM");
_prov = cc.get("PROVCOM"); _prov = cc.get("PROVCOM");
if (_cap.empty()) if (_cap.empty())
_cap = cc.get("CAPCOM"); _cap = cc.get("CAPCOM");
if (!_address.empty()) if (!_address.empty())
break; break;
// else fall down // else fall down
case domfisc: case domfisc:
_address = get_field(LF_ANAG,"INDRF"); _address = get_field(LF_ANAG,"INDRF");
_civ = get_field(LF_ANAG,"CIVRF"); _civ = get_field(LF_ANAG,"CIVRF");
_stato = look_tab("%STA",get_field(LF_ANAG,"STATORF")); _stato = look_tab("%STA",get_field(LF_ANAG,"STATORF"));
_cap = get_field(LF_ANAG,"CAPRF"); _cap = get_field(LF_ANAG,"CAPRF");
cc = look_com(get_field(LF_ANAG,"COMRF")); cc = look_com(get_field(LF_ANAG,"COMRF"));
_com = cc.get("DENCOM"); _com = cc.get("DENCOM");
_prov = cc.get("PROVCOM"); _prov = cc.get("PROVCOM");
if (_cap.empty()) if (_cap.empty())
_cap = cc.get("CAPCOM"); _cap = cc.get("CAPCOM");
if (!_address.empty()) if (!_address.empty())
break; break;
// else fall down // else fall down
case residenza: case residenza:
_address = get_field(LF_ANAG,"INDRES"); _address = get_field(LF_ANAG,"INDRES");
_civ = get_field(LF_ANAG,"CIVRES"); _civ = get_field(LF_ANAG,"CIVRES");
_stato = look_tab("%STA",get_field(LF_ANAG,"STATORES")); _stato = look_tab("%STA",get_field(LF_ANAG,"STATORES"));
_cap = get_field(LF_ANAG,"CAPRES"); _cap = get_field(LF_ANAG,"CAPRES");
cc = look_com(get_field(LF_ANAG,"COMRES")); cc = look_com(get_field(LF_ANAG,"COMRES"));
_com = cc.get("DENCOM"); _com = cc.get("DENCOM");
_prov = cc.get("PROVCOM"); _prov = cc.get("PROVCOM");
if (_cap.empty()) if (_cap.empty())
_cap = cc.get("CAPCOM"); _cap = cc.get("CAPCOM");
break; break;
} }
} }
void BA6100_App::init_print() void BA6100_App::init_print()
{ {
reset_print(); reset_print();
reset_files(); reset_files();
// select cursor and main file // select cursor and main file
switch(_pr_what) switch(_pr_what)
{ {
case anafis: case anafis:
select_cursor(cfis()); select_cursor(cfis());
add_file(LF_ANAG); add_file(LF_ANAG);
break; break;
case anagiu: case anagiu:
select_cursor(cgiu()); select_cursor(cgiu());
add_file(LF_ANAG); add_file(LF_ANAG);
break; break;
case nditte: case nditte:
select_cursor(cdit()); select_cursor(cdit());
add_file(LF_NDITTE); add_file(LF_NDITTE);
break; break;
} }
force_setpage(_pr_type == schede); force_setpage(_pr_type == schede);
// setup secondary links // setup secondary links
if (_inclditte) if (_inclditte)
{ {
switch(_pr_type) switch(_pr_type)
{ {
case elenco: case elenco:
if (_pr_what != nditte) if (_pr_what != nditte)
add_file(LF_NDITTE); add_file(LF_NDITTE);
break; break;
case schede: case schede:
if (_pr_what != nditte) if (_pr_what != nditte)
add_file(LF_NDITTE); add_file(LF_NDITTE);
add_file(LF_ATTIV,LF_NDITTE); add_file(LF_ATTIV,LF_NDITTE);
add_file(LF_UNLOC,LF_NDITTE); add_file(LF_UNLOC,LF_NDITTE);
add_file(LF_SOCI, LF_NDITTE); add_file(LF_SOCI, LF_NDITTE);
break; break;
default: default:
break; break;
}
} }
}
set_headers(); set_headers();
} }
bool BA6100_App::set_print(int) bool BA6100_App::set_print(int)
{ {
TMask mask("ba6100a.msk"); TMask mask("ba6100a.msk");
// set print type // set print type
switch (mask.run()) switch (mask.run())
{ {
case K_ESC: case K_ESC:
case K_QUIT: case K_QUIT:
return FALSE; return FALSE;
case BUT_BA6_ELENCO: case BUT_BA6_ELENCO:
_pr_type = elenco; _pr_type = elenco;
// cio' che e' blu collega al modulo anagrafiche // cio' che e' blu collega al modulo anagrafiche
_ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b'); _ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b');
_dit_link = enable_link("Collegamento archivio ditte: ", 'r'); _dit_link = enable_link("Collegamento archivio ditte: ", 'r');
break; break;
case BUT_BA6_SCHEDE: case BUT_BA6_SCHEDE:
disable_links(); disable_links();
_pr_type = schede; _pr_type = schede;
break; break;
case BUT_BA6_ETICHETTE: case BUT_BA6_ETICHETTE:
disable_links(); disable_links();
if (_pr_what != nditte) if (_pr_what != nditte)
{ {
_pr_type = etichette; _pr_type = etichette;
// set additionals // set additionals
TMask mask2("ba6100b.msk"); TMask mask2("ba6100b.msk");
mask2.set_workfile("ba6100.set"); mask2.set_workfile("ba6100.set");
mask2.set_handler(BUT_BA6B_RESET, mask_reset_fields); mask2.set_handler(BUT_BA6B_RESET, mask_reset_fields);
if (fexist("ba6100b.set")) if (fexist("ba6100b.set"))
{ {
mask2.load(); mask2.load();
_ind_what = (in)atoi(mask2.get(RDB_BA6B_INDIR)); _ind_what = (in)atoi(mask2.get(RDB_BA6B_INDIR));
_ind_row = atoi(mask2.get(FLD_BA6B_INDROW)); _ind_row = atoi(mask2.get(FLD_BA6B_INDROW));
_piv_row = atoi(mask2.get(FLD_BA6B_PIVROW)); _piv_row = atoi(mask2.get(FLD_BA6B_PIVROW));
_cod_row = atoi(mask2.get(FLD_BA6B_CODROW)); _cod_row = atoi(mask2.get(FLD_BA6B_CODROW));
_rows_et = atoi(mask2.get(FLD_BA6B_TOTROW)); _rows_et = atoi(mask2.get(FLD_BA6B_TOTROW));
_ind_col = atoi(mask2.get(FLD_BA6B_INDCOL)); _ind_col = atoi(mask2.get(FLD_BA6B_INDCOL));
_piv_col = atoi(mask2.get(FLD_BA6B_PIVCOL)); _piv_col = atoi(mask2.get(FLD_BA6B_PIVCOL));
_cod_col = atoi(mask2.get(FLD_BA6B_CODCOL)); _cod_col = atoi(mask2.get(FLD_BA6B_CODCOL));
_cols_et = atoi(mask2.get(FLD_BA6B_TOTCOL)); _cols_et = atoi(mask2.get(FLD_BA6B_TOTCOL));
_is_piv = mask2.get(CHK_BA6B_PIVA) == "X"; _is_piv = mask2.get(CHK_BA6B_PIVA) == "X";
_is_cod = mask2.get(CHK_BA6B_CODICE) == "X"; _is_cod = mask2.get(CHK_BA6B_CODICE) == "X";
} }
else else
{ {
mask2.field(FLD_BA6B_INDROW).set(format("%d",_ind_row)); mask2.field(FLD_BA6B_INDROW).set(format("%d",_ind_row));
mask2.field(FLD_BA6B_INDCOL).set(format("%d",_ind_col)); mask2.field(FLD_BA6B_INDCOL).set(format("%d",_ind_col));
mask2.field(FLD_BA6B_PIVROW).set(format("%d",_piv_row)); mask2.field(FLD_BA6B_PIVROW).set(format("%d",_piv_row));
mask2.field(FLD_BA6B_PIVCOL).set(format("%d",_piv_col)); mask2.field(FLD_BA6B_PIVCOL).set(format("%d",_piv_col));
mask2.field(FLD_BA6B_CODROW).set(format("%d",_cod_row)); mask2.field(FLD_BA6B_CODROW).set(format("%d",_cod_row));
mask2.field(FLD_BA6B_CODCOL).set(format("%d",_cod_col)); mask2.field(FLD_BA6B_CODCOL).set(format("%d",_cod_col));
mask2.field(FLD_BA6B_TOTROW).set(format("%d",_rows_et)); mask2.field(FLD_BA6B_TOTROW).set(format("%d",_rows_et));
mask2.field(FLD_BA6B_TOTCOL).set(format("%d",_cols_et)); mask2.field(FLD_BA6B_TOTCOL).set(format("%d",_cols_et));
mask2.field(CHK_BA6B_PIVA).set(_is_piv ? "X" : " "); mask2.field(CHK_BA6B_PIVA).set(_is_piv ? "X" : " ");
mask2.field(CHK_BA6B_CODICE).set(_is_cod ?"X": " "); mask2.field(CHK_BA6B_CODICE).set(_is_cod ?"X": " ");
} }
mask2.run(); mask2.run();
_ind_what = (in)atoi(mask2.get(RDB_BA6B_INDIR)); _ind_what = (in)atoi(mask2.get(RDB_BA6B_INDIR));
_ind_row = atoi(mask2.get(FLD_BA6B_INDROW)); _ind_row = atoi(mask2.get(FLD_BA6B_INDROW));
_piv_row = atoi(mask2.get(FLD_BA6B_PIVROW)); _piv_row = atoi(mask2.get(FLD_BA6B_PIVROW));
_cod_row = atoi(mask2.get(FLD_BA6B_CODROW)); _cod_row = atoi(mask2.get(FLD_BA6B_CODROW));
_rows_et = atoi(mask2.get(FLD_BA6B_TOTROW)); _rows_et = atoi(mask2.get(FLD_BA6B_TOTROW));
_ind_col = atoi(mask2.get(FLD_BA6B_INDCOL)); _ind_col = atoi(mask2.get(FLD_BA6B_INDCOL));
_piv_col = atoi(mask2.get(FLD_BA6B_PIVCOL)); _piv_col = atoi(mask2.get(FLD_BA6B_PIVCOL));
_cod_col = atoi(mask2.get(FLD_BA6B_CODCOL)); _cod_col = atoi(mask2.get(FLD_BA6B_CODCOL));
_cols_et = atoi(mask2.get(FLD_BA6B_TOTCOL)); _cols_et = atoi(mask2.get(FLD_BA6B_TOTCOL));
_is_piv = mask2.get(CHK_BA6B_PIVA) == "X"; _is_piv = mask2.get(CHK_BA6B_PIVA) == "X";
_is_cod = mask2.get(CHK_BA6B_CODICE) == "X"; _is_cod = mask2.get(CHK_BA6B_CODICE) == "X";
if (_frpos) delete _frpos; if (_frpos) delete _frpos;
_frpos = new bool[_rows_et]; _frpos = new bool[_rows_et];
memset(_frpos,FALSE,sizeof(_frpos)); memset(_frpos,FALSE,sizeof(_frpos));
_frpos[_ind_row-1] = TRUE; _frpos[_ind_row-1] = TRUE;
_frpos[_ind_row] = TRUE; _frpos[_ind_row] = TRUE;
if (_is_piv) _frpos[_piv_row-1] = TRUE; if (_is_piv) _frpos[_piv_row-1] = TRUE;
if (_is_cod) _frpos[_cod_row-1] = TRUE; if (_is_cod) _frpos[_cod_row-1] = TRUE;
for (int jk = 0; jk < _rows_et; jk++) for (int jk = 0; jk < _rows_et; jk++)
if (!_frpos[jk]) set_row(jk+1,""); if (!_frpos[jk]) set_row(jk+1,"");
// save settings // save settings
if (mask2.get(CHK_BA6B_SAVE) == "X") if (mask2.get(CHK_BA6B_SAVE) == "X")
mask2.save(); mask2.save();
}
break;
case BUT_BA6_RUBRICHE:
_ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b');
_dit_link = enable_link("Collegamento archivio ditte: ", 'r');
_pr_type = rubriche;
break;
} }
break;
case BUT_BA6_RUBRICHE:
_ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b');
_dit_link = enable_link("Collegamento archivio ditte: ", 'r');
_pr_type = rubriche;
break;
}
_pr_what = (pw)atoi(mask.get(RDB_BA6_TYPE)); _pr_what = (pw)atoi(mask.get(RDB_BA6_TYPE));
_sort = atoi(mask.get(RDB_BA6_SORT)); _sort = atoi(mask.get(RDB_BA6_SORT));
_inclditte = (bool)(mask.get(CHK_BA6_INCLDI) == "X"); _inclditte = (bool)(mask.get(CHK_BA6_INCLDI) == "X");
TString cod_from(5), cod_to(5); TString cod_from(5), cod_to(5);
TLocalisamfile* fl; TLocalisamfile* fl;
switch(_pr_what) switch(_pr_what)
{
case anafis:
case anagiu:
select_cursor(_pr_what == anafis ? cfis() : cgiu());
if (_sort == 1)
{ {
case anafis: cod_from = mask.get(_pr_what == anafis ? FLD_ANF_CODFR
case anagiu: : FLD_ANG_CODFR);
select_cursor(_pr_what == anafis ? cfis() : cgiu()); cod_to = mask.get(_pr_what == anafis ? FLD_ANF_CODTO
if (_sort == 1) : FLD_ANG_CODTO);
{
cod_from = mask.get(_pr_what == anafis ? FLD_ANF_CODFR
: FLD_ANG_CODFR);
cod_to = mask.get(_pr_what == anafis ? FLD_ANF_CODTO
: FLD_ANG_CODTO);
}
else
{
cod_from = mask.get(_pr_what == anafis ? FLD_ANF_RAGSOCFR
: FLD_ANG_RAGSOCFR);
cod_to = mask.get(_pr_what == anafis ? FLD_ANF_RAGSOCTO
: FLD_ANG_RAGSOCTO);
}
{
fl = current_cursor()->file(LF_ANAG);
TRectype tr1(fl->curr());
TRectype tr2(fl->curr());
tr1.zero(); tr2.zero();
tr1.put("TIPOA", _pr_what == anafis ? "F" : "G");
tr2.put("TIPOA", _pr_what == anafis ? "F" : "G");
if (!cod_from.empty() || !cod_to.empty())
{
if (_sort == 1)
{
if (cod_from.not_empty())
{
tr1.put("CODANAGR",cod_from);
tr2.put("CODANAGR",cod_to);
}
}
else
{
if (cod_from.not_empty())
{
tr1.put("RAGSOC",cod_from);
tr2.put("RAGSOC",cod_to);
}
}
}
current_cursor()->setregion(&tr1, &tr2);
}
break;
case nditte:
select_cursor(cdit());
if (_sort == 1)
{
cod_from = mask.get(FLD_DITTE_CODFR);
cod_to = mask.get(FLD_DITTE_CODTO);
}
else
{
cod_from = mask.get(FLD_DITTE_RAGSOCFR);
cod_to = mask.get(FLD_DITTE_RAGSOCTO);
}
if (!cod_from.empty() || !cod_to.empty())
{
fl = current_cursor()->file(LF_NDITTE);
TRectype tr1(fl->curr());
TRectype tr2(fl->curr());
tr1.zero(); tr2.zero();
if (_sort == 1)
{
tr1.put("CODDITTA",cod_from);
tr2.put("CODDITTA",cod_to);
}
else
{
tr1.put("RAGSOC",cod_from);
tr2.put("RAGSOC",cod_to);
}
current_cursor()->setregion(cod_from.empty() ? NULL : &tr1,
cod_to.empty() ? NULL : &tr2);
}
break;
} }
else
{
cod_from = mask.get(_pr_what == anafis ? FLD_ANF_RAGSOCFR
: FLD_ANG_RAGSOCFR);
cod_to = mask.get(_pr_what == anafis ? FLD_ANF_RAGSOCTO
: FLD_ANG_RAGSOCTO);
}
{
fl = current_cursor()->file(LF_ANAG);
TRectype tr1(fl->curr());
TRectype tr2(fl->curr());
tr1.zero(); tr2.zero();
tr1.put("TIPOA", _pr_what == anafis ? "F" : "G");
tr2.put("TIPOA", _pr_what == anafis ? "F" : "G");
if (!cod_from.empty() || !cod_to.empty())
{
if (_sort == 1)
{
if (cod_from.not_empty())
{
tr1.put("CODANAGR",cod_from);
tr2.put("CODANAGR",cod_to);
}
}
else
{
if (cod_from.not_empty())
{
tr1.put("RAGSOC",cod_from);
tr2.put("RAGSOC",cod_to);
}
}
}
current_cursor()->setregion(tr1, tr2);
}
break;
case nditte:
select_cursor(cdit());
if (_sort == 1)
{
cod_from = mask.get(FLD_DITTE_CODFR);
cod_to = mask.get(FLD_DITTE_CODTO);
}
else
{
cod_from = mask.get(FLD_DITTE_RAGSOCFR);
cod_to = mask.get(FLD_DITTE_RAGSOCTO);
}
if (!cod_from.empty() || !cod_to.empty())
{
fl = current_cursor()->file(LF_NDITTE);
TRectype tr1(fl->curr());
TRectype tr2(fl->curr());
tr1.zero(); tr2.zero();
if (_sort == 1)
{
tr1.put("CODDITTA",cod_from);
tr2.put("CODDITTA",cod_to);
}
else
{
tr1.put("RAGSOC",cod_from);
tr2.put("RAGSOC",cod_to);
}
current_cursor()->setregion(tr1, tr2);
}
break;
}
// setup links and set headers // setup links and set headers
init_print(); init_print();
// enable_print_menu(); // enable_print_menu();
return TRUE; return TRUE;
} }
void BA6100_App::user_create() void BA6100_App::user_create()
{ {
TToken_string rxp(40); TToken_string rxp(40);
{ {
TProgind p(5, "Preparazione archivi\nPrego attendere", FALSE, TRUE, 30); TProgind p(5, "Preparazione archivi\nPrego attendere", FALSE, TRUE, 30);
// setup relation // setup relation
_rel_fis = new TRelation(LF_ANAG); _rel_fis = new TRelation(LF_ANAG);
_rel_giu = new TRelation(LF_ANAG); _rel_giu = new TRelation(LF_ANAG);
_rel_dit = new TRelation(LF_NDITTE); _rel_dit = new TRelation(LF_NDITTE);
p.addstatus(1); p.addstatus(1);
rxp.add("CODANAGR=CODANAGR"); rxp.add("CODANAGR=CODANAGR");
_rel_fis->add(LF_ANAGFIS,rxp); _rel_fis->add(LF_ANAGFIS,rxp);
_rel_giu->add(LF_ANAGGIU,rxp); _rel_giu->add(LF_ANAGGIU,rxp);
rxp.add("TIPOA=TIPOA"); rxp.add("TIPOA=TIPOA");
_rel_fis->add(LF_NDITTE, rxp, 4); _rel_fis->add(LF_NDITTE, rxp, 4);
_rel_giu->add(LF_NDITTE, rxp, 4); _rel_giu->add(LF_NDITTE, rxp, 4);
_rel_dit->add(LF_ANAG, rxp); _rel_dit->add(LF_ANAG, rxp);
p.addstatus(1); p.addstatus(1);
// add unloc & attiv // add unloc & attiv
rxp = "CODDITTA=CODDITTA"; rxp = "CODDITTA=CODDITTA";
_rel_fis->add(LF_ATTIV, rxp, 1, LF_NDITTE); _rel_fis->add(LF_ATTIV, rxp, 1, LF_NDITTE);
_rel_fis->add(LF_UNLOC, rxp, 1, LF_NDITTE); _rel_fis->add(LF_UNLOC, rxp, 1, LF_NDITTE);
_rel_giu->add(LF_ATTIV, rxp, 1, LF_NDITTE); _rel_giu->add(LF_ATTIV, rxp, 1, LF_NDITTE);
_rel_giu->add(LF_UNLOC, rxp, 1, LF_NDITTE); _rel_giu->add(LF_UNLOC, rxp, 1, LF_NDITTE);
_rel_dit->add(LF_ATTIV, rxp, 1); _rel_dit->add(LF_ATTIV, rxp, 1);
_rel_dit->add(LF_UNLOC, rxp, 1); _rel_dit->add(LF_UNLOC, rxp, 1);
_rel_fis->add(LF_SOCI, rxp, 1, LF_NDITTE); _rel_fis->add(LF_SOCI, rxp, 1, LF_NDITTE);
_rel_giu->add(LF_SOCI, rxp, 1, LF_NDITTE); _rel_giu->add(LF_SOCI, rxp, 1, LF_NDITTE);
_rel_dit->add(LF_SOCI, rxp, 1); _rel_dit->add(LF_SOCI, rxp, 1);
p.addstatus(1); p.addstatus(1);
_cfis1 = add_cursor(new TCursor(_rel_fis, "" , 1)); _cfis1 = add_cursor(new TCursor(_rel_fis, "" , 1));
_cgiu1 = add_cursor(new TCursor(_rel_giu, "" , 1)); _cgiu1 = add_cursor(new TCursor(_rel_giu, "" , 1));
_cdit1 = add_cursor(new TCursor(_rel_dit, "", 1)); _cdit1 = add_cursor(new TCursor(_rel_dit, "", 1));
_cfis2 = add_cursor(new TCursor(_rel_fis, "" , 2)); _cfis2 = add_cursor(new TCursor(_rel_fis, "" , 2));
_cgiu2 = add_cursor(new TCursor(_rel_giu, "" , 2)); _cgiu2 = add_cursor(new TCursor(_rel_giu, "" , 2));
_cdit2 = add_cursor(new TCursor(_rel_dit, "", 2)); _cdit2 = add_cursor(new TCursor(_rel_dit, "", 2));
p.addstatus(1); p.addstatus(1);
_comuni = new TLocalisamfile(LF_COMUNI); _comuni = new TLocalisamfile(LF_COMUNI);
// set translated field values // set translated field values
set_translation(LF_ANAGFIS,"STATCIV","1","Celibe/Nubile"); set_translation(LF_ANAGFIS,"STATCIV","1","Celibe/Nubile");
set_translation(LF_ANAGFIS,"STATCIV","2","Coniugato/a"); set_translation(LF_ANAGFIS,"STATCIV","2","Coniugato/a");
set_translation(LF_ANAGFIS,"STATCIV","3","Vedovo/a"); set_translation(LF_ANAGFIS,"STATCIV","3","Vedovo/a");
set_translation(LF_ANAGFIS,"STATCIV","4","Separato/a"); set_translation(LF_ANAGFIS,"STATCIV","4","Separato/a");
set_translation(LF_ANAGFIS,"STATCIV","5","Divorziato/a"); set_translation(LF_ANAGFIS,"STATCIV","5","Divorziato/a");
set_translation(LF_ANAGFIS,"STATCIV","6","Deceduto/a"); set_translation(LF_ANAGFIS,"STATCIV","6","Deceduto/a");
set_translation(LF_ANAGFIS,"STATCIV","7","Tutelato/a"); set_translation(LF_ANAGFIS,"STATCIV","7","Tutelato/a");
set_translation(LF_ANAGFIS,"STATCIV","8","Figlio/a minore"); set_translation(LF_ANAGFIS,"STATCIV","8","Figlio/a minore");
set_translation(LF_ANAGFIS,"TITSTU", "1" ,"Nessuno"); set_translation(LF_ANAGFIS,"TITSTU", "1" ,"Nessuno");
set_translation(LF_ANAGFIS,"TITSTU", "2" ,"Lic. Elem."); set_translation(LF_ANAGFIS,"TITSTU", "2" ,"Lic. Elem.");
set_translation(LF_ANAGFIS,"TITSTU", "3" ,"Lic. Media"); set_translation(LF_ANAGFIS,"TITSTU", "3" ,"Lic. Media");
set_translation(LF_ANAGFIS,"TITSTU", "4" ,"Diploma"); set_translation(LF_ANAGFIS,"TITSTU", "4" ,"Diploma");
set_translation(LF_ANAGFIS,"TITSTU", "5" ,"Laurea"); set_translation(LF_ANAGFIS,"TITSTU", "5" ,"Laurea");
set_translation(LF_ANAGFIS,"SESSO", "M", "Maschio"); set_translation(LF_ANAGFIS,"SESSO", "M", "Maschio");
set_translation(LF_ANAGFIS,"SESSO", "F", "Femmina"); set_translation(LF_ANAGFIS,"SESSO", "F", "Femmina");
set_translation(LF_NDITTE,"FREQVIVA","M","Mensile"); set_translation(LF_NDITTE,"FREQVIVA","M","Mensile");
set_translation(LF_NDITTE,"FREQVIVA","T","Trimestrale"); set_translation(LF_NDITTE,"FREQVIVA","T","Trimestrale");
set_translation(LF_NDITTE,"DATLAV","1","Si"); set_translation(LF_NDITTE,"DATLAV","1","Si");
set_translation(LF_NDITTE,"DATLAV","2","No"); set_translation(LF_NDITTE,"DATLAV","2","No");
set_translation(LF_NDITTE,"DATLAV","3","Lavoro Agricolo"); set_translation(LF_NDITTE,"DATLAV","3","Lavoro Agricolo");
set_translation(LF_NDITTE,"STATOSOC","1","Normale attivita'"); set_translation(LF_NDITTE,"STATOSOC","1","Normale attivita'");
set_translation(LF_NDITTE,"STATOSOC","2","Liquidazione cessata attivita'"); set_translation(LF_NDITTE,"STATOSOC","2","Liquidazione cessata attivita'");
set_translation(LF_NDITTE,"STATOSOC","3", set_translation(LF_NDITTE,"STATOSOC","3",
"Fallimento o Liquidazione coatta amm."); "Fallimento o Liquidazione coatta amm.");
set_translation(LF_NDITTE,"STATOSOC","4","Estinto"); set_translation(LF_NDITTE,"STATOSOC","4","Estinto");
set_translation(LF_ANAGGIU,"STATOSOC","1","Normale attivita'"); set_translation(LF_ANAGGIU,"STATOSOC","1","Normale attivita'");
set_translation(LF_ANAGGIU,"STATOSOC","2","Liquidazione cessata attivita'"); set_translation(LF_ANAGGIU,"STATOSOC","2","Liquidazione cessata attivita'");
set_translation(LF_ANAGGIU,"STATOSOC","3", set_translation(LF_ANAGGIU,"STATOSOC","3",
"Fallimento o Liquidazione coatta amm."); "Fallimento o Liquidazione coatta amm.");
set_translation(LF_ANAGGIU,"STATOSOC","4","Estinto"); set_translation(LF_ANAGGIU,"STATOSOC","4","Estinto");
set_translation(LF_ANAGGIU,"SITSOC","1","Inizio"); set_translation(LF_ANAGGIU,"SITSOC","1","Inizio");
set_translation(LF_ANAGGIU,"SITSOC","2","Liquidazione"); set_translation(LF_ANAGGIU,"SITSOC","2","Liquidazione");
set_translation(LF_ANAGGIU,"SITSOC","3","Termine liquidazione"); set_translation(LF_ANAGGIU,"SITSOC","3","Termine liquidazione");
set_translation(LF_ANAGGIU,"SITSOC","4","Estinzione"); set_translation(LF_ANAGGIU,"SITSOC","4","Estinzione");
set_translation(LF_ANAGGIU,"SITSOC","5","Trasf. IRPEG"); set_translation(LF_ANAGGIU,"SITSOC","5","Trasf. IRPEG");
set_translation(LF_ANAGGIU,"SITSOC","6","Normale"); set_translation(LF_ANAGGIU,"SITSOC","6","Normale");
set_fillchar('_'); set_fillchar('_');
set_wait_threshold(0); set_wait_threshold(0);
p.addstatus(1); p.addstatus(1);
} }
} }
void BA6100_App::user_destroy() void BA6100_App::user_destroy()

View File

@ -183,7 +183,7 @@ bool BA6200_application::set_print(int)
a.put(COM_STATO,statofine); a.put(COM_STATO,statofine);
a.put(COM_COM ,codicefine); a.put(COM_COM ,codicefine);
current_cursor()->setregion(&da, &a); current_cursor()->setregion(da, a);
} }
else else
if (scelta == 2) if (scelta == 2)
@ -207,7 +207,7 @@ bool BA6200_application::set_print(int)
a.put (COM_DENCOM, denomfine); a.put (COM_DENCOM, denomfine);
current_cursor()->setregion(&da, &a); current_cursor()->setregion(da, a);
} }
//set_print_zero(); //set_print_zero();

View File

@ -288,14 +288,13 @@ HIDDEN bool sottoc_handler(TMask_field& f, KEY key)
{ {
if (key == K_TAB) if (key == K_TAB)
{ {
TString gruppo(f.mask().get(FLD_CM1_GRUPPO)); int gruppo = f.mask().get_int(FLD_CM1_GRUPPO);
if (gruppo.empty()) return TRUE; if (gruppo == 0) return TRUE;
TString conto(f.mask().get(FLD_CM1_CONTO)); int conto = f.mask().get_int(FLD_CM1_CONTO);
TString sottoconto(f.mask().get(FLD_CM1_SOTTOCONTO)); long sottoconto = f.mask().get_long(FLD_CM1_SOTTOCONTO);
if (sottoconto.not_empty() && conto.empty()) return f.error_box("Manca il CONTO"); if (sottoconto != 0 && conto == 0) return f.error_box("Manca il CONTO");
dispatch_e_char(f.parent(), K_AUTO_ENTER); f.mask().stop_run(K_AUTO_ENTER);
} }
return TRUE; return TRUE;
} }

View File

@ -50,7 +50,7 @@ HIDDEN bool key_handler (TMask_field& f, KEY k)
if (m.get(F_ANNO).not_empty() && m.get(F_CODATT).not_empty() && if (m.get(F_ANNO).not_empty() && m.get(F_CODATT).not_empty() &&
m.get(F_CODCF).not_empty()) m.get(F_CODCF).not_empty())
m.send_key(K_AUTO_ENTER, 0); m.stop_run(K_AUTO_ENTER);
} }
return TRUE; return TRUE;
} }

View File

@ -2813,9 +2813,9 @@ bool CG1500_application::set_print(int)
_cur->setkey(3); _cur->setkey(3);
if (_situazione.not_empty()) if (_situazione.not_empty())
_cur->filter(format("TIPOCF = \"%s\"",(const char*)_situazione)); _cur->setfilter(format("TIPOCF = \"%s\"",(const char*)_situazione));
else else
_cur->filter(""); _cur->setfilter("");
_prog = new TProgind(_cur->items(),"Elaborazione in corso... prego attendere",FALSE); _prog = new TProgind(_cur->items(),"Elaborazione in corso... prego attendere",FALSE);

File diff suppressed because it is too large Load Diff

View File

@ -996,7 +996,7 @@ bool CG3200_application::set_print(int)
a.put(PCN_CONTO,contofine); a.put(PCN_CONTO,contofine);
a.put(PCN_SOTTOCONTO,sottocontofine); a.put(PCN_SOTTOCONTO,sottocontofine);
current_cursor()->setregion(&da, &a); current_cursor()->setregion(da, a);
} }
else else
{ {
@ -1026,7 +1026,7 @@ bool CG3200_application::set_print(int)
a.put(CLI_CONTO,contofine); a.put(CLI_CONTO,contofine);
a.put(CLI_CODCF,sottocontofine); a.put(CLI_CODCF,sottocontofine);
current_cursor()->setregion(&da, &a); current_cursor()->setregion(da, a);
} }
if (_stampatotiva) if (_stampatotiva)
@ -1280,6 +1280,81 @@ void CG3200_application::calcola_progressivi_al()
void CG3200_application::calcola_progressivi() void CG3200_application::calcola_progressivi()
{ {
<<<<<<< cg3200.cpp
TLocalisamfile pconti(LF_PCON);
TLocalisamfile saldi (LF_SALDI);
real pdaresca,paveresca,pdarescap,paverescap;
real progdare_attuale,progavere_attuale,progdare_prec,progavere_prec;
real saldo,progredare_eseprec,progreavere_eseprec,pdarep,paverep;
int indbil;
char salini;
TRectype record(saldi.curr());
saldo = 0.00;
pdarep = 0.00;
paverep = 0.00;
pdaresca = 0.00;
paveresca = 0.00;
pdarescap = 0.00;
paverescap = 0.00;
// Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto
// uguali a quelli di rmov per il calcolo dei progressivi precedenti
record.zero();
record.put(SLD_GRUPPO, _gruppo);
record.put(SLD_CONTO, _conto);
record.put(SLD_SOTTOCONTO, _sottoc);
if (_ricerca == 'P')
indbil = atoi (current_cursor()->file(LF_PCON)->get(PCN_INDBIL));
else
{
if ((_ricerca == 'C') || (_ricerca == 'F'))
{
pconti.setkey(1);
pconti.zero();
pconti.put(PCN_GRUPPO, _gruppo);
pconti.put(PCN_CONTO , _conto);
pconti.read();
if (pconti.good())
indbil = atoi (pconti.get(PCN_INDBIL));
else
indbil = 0;
}
}
saldi.setkey(2);
saldi.zero();
saldi.put(SLD_GRUPPO, _gruppo);
saldi.put(SLD_CONTO, _conto);
saldi.put(SLD_SOTTOCONTO, _sottoc);
for ( saldi.read();
((saldi.curr()==record) && !saldi.eof());
saldi.next())
{
long annoes_saldi = saldi.curr().get_long(SLD_ANNOES);
//Calcola i progressivi dell'esercizio attuale
if (annoes_saldi == _annomsk)
{
pdaresca = saldi.curr().get_real(SLD_PDARESCA);
paveresca = saldi.curr().get_real(SLD_PAVERESCA);
saldo = saldi.curr().get_real(SLD_SALDO);
salini = saldi.curr().get(SLD_FLAGSALINI)[0];
}
//Calcola i progressivi dell'esercizio precedente
if (annoes_saldi == _annoesmsk)
{
pdarescap = saldi.curr().get_real(SLD_PDARESCA);
pdarep = saldi.curr().get_real(SLD_PDARE);
paverescap = saldi.curr().get_real(SLD_PAVERESCA);
paverep = saldi.curr().get_real(SLD_PAVERE);
=======
TLocalisamfile pconti(LF_PCON); TLocalisamfile pconti(LF_PCON);
TLocalisamfile saldi (LF_SALDI); TLocalisamfile saldi (LF_SALDI);
real pdaresca,paveresca,pdarescap,paverescap; real pdaresca,paveresca,pdarescap,paverescap;
@ -1353,6 +1428,7 @@ void CG3200_application::calcola_progressivi()
pdarep = saldi.curr().get_real(SLD_PDARE); pdarep = saldi.curr().get_real(SLD_PDARE);
paverescap = saldi.curr().get_real(SLD_PAVERESCA); paverescap = saldi.curr().get_real(SLD_PAVERESCA);
paverep = saldi.curr().get_real(SLD_PAVERE); paverep = saldi.curr().get_real(SLD_PAVERE);
>>>>>>> 1.2
// Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che // Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che
// quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere // quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@
void CG4300_App::user_create() void CG4300_App::user_create()
{ {
TProgind pnd(3,"Preparazione archivi\nPrego attendere", TProgind pnd(3,"Preparazione archivi\nPrego attendere",
FALSE, TRUE, 30); FALSE, TRUE, 30);
_nditte = new TRelation(LF_NDITTE); _nditte = new TRelation(LF_NDITTE);
_nditte->add(LF_ATTIV,"CODDITTA=CODDITTA"); _nditte->add(LF_ATTIV,"CODDITTA=CODDITTA");
@ -18,25 +18,25 @@ void CG4300_App::user_create()
_att_r = &(_nditte->curr(LF_ATTIV)); _att_r = &(_nditte->curr(LF_ATTIV));
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte", _ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte",
"@1|Cod.@5|Ragione Sociale@50|Vers."); "@1|Cod.@5|Ragione Sociale@50|Vers.");
_n_ditte = 0l; _n_ditte = 0l;
pnd.addstatus(1); pnd.addstatus(1);
for (_nditte->first(); !_nditte->eof(); _nditte->next()) for (_nditte->first(); !_nditte->eof(); _nditte->next())
{ {
TString cod = _nditte_r->get("CODDITTA"); TString cod = _nditte_r->get("CODDITTA");
TString vers = _nditte_r->get("FREQVIVA"); TString vers = _nditte_r->get("FREQVIVA");
_n_ditte++; _n_ditte++;
TToken_string* d = new TToken_string(" "); TToken_string* d = new TToken_string(" ");
// add record // add record
d->add(cod); d->add(cod);
d->add(_nditte_r->get("RAGSOC")); d->add(_nditte_r->get("RAGSOC"));
d->add(vers); d->add(vers);
_nomiditte.add(d); _nomiditte.add(d);
} }
pnd.addstatus(1); pnd.addstatus(1);
@ -155,51 +155,51 @@ bool CG4300_App::set_print(int n)
_descr_arr.destroy(); _descr_arr.destroy();
switch(n) switch(n)
{
case 1: // liquidazione
_isprint = TRUE;
if (set_liquidazione())
{ {
case 1: // liquidazione if (_selected.ones() > 0l)
_isprint = TRUE; {
if (set_liquidazione()) if (_year != yy)
{ {
if (_selected.ones() > 0l) TString cond(format("ANNOES=%s",(const char*)_year));
{ _cur->setfilter(cond);
if (_year != yy) }
{ recalc_all();
TString cond(format("ANNOES=%s",(const char*)_year)); return _isprint;
_cur->filter(cond); }
} else warning_box("Nessuna ditta selezionata!");
recalc_all();
return _isprint;
}
else warning_box("Nessuna ditta selezionata!");
}
break;
case 2: // estrazione deleghe
_isprint = FALSE;
if (set_deleghe())
{
if (_year != yy)
{
TString cond(format("ANNOES=%s",(const char*)_year));
_cur->filter(cond);
}
extract_deleghe();
return FALSE;
}
break;
case 3: // calcolo acconto
_isprint = TRUE;
if (set_acconto())
{
if (_year != yy)
{
TString cond(format("ANNOES=%s",(const char*)_year));
_cur->filter(cond);
}
recalc_acconti();
return _isprint;
}
break;
} }
break;
case 2: // estrazione deleghe
_isprint = FALSE;
if (set_deleghe())
{
if (_year != yy)
{
TString cond(format("ANNOES=%s",(const char*)_year));
_cur->setfilter(cond);
}
extract_deleghe();
return FALSE;
}
break;
case 3: // calcolo acconto
_isprint = TRUE;
if (set_acconto())
{
if (_year != yy)
{
TString cond(format("ANNOES=%s",(const char*)_year));
_cur->setfilter(cond);
}
recalc_acconti();
return _isprint;
}
break;
}
return FALSE; return FALSE;
} }
@ -225,11 +225,11 @@ bool CG4300_App::set_liquidazione()
_month = atoi(m.get(CG43_LST_MESE)); _month = atoi(m.get(CG43_LST_MESE));
if (_what == all) if (_what == all)
{ {
if (_month != 3 && _month != 6 && _month != 9 && if (_month != 3 && _month != 6 && _month != 9 &&
_month != 12 && _month != 13) _month != 12 && _month != 13)
_what = mnt; _what = mnt;
} }
else if (_what == quarter) else if (_what == quarter)
_month = atoi(m.get(CG43_LST_TRIM)); _month = atoi(m.get(CG43_LST_TRIM));
@ -253,66 +253,66 @@ bool CG4300_App::set_liquidazione()
long j, cnt, chk; int i; long j, cnt, chk; int i;
switch(k) switch(k)
{
case DLG_SELECT:
// build sheet
_ditte->destroy(); chk = 0l;
for (i = 0; i < _nomiditte.items(); i++)
{ {
case DLG_SELECT: if (_selected[i]) continue;
// build sheet TToken_string d = (const char*)((TToken_string&)_nomiditte[i]);
_ditte->destroy(); chk = 0l; TString cod = d.get(0);
for (i = 0; i < _nomiditte.items(); i++) TString vers = d.get(2);
{ if ((_what == mnt && vers == "T") ||
if (_selected[i]) continue; (_what == quarter && vers == "M"))
TToken_string d = (const char*)((TToken_string&)_nomiditte[i]); continue;
TString cod = d.get(0);
TString vers = d.get(2);
if ((_what == mnt && vers == "T") ||
(_what == quarter && vers == "M"))
continue;
_ditte->add(d); _ditte->add(d);
// check // check
if (!from.empty() || !to.empty()) if (!from.empty() || !to.empty())
{ {
if (from.empty()) from = "0"; if (from.empty()) from = "0";
if (to.empty()) to = "999999999"; if (to.empty()) to = "999999999";
if (atol(cod) >= atol(from) && atol(cod) <= atol(to)) if (atol(cod) >= atol(from) && atol(cod) <= atol(to))
_ditte->check(chk++); _ditte->check(chk++);
} }
}
// seleziona e aggiungi alle gia' selezionate
if (_ditte->run() == K_ENTER)
{
cnt = 0;
for (j = 0l; j < _n_ditte; j++)
{
if (_selected[j]) continue;
if (_ditte->checked(cnt++))
selected.set(j);
}
_selected |= selected;
selected.reset();
}
m.field(CG43_FLD_SELECTED).set(format("%ld",(long)_selected.ones()));
break;
case CG43_BUT_ANN:
_selected.reset();
m.field(CG43_FLD_SELECTED).set("0");
break;
case CG43_BUT_CHK:
{
_ditte->destroy();
for (i = 0; i < _nomiditte.items(); i++)
{
TToken_string d = (const char*)((TToken_string&)_nomiditte[i]);
_ditte->add(d);
if (_selected[i]) _ditte->check(i);
}
_ditte->disable_check();
_ditte->run();
_ditte->enable_check();
}
break;
} }
// seleziona e aggiungi alle gia' selezionate
if (_ditte->run() == K_ENTER)
{
cnt = 0;
for (j = 0l; j < _n_ditte; j++)
{
if (_selected[j]) continue;
if (_ditte->checked(cnt++))
selected.set(j);
}
_selected |= selected;
selected.reset();
}
m.field(CG43_FLD_SELECTED).set(format("%ld",(long)_selected.ones()));
break;
case CG43_BUT_ANN:
_selected.reset();
m.field(CG43_FLD_SELECTED).set("0");
break;
case CG43_BUT_CHK:
{
_ditte->destroy();
for (i = 0; i < _nomiditte.items(); i++)
{
TToken_string d = (const char*)((TToken_string&)_nomiditte[i]);
_ditte->add(d);
if (_selected[i]) _ditte->check(i);
}
_ditte->disable_check();
_ditte->run();
_ditte->enable_check();
}
break;
}
} }
while (k != K_ENTER && k != K_ESC); while (k != K_ENTER && k != K_ESC);

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.4 1994-08-26 13:07:14 guy Exp $ // $Id: maskfld.cpp,v 1.5 1994-08-26 14:05:29 alex Exp $
#include <xvt.h> #include <xvt.h>
#include <applicat.h> #include <applicat.h>
@ -1160,7 +1160,8 @@ int TBrowse::do_input(bool filter)
else work << _filter[i]; else work << _filter[i];
} }
const char* w = work.empty() ? NULL : (const char*) work; _cursor->setfilter(work);
_cursor->setregion(filtrec, filtrec);
if (filtrec.empty()) _cursor->filter(w); if (filtrec.empty()) _cursor->filter(w);
else _cursor->filter(w, &filtrec, &filtrec); else _cursor->filter(w, &filtrec, &filtrec);

View File

@ -718,7 +718,7 @@ bool TSpreadsheet::on_key(KEY k)
{ {
switch(k) switch(k)
{ {
case K_SHIFT_ENTER: case K_CTRL_ENTER:
case K_ESC: case K_ESC:
mask().send_key(k, 0); mask().send_key(k, 0);
return TRUE; return TRUE;

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.3 1994-08-23 13:52:26 guy Exp $ // $Id: relapp.cpp,v 1.4 1994-08-26 14:05:47 alex Exp $
#include <mailbox.h> #include <mailbox.h>
#include <sheet.h> #include <sheet.h>
#include <urldefid.h> #include <urldefid.h>
@ -829,7 +829,8 @@ bool TRelation_application::filter()
if (campo != NULL) if (campo != NULL)
campo->write(t.mid(u+1), rec); campo->write(t.mid(u+1), rec);
} }
cur->filter("", &rec, &rec); cur->setfilter("");
cur->setregion(rec, rec);
if (s == NULL) id = 0; if (s == NULL) id = 0;
} }
} }

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.4 1994-08-24 07:24:04 villa Exp $ // $Id: relation.cpp,v 1.5 1994-08-26 14:06:00 alex Exp $
// relation.cpp // relation.cpp
// fv 12/8/93 // fv 12/8/93
// relation class for isam files // relation class for isam files
@ -845,7 +845,8 @@ TRecnotype TCursor::update()
} }
void TCursor::filter(const char* filter, TRectype *from, TRectype* to) void TCursor::filter(const char* filter, const TRectype *from,
const TRectype* to)
{ {
CHECK(!_frozen, "Impossibile filtrare un cursore congelato"); CHECK(!_frozen, "Impossibile filtrare un cursore congelato");

View File

@ -1,4 +1,4 @@
/* $Id: relation.h,v 1.1.1.1 1994-08-12 10:52:02 alex Exp $ */ /* $Id: relation.h,v 1.2 1994-08-26 14:06:07 alex Exp $ */
// join.h // join.h
// fv 12/8/93 // fv 12/8/93
// join class for isam files // join class for isam files
@ -19,124 +19,124 @@
class TRelation : public TObject class TRelation : public TObject
{ {
friend class TRelationdef; friend class TRelationdef;
// class TRelation : public TLocalisamfile // class TRelation : public TLocalisamfile
// @END // @END
// @DPRIV // @DPRIV
TToken_string _status; // stato della relazione TToken_string _status; // stato della relazione
TArray _files; // file descriptors TArray _files; // file descriptors
TArray _reldefs; // TRelationdef array TArray _reldefs; // TRelationdef array
int _errors; int _errors;
// @END // @END
// @FPROT // @FPROT
protected: protected:
virtual void print_on(ostream& out) const; virtual void print_on(ostream& out) const;
int log2ind(int logicnum) const; int log2ind(int logicnum) const;
int alias2ind(byte alias) const; int alias2ind(byte alias) const;
int name2ind(const char* name) const; int name2ind(const char* name) const;
TRelationdef* reldef(int i) const { return (TRelationdef*)&_reldefs[i]; } TRelationdef* reldef(int i) const { return (TRelationdef*)&_reldefs[i]; }
TLocalisamfile* file(int i = 0) const { return (TLocalisamfile*)&_files[i]; } TLocalisamfile* file(int i = 0) const { return (TLocalisamfile*)&_files[i]; }
// @LONGDES // @LONGDES
// position_rels fa tutto il lavoro: se non trova un record // position_rels fa tutto il lavoro: se non trova un record
// adatto su un file, svuota il record corrente e non ritorna errore. // adatto su un file, svuota il record corrente e non ritorna errore.
// write etc. poi procedono normalmente // write etc. poi procedono normalmente
// @END // @END
int position_rels(TIsamop op = _isequal, TReclock lockop = _nolock, TDate& atdate = botime, int first = 0); int position_rels(TIsamop op = _isequal, TReclock lockop = _nolock, TDate& atdate = botime, int first = 0);
friend class TCursor; friend class TCursor;
public: public:
// @FPUB // @FPUB
int update() { return position_rels(_isequal, _nolock);} int update() { return position_rels(_isequal, _nolock);}
void zero(); void zero();
virtual int next(TReclock lockop = _nolock) { return file()->next(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); } virtual int next(TReclock lockop = _nolock) { return file()->next(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int prev(TReclock lockop = _nolock) { return file()->prev(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); } virtual int prev(TReclock lockop = _nolock) { return file()->prev(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int next(TDate& atdate) { return file()->next(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file()->status(); } virtual int next(TDate& atdate) { return file()->next(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file()->status(); }
virtual int prev(TDate& atdate) { return file()->prev(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file()->status(); } virtual int prev(TDate& atdate) { return file()->prev(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file()->status(); }
virtual int first(TReclock lockop = _nolock) { return file()->first(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); } virtual int first(TReclock lockop = _nolock) { return file()->first(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int last(TReclock lockop = _nolock) { return file()->last(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); } virtual int last(TReclock lockop = _nolock) { return file()->last(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return file()->skip(nrec, lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); } virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return file()->skip(nrec, lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = botime) { return file()->read(op, lockop, atdate) == NOERR ? position_rels(_isequal, lockop, atdate) : file()->status();} virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = botime) { return file()->read(op, lockop, atdate) == NOERR ? position_rels(_isequal, lockop, atdate) : file()->status();}
TLocalisamfile* lfile(int logicnum = 0) const; TLocalisamfile* lfile(int logicnum = 0) const;
TLocalisamfile* lfile(const char* name) const; TLocalisamfile* lfile(const char* name) const;
void write_enable(int logicnum = -1, const bool on = TRUE) ; void write_enable(int logicnum = -1, const bool on = TRUE) ;
void write_enable(const char* name, const bool on = TRUE) ; void write_enable(const char* name, const bool on = TRUE) ;
void write_disable(int logicnum = -1) { write_enable(logicnum, FALSE); } void write_disable(int logicnum = -1) { write_enable(logicnum, FALSE); }
void write_disable(const char* name) { write_enable(name, FALSE); } void write_disable(const char* name) { write_enable(name, FALSE); }
TRectype& curr(int logicnum = 0) const { return lfile(logicnum)->curr(); } TRectype& curr(int logicnum = 0) const { return lfile(logicnum)->curr(); }
// next_match for 0ne-to-many relations; positions logicnum (!= main) // next_match for 0ne-to-many relations; positions logicnum (!= main)
// on next matching record; returns TRUE or FALSE if no more matches; in // on next matching record; returns TRUE or FALSE if no more matches; in
// any case relation is kept consistent except when inconsistent in // any case relation is kept consistent except when inconsistent in
// first place // first place
bool next_match(int logicnum, const char* fieldlist = NULL, int nkey = 0); bool next_match(int logicnum, const char* fieldlist = NULL, int nkey = 0);
// @DES add relation // @DES add relation
// @FPUB // @FPUB
bool add(int logicnum, const char* relexprs, int key = 1, bool add(int logicnum, const char* relexprs, int key = 1,
int linkto = 0, byte alias = 0, bool allow_lock = FALSE); int linkto = 0, byte alias = 0, bool allow_lock = FALSE);
bool add(const char* tabname, const char* relexprs, int key = 1, bool add(const char* tabname, const char* relexprs, int key = 1,
int linkto = 0, byte alias = 0, bool allow_lock = FALSE); int linkto = 0, byte alias = 0, bool allow_lock = FALSE);
// @DES write methods // @DES write methods
// @FPUB // @FPUB
virtual int write (bool force = TRUE, TDate& atdate = botime); virtual int write (bool force = TRUE, TDate& atdate = botime);
virtual int rewrite(bool force = TRUE, TDate& atdate = botime); virtual int rewrite(bool force = TRUE, TDate& atdate = botime);
virtual int remove (TDate& atdate = botime); virtual int remove (TDate& atdate = botime);
// @DES checking methods // @DES checking methods
// @FPUB // @FPUB
bool eof( int logicnum = 0) { return lfile(logicnum)->eof(); } bool eof( int logicnum = 0) { return lfile(logicnum)->eof(); }
bool bof( int logicnum = 0) { return lfile(logicnum)->bof(); } bool bof( int logicnum = 0) { return lfile(logicnum)->bof(); }
// @N // @N
// status(), good() and bad() return the status of the relation when called // status(), good() and bad() return the status of the relation when called
// with no args, or the status of the file when called with // with no args, or the status of the file when called with
// a logical number // a logical number
// @END // @END
bool status(int logicnum = 0) { return lfile(logicnum)->status(); } bool status(int logicnum = 0) { return lfile(logicnum)->status(); }
bool good( int logicnum = 0) { return lfile(logicnum)->good(); } bool good( int logicnum = 0) { return lfile(logicnum)->good(); }
bool bad( int logicnum = 0) { return lfile(logicnum)->bad(); } bool bad( int logicnum = 0) { return lfile(logicnum)->bad(); }
bool empty( int logicnum = 0) { return lfile(logicnum)->empty(); } bool empty( int logicnum = 0) { return lfile(logicnum)->empty(); }
// @END // @END
// @LONGDES // @LONGDES
// isconsistent() returns TRUE if every file in the relation is // isconsistent() returns TRUE if every file in the relation is
// OK, current record is non-empty, and relation is consistent. // OK, current record is non-empty, and relation is consistent.
// If it's not and reset is TRUE, it tries to reset the relation // If it's not and reset is TRUE, it tries to reset the relation
// to a consistent state (based on main record) -- no further check // to a consistent state (based on main record) -- no further check
// is done. // is done.
// Also called internally by update and remove. // Also called internally by update and remove.
// @END // @END
bool isconsistent(bool reset = FALSE); bool isconsistent(bool reset = FALSE);
// TRUE se c'e' un record ed e' il primo match (non si e' mai fatta // TRUE se c'e' un record ed e' il primo match (non si e' mai fatta
// position_rels) // position_rels)
bool is_first_match(int logicnum); bool is_first_match(int logicnum);
void save_status () ; void save_status () ;
void restore_status () ; void restore_status () ;
// @DES positioning operators. return status // @DES positioning operators. return status
// @FPUB // @FPUB
TRecnotype operator +=(const TRecnotype npos) { return skip(npos); } TRecnotype operator +=(const TRecnotype npos) { return skip(npos); }
TRecnotype operator -=(const TRecnotype npos) { return skip(-npos); } TRecnotype operator -=(const TRecnotype npos) { return skip(-npos); }
TRecnotype operator ++() { return next(); } TRecnotype operator ++() { return next(); }
TRecnotype operator --() { return prev(); } TRecnotype operator --() { return prev(); }
TRelation(int logicnum, bool linkrecinst = TRUE); TRelation(int logicnum, bool linkrecinst = TRUE);
TRelation(const char* tabname, bool linkrecinst = TRUE); TRelation(const char* tabname, bool linkrecinst = TRUE);
virtual ~TRelation(); virtual ~TRelation();
}; };
// @C // @C
@ -150,81 +150,83 @@ typedef bool (*FILTERFUNCTION)(const TRelation* r);
class TCursor : public TObject class TCursor : public TObject
{ {
// @DPRIV // @DPRIV
TRelation* _if; TRelation* _if;
int _nkey; int _nkey;
TRecnotype _pos; // Posizione corrente TRecnotype _pos; // Posizione corrente
TRecnotype _totrec; TRecnotype _totrec;
TRecnotype _lastrec; TRecnotype _lastrec;
TRecnotype _lastkrec; TRecnotype _lastkrec;
TFilename _filename; TFilename _filename;
TString _filter; // Filtro TString _filter; // Filtro
TString _keyfrom; // chiave iniziale TString _keyfrom; // chiave iniziale
TString _keyto; // chiave finale TString _keyto; // chiave finale
TExpression* _fexpr; // Espressione relativo filtro TExpression* _fexpr; // Espressione relativo filtro
bool _frozen; bool _frozen;
FILTERFUNCTION _filterfunction; FILTERFUNCTION _filterfunction;
TFilename _indexname; TFilename _indexname;
// @END // @END
// @FPRIV // @FPRIV
virtual TRecnotype buildcursor(TRecnotype rp); virtual TRecnotype buildcursor(TRecnotype rp);
int filtercursor(int pagecnt, TRecnotype* page); int filtercursor(int pagecnt, TRecnotype* page);
bool changed(); bool changed();
FILE* open_index(bool create = FALSE) const; FILE* open_index(bool create = FALSE) const;
TRecnotype update(); TRecnotype update();
protected: protected:
TRecnotype readrec(); TRecnotype readrec();
void filter(const char* filter, const TRectype* from = NULL,
const TRectype* to = NULL);
public: public:
// @FPUB // @FPUB
TRecnotype operator =(const TRecnotype nr); // Assegnazione TRecnotype operator =(const TRecnotype nr); // Assegnazione
TCursor& operator +=(const TRecnotype nr); // Scorri avanti TCursor& operator +=(const TRecnotype nr); // Scorri avanti
TCursor& operator -=(const TRecnotype nr); // Scorri indietro TCursor& operator -=(const TRecnotype nr); // Scorri indietro
TCursor& operator ++(); // Avanti di un record TCursor& operator ++(); // Avanti di un record
TCursor& operator --(); // Indietro di un record TCursor& operator --(); // Indietro di un record
TRecnotype pos() const { return _pos; } TRecnotype pos() const { return _pos; }
TRecnotype items(); TRecnotype items();
TRecnotype size() const { return file()->eod(); } TRecnotype size() const { return file()->eod(); }
const TString& from() const { return _keyfrom; } const TString& from() const { return _keyfrom; }
const TString& to() const { return _keyto; } const TString& to() const { return _keyto; }
TRectype& curr(int log = 0) const { return _if->curr(log); } TRectype& curr(int log = 0) const { return _if->curr(log); }
TRectype& curr(const char * tab) const TRectype& curr(const char * tab) const
{ return _if->lfile(tab)->curr(); } { return _if->lfile(tab)->curr(); }
TRecnotype read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = botime); TRecnotype read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = botime);
virtual bool ok() const; virtual bool ok() const;
void filter(const char* filter, TRectype* from = NULL, TRectype* to = NULL); const char* filter() const { return _filter; }
const char* filter() const { return _filter; } void freeze(bool on = TRUE) { _frozen = on; }
void freeze(bool on = TRUE) { _frozen = on; } bool frozen() const { return _frozen; }
bool frozen() const { return _frozen; } void setfilter(const char* filter_expr) { filter(filter_expr); }
void setregion(TRectype* from = NULL, TRectype* to = NULL) void setregion(const TRectype& from, const TRectype& to)
{ filter(NULL,from,to); } { filter(NULL,&from, &to); }
TRelation* relation() const { return _if; } TRelation* relation() const { return _if; }
TLocalisamfile* file(int lnum = 0) const { return _if->lfile(lnum); } TLocalisamfile* file(int lnum = 0) const { return _if->lfile(lnum); }
TLocalisamfile* file(const char* name) const { return _if->lfile(name); } TLocalisamfile* file(const char* name) const { return _if->lfile(name); }
int repos() { return _if->position_rels(); } int repos() { return _if->position_rels(); }
void setkey() { file()->setkey(_nkey); } void setkey() { file()->setkey(_nkey); }
void setkey(int nkey); void setkey(int nkey);
int key() const { return _nkey; } int key() const { return _nkey; }
bool next_match(int lognum, const char* fl = NULL, int nk = 0); bool next_match(int lognum, const char* fl = NULL, int nk = 0);
bool is_first_match(int ln); bool is_first_match(int ln);
void set_filterfunction(FILTERFUNCTION ff) { _filterfunction = ff; _lastrec = 0L;} void set_filterfunction(FILTERFUNCTION ff) { _filterfunction = ff; _lastrec = 0L;}
bool has_filter() const { return _filter.not_empty() || _filterfunction; } bool has_filter() const { return _filter.not_empty() || _filterfunction; }
void save_status () { _if->save_status(); } void save_status () { _if->save_status(); }
void restore_status () { _if->restore_status(); } void restore_status () { _if->restore_status(); }
TCursor(TRelation* f, const char* filter = "", int key = 1, TRectype* from = NULL, TRectype* to = NULL); TCursor(TRelation* f, const char* filter = "", int key = 1, TRectype* from = NULL, TRectype* to = NULL);
virtual ~TCursor(); virtual ~TCursor();
}; };
@ -234,33 +236,33 @@ class TCursor : public TObject
class TFieldref : public TObject class TFieldref : public TObject
{ {
// @DPRIV // @DPRIV
short _fileid; // Numero del file short _fileid; // Numero del file
TString16 _id; // Nome tabella o stringa col numero del file TString16 _id; // Nome tabella o stringa col numero del file
TString16 _name; // Nome del campo TString16 _name; // Nome del campo
int _from, _to; // Substring int _from, _to; // Substring
protected: protected:
virtual void print_on(ostream& out) const; virtual void print_on(ostream& out) const;
public: public:
// @FPUB // @FPUB
TFieldref(); TFieldref();
TFieldref(const TString&, short defid); TFieldref(const TString&, short defid);
TFieldref& operator =(const TString& s); // Operatore di assegnazione TFieldref& operator =(const TString& s); // Operatore di assegnazione
virtual bool ok() const { return _name.not_empty(); } // Vero se il numero del file e' valido virtual bool ok() const { return _name.not_empty(); } // Vero se il numero del file e' valido
int file() const { return _fileid; } // ritorna il file int file() const { return _fileid; } // ritorna il file
const char* name() const { return (const char*) _name; } // ritorna il nome del campo const char* name() const { return (const char*) _name; } // ritorna il nome del campo
int from() const { return _from; } int from() const { return _from; }
int to() const { return _to; } int to() const { return _to; }
int len(TRectype &rec) const; int len(TRectype &rec) const;
const char* read(const TRelation* = NULL) const; const char* read(const TRelation* = NULL) const;
const char* read(const TRectype&) const; const char* read(const TRectype&) const;
void write(const char* val, TRelation* = NULL) const; void write(const char* val, TRelation* = NULL) const;
void write(const char* val, TRectype& rec) const; void write(const char* val, TRectype& rec) const;
}; };
// Converte una stringa in numero logico o numero tabella // Converte una stringa in numero logico o numero tabella
int name2log(const char* name); int name2log(const char* name);