Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Stampa ben. per sezione: possibile ora la scelta tra sezione che ha attribuito e sezione di appartenenza attuale


git-svn-id: svn://10.65.10.50/trunk@7262 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1998-10-16 14:16:13 +00:00
parent fc42bcbfbd
commit 02b70cf749
3 changed files with 122 additions and 16 deletions

View File

@ -21,16 +21,19 @@
class TStampaBenemerenze : public TPrintapp
{
TLocalisamfile* _sezioni;
TRelation* _rel;
TMask* _msk;
int _counter;
int _cur;
char _tiposta;
TDate _dataini, _datafin;
TString16 _codsez, _codsot, _sezini, _sotini, _sezfin, _sotfin;
bool _stampa80;
TParagraph_string _cognome_nome, _dencom;
TString16 _tipoold;
int _contatore;
protected:
virtual bool user_create();
@ -110,8 +113,17 @@ bool TStampaBenemerenze::preprocess_page(int file, int counter)
// salto pagina se cambio punto di rottura
const TString16 tiponew = current_cursor()->curr().get(BEN_TIPOBEN);
const TString16 codsez = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ);
const TString16 codsot = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT);
TString16 codsez, codsot;
if (app()._tiposta == 'S')
{
codsez = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ);
codsot = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT);
}
else
{
codsez = current_cursor()->curr().get(BEN_CODSEZ);
codsot = current_cursor()->curr().get(BEN_CODSOT);
}
if ((tiponew != _tipoold) || (_codsez!=codsez) || (_codsot!=codsot))
{
if (_tipoold != "**")
@ -138,8 +150,18 @@ void TStampaBenemerenze::header_ben(const TString16 tipoben, const TString16 cod
intestazione << current_cursor()->curr(-ALIAS_BNZ).get("S0");
intestazione.center_just(132);
set_header(3,"@0g%s", (const char*) intestazione);
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TLocalisamfile sezioni(LF_SEZIONI);
sezioni.zero();
sezioni.put(SEZ_CODSEZ, codsez);
sezioni.put(SEZ_CODSOT, codsot);
TString80 densez, densot;
densez = "";
densot = "";
if (sezioni.read() == NOERR)
{
densez = sezioni.get(SEZ_DENSEZ);
densot = sezioni.get(SEZ_DENSOT);
}
intestazione = "Sezione: ";
intestazione << codsez;
intestazione << "/";
@ -164,8 +186,9 @@ bool TStampaBenemerenze::set_print(int m)
{
_codsez = "**";
_codsot = "**";
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
_tiposta = _msk->get(F_TIPOSTA)[0];
TRectype da(LF_BENEM);
TRectype a (LF_BENEM);
if (_dataini.ok())
@ -173,20 +196,93 @@ bool TStampaBenemerenze::set_print(int m)
if (_datafin.ok())
a.put(BEN_DATABEN, _datafin);
//TString80 chiave = "94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
TString80 chiave = "90->CODSEZ|90->CODSOT|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
TString80 chiave = "";
if (_tiposta == 'S')
chiave = "90->CODSEZ|90->CODSOT|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
else
chiave = "94->CODSEZ|94->CODSOT|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
_cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a));
TString80 filtro = "";
// filtro per sezioni
_sezini = _msk->get(F_SEZINI);
_sotini = _msk->get(F_SOTINI);
_sezfin = _msk->get(F_SEZFIN);
_sotfin = _msk->get(F_SOTFIN);
if (_sezini.not_empty())
filtro << "(90->CODSEZ >= \"" << _sezini << "\") && ";
if (_sezfin.not_empty())
filtro << "(90->CODSEZ <= \"" << _sezfin << "\")";
_sotfin = _msk->get(F_SOTFIN);
TString256 filtro = "";
if (_sezini.not_empty())
{
if (_sotini.not_empty())
{
if (_tiposta == 'S')
{
filtro << "(";
filtro << format("(90->CODSEZ > \"%s\")",(const char*)_sezini);
filtro << " || ";
filtro << "(" << format("(90->CODSEZ == \"%s\")",(const char*)_sezini);
filtro << " && ";
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
filtro << ")";
filtro << ")";
}
else
{
filtro << "(";
filtro << format("(94->CODSEZ > \"%s\")",(const char*)_sezini);
filtro << " || ";
filtro << "(" << format("(94->CODSEZ == \"%s\")",(const char*)_sezini);
filtro << " && ";
filtro << format("(94->CODSOT >= \"%s\")",(const char*)_sotini);
filtro << ")";
filtro << ")";
}
}
else
{
if (_tiposta == 'S')
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
else
filtro << format("(94->CODSEZ >= \"%s\")",(const char*)_sezini);
}
}
if (_sezfin.not_empty())
{
if (filtro.not_empty())
filtro << " && ";
if (_sotfin.not_empty())
{
if (_tiposta == 'S')
{
filtro << "(";
filtro << format("(90->CODSEZ < \"%s\")",(const char*)_sezfin);
filtro << " || ";
filtro << "(" << format("(90->CODSEZ == \"%s\")",(const char*)_sezfin);
filtro << " && ";
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
filtro << ")";
filtro << ")";
}
else
{
filtro << "(";
filtro << format("(94->CODSEZ < \"%s\")",(const char*)_sezfin);
filtro << " || ";
filtro << "(" << format("(94->CODSEZ == \"%s\")",(const char*)_sezfin);
filtro << " && ";
filtro << format("(94->CODSOT <= \"%s\")",(const char*)_sotfin);
filtro << ")";
filtro << ")";
}
}
else
{
if (_tiposta == 'S')
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
else
filtro << format("(94->CODSEZ <= \"%s\")",(const char*)_sezfin);
}
}
current_cursor()->setfilter((const char*) filtro, TRUE);
_counter = 0;
_counter = 0;
_tipoold = "**";
reset_files();
add_file(LF_BENEM);
@ -231,7 +327,8 @@ bool TStampaBenemerenze::user_create()
_rel->add(LF_COMUNI, "COM==RES_CODCOM",1,LF_SOGGETTI,ALIAS_COMRES);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,LF_SOGGETTI,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,LF_SOGGETTI,ALIAS_COMNAS);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
//_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_sezioni = new TLocalisamfile(LF_SEZIONI);
_msk = new TMask("at1300a");
TConfig config(CONFIG_STUDIO);
_stampa80 = config.get_bool("Stampa80");
@ -241,6 +338,7 @@ bool TStampaBenemerenze::user_create()
bool TStampaBenemerenze::user_destroy()
{
delete _msk;
delete _sezioni;
delete _rel;
return TRUE;
}

View File

@ -11,3 +11,4 @@
#define F_D_SOTFIN 108
#define F_DATAINI 109
#define F_DATAFIN 110
#define F_TIPOSTA 111

View File

@ -14,7 +14,7 @@ BEGIN
END
ENDPAGE
PAGE "Elenco benemerenze attribuite" -1 -1 78 20
PAGE "Elenco benemerenze per sezione" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
@ -146,5 +146,12 @@ BEGIN
PROMPT 30 6 "al "
END
RADIOBUTTON F_TIPOSTA 40
BEGIN
PROMPT 2 8 "Stampa per sezione "
ITEM "B|che ha attribuito la benemerenza"
ITEM "S|di appartenenza attuale"
END
ENDPAGE
ENDMASK