diff --git a/at/at1400.cpp b/at/at1400.cpp
index e798d9981..78c8a5d38 100755
--- a/at/at1400.cpp
+++ b/at/at1400.cpp
@@ -1,6 +1,7 @@
#include
#include
#include
+#include
#include
#include "benem.h"
@@ -25,6 +26,7 @@ class TStampaBenxGAz : public TPrintapp
TRelation* _rel;
TMask* _msk;
int _cur;
+ char _tiposta;
TDate _dataini, _datafin;
TString16 _codsez, _codsot;
bool _stampa80;
@@ -106,7 +108,11 @@ bool TStampaBenxGAz::preprocess_page(int file, int counter)
_dencom = localita;
// salto pagina se cambio punto di rottura
- TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE);
+ TString16 grupponew;
+ if (app()._tiposta == 'S')
+ grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE);
+ else
+ grupponew = current_cursor()->curr().get(BEN_GRUPPOAZIE);
if (grupponew != _gruppoold )
{
if (_gruppoold != "**")
@@ -135,12 +141,16 @@ bool TStampaBenxGAz::preprocess_page(int file, int counter)
}
void TStampaBenxGAz::header_gruppo(const TString16 gruppo)
-{
+{
TString intestazione(132);
intestazione = "GRUPPO AZIENDALE ";
intestazione << gruppo;
intestazione << " - ";
- intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0");
+ TTable gaz("GAZ");
+ gaz.zero();
+ gaz.put("CODTAB",gruppo);
+ if (gaz.read() == NOERR)
+ intestazione << gaz.get("S0");
intestazione.center_just(132);
set_header(2,"@0g%s", (const char*) intestazione);
return;
@@ -154,18 +164,33 @@ bool TStampaBenxGAz::set_print(int m)
{
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
- _gruppoazie = _msk->get(F_GRUPPOAZIE);
+ _gruppoazie = _msk->get(F_GRUPPOAZIE);
+ _tiposta = _msk->get(F_TIPOSTA)[0];
TRectype da(LF_BENEM);
TRectype a (LF_BENEM);
if (_dataini.ok())
da.put(BEN_DATABEN, _dataini);
if (_datafin.ok())
a.put(BEN_DATABEN, _datafin);
- TString80 chiave = "90->GRUPPOAZIE|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
+ TString80 chiave = "";
+ if (_tiposta == 'S')
+ chiave = "90->GRUPPOAZIE|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
+ else
+ chiave = "94->GRUPPOAZIE|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
_cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a));
TString80 filtro = "";
if (_gruppoazie.not_empty())
- filtro = format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
+ {
+ if (_tiposta == 'S')
+ filtro = format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
+ else
+ filtro = format("(94->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
+ }
+ else
+ if (_tiposta == 'S')
+ filtro = format("(90->GRUPPOAZIE != \"\")");
+ else
+ filtro = format("(94->GRUPPOAZIE != \"\")");
current_cursor()->setfilter((const char*) filtro, TRUE);
_contatore = 0;
_gruppoold = "**";
@@ -207,13 +232,12 @@ bool TStampaBenxGAz::user_create()
_rel = new TRelation(LF_BENEM);
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add("BNZ", "CODTAB==TIPOBEN",1,0,ALIAS_BNZ);
- _rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,LF_SOGGETTI,ALIAS_GAZ);
+ //_rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,LF_SOGGETTI,ALIAS_GAZ);
_rel->add("LCP", "CODTAB==RES_CODLOC",1,LF_SOGGETTI,ALIAS_LCPRES);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,LF_SOGGETTI,ALIAS_LCPDOM);
_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);
-
_msk = new TMask("at1400a");
TConfig config(CONFIG_STUDIO);
_stampa80 = config.get_bool("Stampa80");
diff --git a/at/at1400a.h b/at/at1400a.h
index a78fd622c..d96532796 100755
--- a/at/at1400a.h
+++ b/at/at1400a.h
@@ -13,3 +13,4 @@
#define F_DATAFIN 110
#define F_GRUPPOAZIE 111
#define F_D_GRUPPOAZIE 112
+#define F_TIPOSTA 113
diff --git a/at/at1400a.uml b/at/at1400a.uml
index 9822bec19..116b3f2dd 100755
--- a/at/at1400a.uml
+++ b/at/at1400a.uml
@@ -174,5 +174,14 @@ BEGIN
WARNING "Gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
+
+RADIOBUTTON F_TIPOSTA 40
+BEGIN
+ PROMPT 2 9 "Stampa per gruppo aziendale "
+ ITEM "B|che ha attribuito la benemerenza"
+ ITEM "S|di appartenenza attuale"
+END
+
ENDPAGE
+
ENDMASK