Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@18930 c028cbd2-c16b-5b4b-a496-9718f37d4682
691 lines
18 KiB
C++
Executable File
691 lines
18 KiB
C++
Executable File
#include <applicat.h>
|
||
#include <mask.h>
|
||
#include <msksheet.h>
|
||
#include <printer.h>
|
||
#include <progind.h>
|
||
#include <recarray.h>
|
||
#include <relation.h>
|
||
#include <urldefid.h>
|
||
#include <utility.h>
|
||
|
||
#include "at3.h"
|
||
|
||
// nomi campi maschera
|
||
#include "at3100a.h"
|
||
|
||
// nomi dei campi
|
||
#include "soggetti.h"
|
||
#include "atstats.h"
|
||
#include "sezioni.h"
|
||
|
||
// classe per la definizione di una riga di statistica
|
||
class TRigaSFascia : public TObject
|
||
{
|
||
int _etaini,_etafin;
|
||
TArray _valori;
|
||
|
||
protected:
|
||
const TRigaSFascia& copy(const TRigaSFascia& riga);
|
||
public:
|
||
const int etaini() const { return _etaini; }
|
||
const int etafin() const { return _etafin; }
|
||
TObject* dup() const { return new TRigaSFascia(*this); }
|
||
const TRigaSFascia& operator = (const TRigaSFascia& riga);
|
||
const real& operator [] (int colonna) const;
|
||
void aggiorna_valore(int colonna, const real& numero) ;
|
||
void azzera_valori();
|
||
// costruttore
|
||
TRigaSFascia(int etaini, int etafin) {_etaini = etaini; _etafin = etafin;}
|
||
// costruttore di copia
|
||
TRigaSFascia(const TRigaSFascia& riga) { copy(riga); }
|
||
virtual ~TRigaSFascia() {};
|
||
};
|
||
|
||
const TRigaSFascia& TRigaSFascia::copy(const TRigaSFascia& riga)
|
||
{
|
||
_etaini = riga._etaini;
|
||
_etafin = riga._etafin;
|
||
_valori = riga._valori;
|
||
return (*this);
|
||
}
|
||
|
||
const TRigaSFascia& TRigaSFascia::operator = (const TRigaSFascia& riga)
|
||
{
|
||
copy(riga);
|
||
return (*this);
|
||
}
|
||
|
||
const real& TRigaSFascia::operator [] (int colonna) const
|
||
{
|
||
real* valore = (real*)_valori.objptr(colonna);
|
||
if (valore == NULL)
|
||
return ZERO;
|
||
else
|
||
return *valore;
|
||
}
|
||
|
||
void TRigaSFascia::aggiorna_valore(int colonna, const real& numero)
|
||
{
|
||
real* valore = (real*)_valori.objptr(colonna);
|
||
if (valore == NULL)
|
||
_valori.add(new real(numero), colonna);
|
||
else
|
||
*valore += numero;
|
||
}
|
||
|
||
void TRigaSFascia::azzera_valori()
|
||
{
|
||
_valori.destroy();
|
||
}
|
||
|
||
class TStatSogxEta : public TApplication
|
||
{
|
||
TMask* _msk;
|
||
TRelation* _rel;
|
||
TCursor* _cur;
|
||
TLocalisamfile* _sezioni;
|
||
TLocalisamfile* _soggetti;
|
||
TLocalisamfile* _atstats;
|
||
TAssoc_array* _colonne;
|
||
TArray _righe;
|
||
TString16 _sezini, _sotini, _sezfin, _sotfin, _gruppoazie;
|
||
TString16 _catdon;
|
||
TDate _data;
|
||
TArray _etaini, _etafin;
|
||
bool _solotot, _pergruppo;
|
||
int _sezionistampate;
|
||
|
||
protected:
|
||
virtual bool create();
|
||
virtual bool destroy();
|
||
virtual bool menu(MENU_TAG m);
|
||
virtual TMask& get_mask() { return *_msk; }
|
||
virtual TRelation* get_relation() const { return _rel; }
|
||
int data2row(const int eta);
|
||
bool riepilogo();
|
||
bool stampa();
|
||
bool crea_colonne();
|
||
bool crea_righe();
|
||
void azzera_righe();
|
||
void stampa_sezione(TString16 codsez, TString16 codsot);
|
||
void crea_intestazione();
|
||
public:
|
||
TStatSogxEta() {}
|
||
|
||
};
|
||
|
||
HIDDEN inline TStatSogxEta& app() { return (TStatSogxEta&) main_app(); }
|
||
|
||
int TStatSogxEta::data2row(const int eta)
|
||
{
|
||
int indice = -1;
|
||
for (int i=0; i<_etaini.items(); i++)
|
||
{
|
||
real valore;
|
||
real* val1 = (real*) _etaini.objptr(i);
|
||
valore = *val1;
|
||
int etaini = (int) valore.integer();
|
||
real* val2 = (real*) _etafin.objptr(i);
|
||
valore = *val2;
|
||
int etafin = (int) valore.integer();
|
||
if ((eta >= etaini) && (eta <= etafin))
|
||
indice = i;
|
||
}
|
||
return indice;
|
||
}
|
||
|
||
bool TStatSogxEta::crea_colonne()
|
||
{
|
||
_colonne->destroy();
|
||
real contatore(ZERO);
|
||
real* oggetto = new real(contatore);
|
||
const char* indice = "0";
|
||
_colonne->add(indice,(TObject*)oggetto);
|
||
indice = "1"; // maschi
|
||
contatore = contatore+1;
|
||
real* oggetto2 = new real(contatore);
|
||
_colonne->add(indice,(TObject*)oggetto2);
|
||
indice = "2"; // femmine
|
||
contatore = contatore+1;
|
||
real* oggetto3 = new real(contatore);
|
||
_colonne->add(indice,(TObject*)oggetto3);
|
||
indice = "9"; // non spec.
|
||
contatore = contatore+1;
|
||
real* oggetto4 = new real(contatore);
|
||
_colonne->add(indice,(TObject*)oggetto4);
|
||
return TRUE;
|
||
}
|
||
|
||
bool TStatSogxEta::crea_righe()
|
||
{
|
||
for (int i=0;i<_etaini.items();i++)
|
||
{
|
||
real valore;
|
||
real* val1 = (real*) _etaini.objptr(i);
|
||
valore = *val1;
|
||
int etaini = (int) valore.integer();
|
||
real* val2 = (real*) _etafin.objptr(i);
|
||
valore = *val2;
|
||
int etafin = (int) valore.integer();
|
||
_righe.add(new TRigaSFascia(etaini, etafin), i);
|
||
}
|
||
return _righe.items()>0;
|
||
}
|
||
|
||
bool TStatSogxEta::create()
|
||
{
|
||
TApplication::create();
|
||
_msk = new TMask("at3100a");
|
||
_rel = new TRelation(LF_SOGGETTI);
|
||
_soggetti = new TLocalisamfile(LF_SOGGETTI);
|
||
_atstats = new TLocalisamfile(LF_ATSTATS);
|
||
_sezioni = new TLocalisamfile(LF_SEZIONI);
|
||
_colonne = new TAssoc_array();
|
||
dispatch_e_menu(BAR_ITEM_ID(1));
|
||
return TRUE;
|
||
}
|
||
|
||
bool TStatSogxEta::destroy()
|
||
{
|
||
delete _colonne;
|
||
delete _sezioni;
|
||
delete _atstats;
|
||
delete _soggetti;
|
||
delete _rel;
|
||
delete _msk;
|
||
return TApplication::destroy();
|
||
}
|
||
|
||
bool TStatSogxEta::menu(MENU_TAG m)
|
||
{
|
||
TMask& msk = get_mask();
|
||
KEY tasto;
|
||
tasto = msk.run();
|
||
if (tasto == K_ENTER)
|
||
{
|
||
_sezini = _msk->get(F_SEZINI);
|
||
_sotini = _msk->get(F_SOTINI);
|
||
_sezfin = _msk->get(F_SEZFIN);
|
||
_sotfin = _msk->get(F_SOTFIN);
|
||
_catdon = _msk->get(F_CATDON);
|
||
_data = _msk->get_date(F_DATA);
|
||
_pergruppo = _msk->get_bool(F_PERGRUPPO);
|
||
_gruppoazie = _msk->get(F_GRUPPOAZIE);
|
||
_solotot = msk.get_bool(F_SOLOTOT);
|
||
TSheet_field& s = (TSheet_field&)_msk->field(F_FASCIE);
|
||
for (int r=0; r<s.items(); r++)
|
||
{
|
||
TToken_string& row = s.row(r);
|
||
const int etaini = row.get_int(0);
|
||
const int etafin = row.get_int();
|
||
if (etaini != 0 || etafin != 0)
|
||
{
|
||
_etaini.add(new real(etaini),r);
|
||
_etafin.add(new real(etafin),r);
|
||
}
|
||
}
|
||
if (riepilogo())
|
||
stampa();
|
||
}
|
||
return FALSE;
|
||
}
|
||
|
||
void TStatSogxEta::crea_intestazione()
|
||
{
|
||
TPrintrow row;
|
||
TString256 sep;
|
||
sep = "STATISTICA SOGGETTI PER SESSO E ETA' al ";
|
||
sep << _data.string();
|
||
sep.center_just(120);
|
||
row.put(sep);
|
||
row.put("@>", 1);
|
||
row.put("Pag. @#", 105);
|
||
printer().setheaderline(2, row);
|
||
sep = "";
|
||
if (_catdon.not_empty())
|
||
{
|
||
sep << "Categoria " << _catdon << ' ';
|
||
sep << cache().get("CTD", _catdon).get("S0");
|
||
}
|
||
else
|
||
sep << "Tutte le categorie non dimessi";
|
||
sep.center_just(120);
|
||
row.reset();
|
||
row.put(sep);
|
||
printer().setheaderline(3, row);
|
||
sep = "";
|
||
sep << "Fascia di eta' Sconosc. Maschi Femmine Non spec. Totale";
|
||
row.reset();
|
||
row.put(sep);
|
||
printer().setheaderline(5, row);
|
||
sep = "";
|
||
sep << " Nro %rel %ass Nro %rel %ass Nro %rel %ass Nro %rel %ass Nro %ass";
|
||
row.reset();
|
||
row.put(sep);
|
||
printer().setheaderline(6, row);
|
||
sep = "";
|
||
sep.fill('-',120);
|
||
row.reset();
|
||
row.put(sep);
|
||
printer().setheaderline(7, row);
|
||
}
|
||
|
||
bool TStatSogxEta::stampa()
|
||
{
|
||
if (printer().open())
|
||
{
|
||
_sezionistampate = 0;
|
||
crea_intestazione();
|
||
TRelation* relstat = new TRelation(LF_ATSTATS);
|
||
TCursor* curstat = new TCursor(relstat, "", 1);
|
||
TString16 oldsez = "**";
|
||
TString16 oldsot = "**";
|
||
double numero;
|
||
TString16 actsez, actsot;
|
||
TString16 sesso;
|
||
int fascia;
|
||
long last = curstat->items();
|
||
for ( *curstat=0; curstat->pos() < last; ++(*curstat) )
|
||
{
|
||
actsez = curstat->curr().get(ATSS_CODSEZ);
|
||
actsot = curstat->curr().get(ATSS_CODSOT);
|
||
fascia = curstat->curr().get_int(ATSS_FASCIA);
|
||
sesso = curstat->curr().get(ATSS_SESSO);
|
||
if (sesso.empty())
|
||
sesso = "9";
|
||
numero = (double)curstat->curr().get_int(ATSS_NUMERO);
|
||
if (actsez != oldsez || actsot != oldsot)
|
||
{
|
||
if (oldsez != "**" && oldsot != "**")
|
||
{
|
||
stampa_sezione(oldsez,oldsot);
|
||
azzera_righe();
|
||
}
|
||
oldsez = actsez;
|
||
oldsot = actsot;
|
||
}
|
||
TRigaSFascia& riga = (TRigaSFascia&)_righe[fascia];
|
||
real& colonna = (real&)_colonne->find((const char*)sesso);
|
||
real n = numero;
|
||
riga.aggiorna_valore((int) colonna.integer(),n);
|
||
}
|
||
if (oldsez != "**" && oldsot != "**")
|
||
stampa_sezione(oldsez,oldsot);
|
||
delete curstat;
|
||
delete relstat;
|
||
printer().close();
|
||
return TRUE;
|
||
}
|
||
else
|
||
return FALSE;
|
||
}
|
||
|
||
void TStatSogxEta::azzera_righe()
|
||
{
|
||
for (int i=0;i<_etaini.items();i++)
|
||
{
|
||
TRigaSFascia& riga = (TRigaSFascia&)_righe[i];
|
||
riga.azzera_valori();
|
||
}
|
||
}
|
||
|
||
void TStatSogxEta::stampa_sezione(TString16 codsez, TString16 codsot)
|
||
{
|
||
TPrintrow row;
|
||
TString256 rigastampa;
|
||
if (codsez == "ZZ" && codsot == "ZZ")
|
||
{
|
||
if (_sezionistampate != 1)
|
||
{
|
||
rigastampa = "";
|
||
rigastampa << "RIEPILOGO TOTALE SEZIONI DA " << _sezini << '/' << _sotini << " A " << _sezfin << '/' << _sotfin;
|
||
if (_pergruppo)
|
||
rigastampa << " - SOLO GRUPPI AZIENDALI";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
_sezionistampate++;
|
||
if (_pergruppo)
|
||
{
|
||
rigastampa = "Gruppo aziendale ";
|
||
rigastampa << codsez;
|
||
rigastampa << codsot;
|
||
}
|
||
else
|
||
{
|
||
rigastampa = "Sezione: ";
|
||
rigastampa << codsez;
|
||
if (codsot.not_empty())
|
||
{
|
||
rigastampa << "/";
|
||
rigastampa << codsot;
|
||
}
|
||
rigastampa << " ";
|
||
TLocalisamfile sezioni(LF_SEZIONI);
|
||
sezioni.setkey(1);
|
||
sezioni.zero();
|
||
sezioni.put(SEZ_CODSEZ,codsez);
|
||
sezioni.put(SEZ_CODSOT,codsot);
|
||
if (sezioni.read() == NOERR)
|
||
{
|
||
TString80 den = sezioni.get(SEZ_DENSEZ);
|
||
rigastampa << den;
|
||
den = sezioni.get(SEZ_DENSOT);
|
||
if (den.not_empty())
|
||
{
|
||
rigastampa << "/";
|
||
rigastampa << den;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if ((codsez == "ZZ" && codsot == "ZZ" && _sezionistampate != 1) || (codsez != "ZZ"))
|
||
{
|
||
rigastampa.center_just(120);
|
||
row.put(rigastampa);
|
||
printer().setheaderline(1, row);
|
||
|
||
real totalegenerale = ZERO;
|
||
for (int t=0;t<_etaini.items();t++)
|
||
{
|
||
TRigaSFascia& riga = (TRigaSFascia&)_righe[t];
|
||
for (int i=0;i<_colonne->items();i++)
|
||
totalegenerale+=riga[i];
|
||
}
|
||
TRigaSFascia rigatotali(0,0);
|
||
TString16 valore;
|
||
real totalefascia = ZERO;
|
||
for (int r = 0;r < _etaini.items(); r++)
|
||
{
|
||
TRigaSFascia& riga = (TRigaSFascia&)_righe[r];
|
||
row.reset();
|
||
real valreal;
|
||
rigastampa = "da ";
|
||
real* val1 = (real*)_etaini.objptr(r);
|
||
valreal = *val1;
|
||
rigastampa << valreal.string();
|
||
rigastampa << " a ";
|
||
real* val2 = (real*)_etafin.objptr(r);
|
||
valreal = *val2;
|
||
rigastampa << valreal.string();
|
||
rigastampa << " anni";
|
||
totalefascia = ZERO;
|
||
|
||
for (int j = 0;j < _colonne->items(); j++)
|
||
totalefascia+=riga[j];
|
||
|
||
// ciclo per stampa
|
||
int pos = 15;
|
||
for (int k = 0;k < _colonne->items(); k++)
|
||
{
|
||
rigatotali.aggiorna_valore(k, riga[k]);
|
||
valore = "";
|
||
valore.format("%8s",riga[k].string(8,0));
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
pos = pos + 10;
|
||
if (totalefascia != ZERO)
|
||
{
|
||
real perc = (riga[k]/totalefascia)*100;
|
||
valore = "";
|
||
valore << perc.string(3,2);
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
}
|
||
pos = pos+6;
|
||
if (totalegenerale != ZERO)
|
||
{
|
||
real perc = (riga[k]/totalegenerale)*100;
|
||
valore = "";
|
||
valore << perc.string(3,2);
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
}
|
||
pos = pos+6;
|
||
}
|
||
if (totalefascia != ZERO)
|
||
{
|
||
valore = "";
|
||
valore.format("%8s",totalefascia.string(8,0));
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
pos=pos+10;
|
||
if (totalegenerale != ZERO)
|
||
{
|
||
real perc = (totalefascia/totalegenerale)*100;
|
||
valore = "";
|
||
valore << perc.string(3,2);
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
pos = pos+6;
|
||
}
|
||
row.put((const char*) rigastampa);
|
||
printer().print(row);
|
||
}
|
||
}
|
||
|
||
// stampa totali per sezione
|
||
rigastampa = "";
|
||
rigastampa.fill('-',120);
|
||
row.reset();
|
||
row.put(rigastampa);
|
||
printer().print(row);
|
||
row.reset();
|
||
rigastampa = "";
|
||
rigastampa = "Totale";
|
||
real totale;
|
||
totale = ZERO;
|
||
int pos = 15;
|
||
for (int i=0;i<_colonne->items();i++)
|
||
{
|
||
totale+=rigatotali[i];
|
||
valore = "";
|
||
valore.format("%8s",rigatotali[i].string(8,0));
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
pos=pos+16;
|
||
if (totalegenerale != ZERO)
|
||
{
|
||
real perc = (rigatotali[i]/totalegenerale)*100;
|
||
valore = "";
|
||
valore << perc.string(3,2);
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
}
|
||
pos = pos+6;
|
||
}
|
||
valore = "";
|
||
valore.format("%8s",totale.string(8,0));
|
||
rigastampa.overwrite((const char*)valore, pos);
|
||
row.put((const char*) rigastampa);
|
||
printer().print(row);
|
||
printer().formfeed();
|
||
}
|
||
}
|
||
|
||
bool TStatSogxEta::riepilogo()
|
||
{
|
||
if (crea_colonne() && crea_righe())
|
||
{
|
||
// cancello i risultati della elaborazione precedente
|
||
TLocalisamfile stat(LF_ATSTATS);
|
||
for (stat.first(); !stat.eof(); stat.next())
|
||
stat.remove();
|
||
stat.setkey(1);
|
||
_cur = new TCursor(_rel, "", 1);
|
||
TString256 filtro = "";
|
||
// filtro per sezione/sottogruppo
|
||
if (_sezini.not_empty())
|
||
{
|
||
if (_sotini.not_empty())
|
||
{
|
||
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 << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
|
||
}
|
||
if (_sezfin.not_empty())
|
||
{
|
||
if (filtro.not_empty())
|
||
filtro << " && ";
|
||
|
||
if (_sotfin.not_empty())
|
||
{
|
||
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 << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
|
||
}
|
||
if (_pergruppo)
|
||
{
|
||
if (filtro.not_empty())
|
||
filtro << " && ";
|
||
if (_gruppoazie.not_empty())
|
||
filtro << format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
|
||
else
|
||
filtro << format("(90->GRUPPOAZIE != \"\")");
|
||
}
|
||
_cur->setfilter((const char*) filtro, TRUE);
|
||
TString16 codsez, codsot, catdon, catcoll, gruppoazie;
|
||
long numero;
|
||
TString16 sesso;
|
||
int eta, fascia;
|
||
TDate datanasc, dataisc, datadim;
|
||
bool catdim, ok;
|
||
const TDate oggi(TODAY);
|
||
const int anno = oggi.year();
|
||
catdim = cache().get("CTD", _catdon).get_bool("B0");
|
||
TRectype& recsog = _cur->curr();
|
||
long last = _cur->items();
|
||
TProgind prg (last, "Elaborazione in corso... Prego attendere", FALSE, TRUE, 30);
|
||
for ( *_cur=0; _cur->pos() < last; ++(*_cur) )
|
||
{
|
||
prg.addstatus(1);
|
||
catdon = recsog.get(SOG_CATDON);
|
||
catcoll = "";
|
||
dataisc = NULLDATE;
|
||
datadim = NULLDATE;
|
||
ok = FALSE;
|
||
if (catdon.not_empty())
|
||
{
|
||
if (_catdon.not_empty())
|
||
{
|
||
if (catdim)
|
||
{
|
||
datadim = recsog.get_date(SOG_DATADIM);
|
||
ok = ((catdon == _catdon) && (datadim <= _data));
|
||
}
|
||
else
|
||
{
|
||
dataisc = recsog.get_date(SOG_DATAISC);
|
||
ok = ((catdon == _catdon) && (dataisc <= _data));
|
||
if (!ok)
|
||
{
|
||
catcoll = cache().get("CTD", catdon).get("S6");
|
||
datadim = recsog.get_date(SOG_DATADIM);
|
||
ok = ((catcoll == _catdon) && (dataisc <= _data) && (datadim > _data));
|
||
// se la categoria collegata <20> vuota occorre esaminare lo storico
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
dataisc = recsog.get_date(SOG_DATAISC);
|
||
datadim = recsog.get_date(SOG_DATADIM);
|
||
if (cache().get("CTD", catdon).get_bool("B0"))
|
||
ok = ((dataisc <= _data) && (datadim > _data));
|
||
else
|
||
ok = (dataisc <= _data);
|
||
}
|
||
}
|
||
if (ok)
|
||
{
|
||
if (_pergruppo)
|
||
{
|
||
gruppoazie = recsog.get(SOG_GRUPPOAZIE);
|
||
codsez = gruppoazie.sub(0,2);
|
||
codsot = gruppoazie.sub(2,4);
|
||
}
|
||
else
|
||
{
|
||
codsez = recsog.get(SOG_CODSEZ);
|
||
codsot = recsog.get(SOG_CODSOT);
|
||
}
|
||
datanasc = recsog.get_date(SOG_DATANASC);
|
||
eta = _data.year() - datanasc.year();
|
||
fascia = data2row(eta);
|
||
sesso = recsog.get(SOG_SESSO);
|
||
if (sesso.empty())
|
||
sesso = "9";
|
||
if (fascia != -1)
|
||
{
|
||
if (!_solotot)
|
||
{
|
||
stat.zero();
|
||
stat.put(ATSS_CODSEZ, codsez);
|
||
stat.put(ATSS_CODSOT, codsot);
|
||
stat.put(ATSS_SESSO, sesso);
|
||
stat.put(ATSS_FASCIA, fascia);
|
||
if (stat.read() == NOERR)
|
||
{
|
||
numero = stat.get_long(ATSS_NUMERO);
|
||
numero++;
|
||
stat.put(ATSS_NUMERO, numero);
|
||
stat.rewrite();
|
||
}
|
||
else
|
||
{
|
||
stat.put(ATSS_CODSEZ, codsez);
|
||
stat.put(ATSS_CODSOT, codsot);
|
||
stat.put(ATSS_SESSO, sesso);
|
||
stat.put(ATSS_FASCIA, fascia);
|
||
numero = 1;
|
||
stat.put(ATSS_NUMERO, numero);
|
||
stat.write();
|
||
}
|
||
}
|
||
stat.zero();
|
||
stat.put(ATSS_CODSEZ, "ZZ");
|
||
stat.put(ATSS_CODSOT, "ZZ");
|
||
stat.put(ATSS_SESSO, sesso);
|
||
stat.put(ATSS_FASCIA, fascia);
|
||
if (stat.read() == NOERR)
|
||
{
|
||
numero = stat.get_long(ATSS_NUMERO);
|
||
numero++;
|
||
stat.put(ATSS_NUMERO, numero);
|
||
stat.rewrite();
|
||
}
|
||
else
|
||
{
|
||
stat.put(ATSS_CODSEZ, "ZZ");
|
||
stat.put(ATSS_CODSOT, "ZZ");
|
||
stat.put(ATSS_SESSO, sesso);
|
||
stat.put(ATSS_FASCIA, fascia);
|
||
numero = 1;
|
||
stat.put(ATSS_NUMERO, numero);
|
||
stat.write();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return (stat.eod() > 0);
|
||
}
|
||
else
|
||
return FALSE;
|
||
}
|
||
|
||
int at3100(int argc, char* argv[])
|
||
{
|
||
TStatSogxEta a;
|
||
a.run(argc, argv, "Statistica soggetti per sesso e eta'");
|
||
return 0;
|
||
} |