Statistica per sesso e età: aggiunto percentuale sul totale
git-svn-id: svn://10.65.10.50/trunk@6121 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e4bd566b98
commit
1c11ff53f3
@ -240,17 +240,24 @@ void TStatSogxEta::crea_intestazione()
|
||||
sep = "";
|
||||
sep << "Categoria ";
|
||||
sep << _catdon;
|
||||
sep << " ";
|
||||
TTable ctd("CTD");
|
||||
ctd.zero();
|
||||
ctd.put("CODTAB", _catdon);
|
||||
ctd.read();
|
||||
if (ctd.good())
|
||||
sep << ctd.get("S0");
|
||||
sep.center_just(80);
|
||||
row.reset();
|
||||
row.put(sep);
|
||||
printer().setheaderline(3, row);
|
||||
sep = "";
|
||||
sep << "Fascia di eta' Sconosciuto Maschi Femmine Non spec. Totale";
|
||||
sep << "Fascia di eta' Sconosc. Maschi Femmine Non spec. Totale";
|
||||
row.reset();
|
||||
row.put(sep);
|
||||
printer().setheaderline(5, row);
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
sep.fill('-',95);
|
||||
row.reset();
|
||||
row.put(sep);
|
||||
printer().setheaderline(6, row);
|
||||
@ -346,6 +353,13 @@ void TStatSogxEta::stampa_sezione(TString16 codsez, TString16 codsot)
|
||||
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;
|
||||
@ -364,33 +378,41 @@ void TStatSogxEta::stampa_sezione(TString16 codsez, TString16 codsot)
|
||||
rigastampa << valreal.string();
|
||||
rigastampa << " anni";
|
||||
totalefascia = ZERO;
|
||||
// ciclo per totali
|
||||
for (int i=0;i<_colonne->items();i++)
|
||||
{
|
||||
rigatotali.aggiorna_valore(i,riga[i]);
|
||||
totalefascia+=riga[i];
|
||||
}
|
||||
// ciclo per stampa
|
||||
int pos = 15;
|
||||
for (int j=0;j<_colonne->items();j++)
|
||||
{
|
||||
//rigatotali.aggiorna_valore(i,riga[i]);
|
||||
//totalefascia+=riga[i];
|
||||
rigatotali.aggiorna_valore(j,riga[j]);
|
||||
totalefascia+=riga[j];
|
||||
valore = "";
|
||||
valore.format("%8d",riga[i].integer());
|
||||
valore.format("%8d",riga[j].integer());
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
real perc = (riga[j]/totalefascia)*100;
|
||||
pos=pos+6;
|
||||
valore = "";
|
||||
valore << perc.string(3,2);
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
pos = pos+10;
|
||||
if (totalegenerale != ZERO)
|
||||
{
|
||||
real perc = (riga[j]/totalegenerale)*100;
|
||||
pos=pos+10;
|
||||
valore = "";
|
||||
valore << perc.string(3,2);
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
pos = pos+6;
|
||||
}
|
||||
else
|
||||
pos = pos+16;
|
||||
}
|
||||
if (totalefascia != 0)
|
||||
if (totalefascia != ZERO)
|
||||
{
|
||||
valore = "";
|
||||
valore.format("%8d",totalefascia.integer());
|
||||
rigastampa.overwrite((const char*)valore, pos+4);
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
if (totalegenerale != ZERO)
|
||||
{
|
||||
real perc = (totalefascia/totalegenerale)*100;
|
||||
pos=pos+10;
|
||||
valore = "";
|
||||
valore << perc.string(3,2);
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
pos = pos+6;
|
||||
}
|
||||
row.put((const char*) rigastampa);
|
||||
printer().print(row);
|
||||
}
|
||||
@ -398,7 +420,7 @@ void TStatSogxEta::stampa_sezione(TString16 codsez, TString16 codsot)
|
||||
|
||||
// stampa totali per sezione
|
||||
rigastampa = "";
|
||||
rigastampa.fill('-');
|
||||
rigastampa.fill('-',95);
|
||||
row.reset();
|
||||
row.put(rigastampa);
|
||||
printer().print(row);
|
||||
@ -407,18 +429,28 @@ void TStatSogxEta::stampa_sezione(TString16 codsez, TString16 codsot)
|
||||
rigastampa = "Totale";
|
||||
real totale;
|
||||
totale = ZERO;
|
||||
int pos = 21;
|
||||
int pos = 15;
|
||||
for (int i=0;i<_colonne->items();i++)
|
||||
{
|
||||
totale+=rigatotali[i];
|
||||
valore = "";
|
||||
valore.format("%8d",rigatotali[i].integer());
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
pos = pos+10;
|
||||
if (totalegenerale != ZERO)
|
||||
{
|
||||
real perc = (rigatotali[i]/totalegenerale)*100;
|
||||
pos=pos+10;
|
||||
valore = "";
|
||||
valore << perc.string(3,2);
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
pos = pos+6;
|
||||
}
|
||||
else
|
||||
pos = pos+16;
|
||||
}
|
||||
valore = "";
|
||||
valore.format("%8d",totale.integer());
|
||||
rigastampa.overwrite((const char*)valore, pos+4);
|
||||
rigastampa.overwrite((const char*)valore, pos);
|
||||
row.put((const char*) rigastampa);
|
||||
printer().print(row);
|
||||
printer().formfeed();
|
||||
|
Loading…
x
Reference in New Issue
Block a user