Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Statistica riepilogo giorn. don.: possibilita' di fare la stampa per sezione o per punto e in questo caso di selezionare il punto git-svn-id: svn://10.65.10.50/trunk@7710 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e984dffae4
commit
39fbd01ef5
195
at/at3500.cpp
195
at/at3500.cpp
@ -1,5 +1,4 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
//#include <execp.h>
|
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
@ -92,7 +91,8 @@ class TRiepilogoGiornaliero : public TApplication
|
|||||||
TAssoc_array* _colonne;
|
TAssoc_array* _colonne;
|
||||||
TArray _righe; // array per riepilogo donazioni
|
TArray _righe; // array per riepilogo donazioni
|
||||||
TArray _righe_prime; // array per riepilogo prime don
|
TArray _righe_prime; // array per riepilogo prime don
|
||||||
TString16 _sezini, _sotini, _sezfin, _sotfin;
|
TString16 _sezini, _sotini, _sezfin, _sotfin, _punto;
|
||||||
|
char _suddivisa;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
@ -107,6 +107,8 @@ protected:
|
|||||||
bool crea_righe();
|
bool crea_righe();
|
||||||
void azzera_righe();
|
void azzera_righe();
|
||||||
void stampa_sezione(TString16 codsez, TString16 codsot);
|
void stampa_sezione(TString16 codsez, TString16 codsot);
|
||||||
|
void stampa_punto(TString16 punto);
|
||||||
|
void stampa_tutto();
|
||||||
void crea_intestazione();
|
void crea_intestazione();
|
||||||
public:
|
public:
|
||||||
TRiepilogoGiornaliero() {}
|
TRiepilogoGiornaliero() {}
|
||||||
@ -179,10 +181,12 @@ bool TRiepilogoGiornaliero::menu(MENU_TAG m)
|
|||||||
_dataini = msk.get(F_DATAINI);
|
_dataini = msk.get(F_DATAINI);
|
||||||
_datafin = msk.get(F_DATAFIN);
|
_datafin = msk.get(F_DATAFIN);
|
||||||
_primedon = msk.get_bool(F_PRIMEDON);
|
_primedon = msk.get_bool(F_PRIMEDON);
|
||||||
_sezini = _msk->get(F_SEZINI);
|
_suddivisa = msk.get(F_SUDDIVISA)[0];
|
||||||
_sotini = _msk->get(F_SOTINI);
|
_punto = msk.get(F_PUNTO);
|
||||||
_sezfin = _msk->get(F_SEZFIN);
|
_sezini = msk.get(F_SEZINI);
|
||||||
_sotfin = _msk->get(F_SOTFIN);
|
_sotini = msk.get(F_SOTINI);
|
||||||
|
_sezfin = msk.get(F_SEZFIN);
|
||||||
|
_sotfin = msk.get(F_SOTFIN);
|
||||||
if (riepilogo())
|
if (riepilogo())
|
||||||
stampa();
|
stampa();
|
||||||
}
|
}
|
||||||
@ -223,7 +227,7 @@ void TRiepilogoGiornaliero::crea_intestazione()
|
|||||||
row.put(sep);
|
row.put(sep);
|
||||||
printer().setheaderline(5, row);
|
printer().setheaderline(5, row);
|
||||||
sep = "";
|
sep = "";
|
||||||
sep.fill('-');
|
sep.fill('-',80);
|
||||||
row.reset();
|
row.reset();
|
||||||
row.put(sep);
|
row.put(sep);
|
||||||
printer().setheaderline(6, row);
|
printer().setheaderline(6, row);
|
||||||
@ -235,32 +239,51 @@ bool TRiepilogoGiornaliero::stampa()
|
|||||||
{
|
{
|
||||||
crea_intestazione();
|
crea_intestazione();
|
||||||
TRelation* relstat = new TRelation(LF_ATSTATD);
|
TRelation* relstat = new TRelation(LF_ATSTATD);
|
||||||
TCursor* curstat = new TCursor(relstat, "", 1);
|
TSorted_cursor* curstat = new TSorted_cursor(relstat,"","", 1);
|
||||||
|
if (_suddivisa == 'P')
|
||||||
|
curstat->change_order("121->PUNTO|121->GIORNO|121->TIPODON");
|
||||||
TString16 oldsez = "**";
|
TString16 oldsez = "**";
|
||||||
TString16 oldsot = "**";
|
TString16 oldsot = "**";
|
||||||
|
TString16 oldpunto = "**";
|
||||||
double numero, numprime;
|
double numero, numprime;
|
||||||
TString16 actsez, actsot;
|
TString16 actsez, actsot, actpunto;
|
||||||
TString16 tipodon;
|
TString16 tipodon;
|
||||||
TDate data;
|
TDate data;
|
||||||
long last = curstat->items();
|
long last = curstat->items();
|
||||||
for ( *curstat=0; curstat->pos() < last; ++(*curstat) )
|
for ( *curstat=0; curstat->pos() < last; ++(*curstat) )
|
||||||
{
|
{
|
||||||
|
actpunto = curstat->curr().get(ATS_PUNTO);
|
||||||
actsez = curstat->curr().get(ATS_CODSEZ);
|
actsez = curstat->curr().get(ATS_CODSEZ);
|
||||||
actsot = curstat->curr().get(ATS_CODSOT);
|
actsot = curstat->curr().get(ATS_CODSOT);
|
||||||
data = curstat->curr().get_date(ATS_DATA);
|
data = curstat->curr().get_date(ATS_DATA);
|
||||||
tipodon = curstat->curr().get(ATS_TIPODON);
|
tipodon = curstat->curr().get(ATS_TIPODON);
|
||||||
numero = (double)curstat->curr().get_int(ATS_NUMERO);
|
numero = (double)curstat->curr().get_int(ATS_NUMERO);
|
||||||
numprime = (double)curstat->curr().get_int(ATS_NUMPRIME);
|
numprime = (double)curstat->curr().get_int(ATS_NUMPRIME);
|
||||||
if (actsez != oldsez || actsot != oldsot)
|
if (_suddivisa == 'S')
|
||||||
{
|
{
|
||||||
if (oldsez != "**" && oldsot != "**")
|
if (actsez != oldsez || actsot != oldsot)
|
||||||
{
|
{
|
||||||
stampa_sezione(oldsez,oldsot);
|
if (oldsez != "**" && oldsot != "**")
|
||||||
azzera_righe();
|
{
|
||||||
}
|
stampa_sezione(oldsez,oldsot);
|
||||||
oldsez = actsez;
|
azzera_righe();
|
||||||
oldsot = actsot;
|
}
|
||||||
}
|
oldsez = actsez;
|
||||||
|
oldsot = actsot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (actpunto != oldpunto)
|
||||||
|
{
|
||||||
|
if (oldpunto != "**")
|
||||||
|
{
|
||||||
|
stampa_punto(oldpunto);
|
||||||
|
azzera_righe();
|
||||||
|
}
|
||||||
|
oldpunto = actpunto;
|
||||||
|
}
|
||||||
|
}
|
||||||
TRigaG& riga = (TRigaG&)_righe[data2row(data)];
|
TRigaG& riga = (TRigaG&)_righe[data2row(data)];
|
||||||
real& colonna = (real&)_colonne->find((const char*)tipodon);
|
real& colonna = (real&)_colonne->find((const char*)tipodon);
|
||||||
real n = numero;
|
real n = numero;
|
||||||
@ -271,9 +294,17 @@ bool TRiepilogoGiornaliero::stampa()
|
|||||||
n = numprime;
|
n = numprime;
|
||||||
riga_prime.aggiorna_valore((int) colonna.integer(), n);
|
riga_prime.aggiorna_valore((int) colonna.integer(), n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldsez != "**" && oldsot != "**")
|
if (_suddivisa == 'S')
|
||||||
stampa_sezione(oldsez,oldsot);
|
{
|
||||||
|
if (oldsez != "**" && oldsot != "**")
|
||||||
|
stampa_sezione(oldsez,oldsot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oldpunto != "**")
|
||||||
|
stampa_punto(oldpunto);
|
||||||
|
}
|
||||||
delete curstat;
|
delete curstat;
|
||||||
delete relstat;
|
delete relstat;
|
||||||
printer().close();
|
printer().close();
|
||||||
@ -299,6 +330,23 @@ void TRiepilogoGiornaliero::azzera_righe()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TRiepilogoGiornaliero::stampa_punto(TString16 punto)
|
||||||
|
{
|
||||||
|
TPrintrow row;
|
||||||
|
TString256 rigastampa;
|
||||||
|
rigastampa = "Punto: ";
|
||||||
|
rigastampa << punto;
|
||||||
|
rigastampa << " ";
|
||||||
|
TTable ldn("LDN");
|
||||||
|
ldn.put("CODTAB",punto);
|
||||||
|
if (ldn.read() == NOERR)
|
||||||
|
rigastampa << ldn.get("S0");
|
||||||
|
rigastampa.center_just(80);
|
||||||
|
row.put(rigastampa);
|
||||||
|
printer().setheaderline(1, row);
|
||||||
|
stampa_tutto();
|
||||||
|
}
|
||||||
|
|
||||||
void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot)
|
void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot)
|
||||||
{
|
{
|
||||||
TPrintrow row;
|
TPrintrow row;
|
||||||
@ -330,7 +378,13 @@ void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot)
|
|||||||
rigastampa.center_just(80);
|
rigastampa.center_just(80);
|
||||||
row.put(rigastampa);
|
row.put(rigastampa);
|
||||||
printer().setheaderline(1, row);
|
printer().setheaderline(1, row);
|
||||||
|
stampa_tutto();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TRiepilogoGiornaliero::stampa_tutto()
|
||||||
|
{
|
||||||
|
TPrintrow row;
|
||||||
|
TString256 rigastampa;
|
||||||
TRigaG rigatotali(NULLDATE);
|
TRigaG rigatotali(NULLDATE);
|
||||||
TDate data = _dataini;
|
TDate data = _dataini;
|
||||||
real totaledata = ZERO;
|
real totaledata = ZERO;
|
||||||
@ -361,7 +415,7 @@ void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot)
|
|||||||
}
|
}
|
||||||
// stampa totali per sezione
|
// stampa totali per sezione
|
||||||
rigastampa = "";
|
rigastampa = "";
|
||||||
rigastampa.fill('-');
|
rigastampa.fill('-',80);
|
||||||
row.reset();
|
row.reset();
|
||||||
row.put(rigastampa);
|
row.put(rigastampa);
|
||||||
printer().print(row);
|
printer().print(row);
|
||||||
@ -415,7 +469,7 @@ void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot)
|
|||||||
}
|
}
|
||||||
// stampa totali per sezione
|
// stampa totali per sezione
|
||||||
rigastampa = "";
|
rigastampa = "";
|
||||||
rigastampa.fill('-');
|
rigastampa.fill('-',80);
|
||||||
row.reset();
|
row.reset();
|
||||||
row.put(rigastampa);
|
row.put(rigastampa);
|
||||||
printer().print(row);
|
printer().print(row);
|
||||||
@ -460,50 +514,54 @@ bool TRiepilogoGiornaliero::riepilogo()
|
|||||||
a.put(DON_DATADON, _datafin);
|
a.put(DON_DATADON, _datafin);
|
||||||
_cur = new TCursor(_rel, "", 2, &da, &a);
|
_cur = new TCursor(_rel, "", 2, &da, &a);
|
||||||
TString256 filtro = "";
|
TString256 filtro = "";
|
||||||
|
|
||||||
// filtro per sezione/sottogruppo
|
// filtro per sezione/sottogruppo
|
||||||
if (_sezini.not_empty())
|
if (_sezini.not_empty())
|
||||||
{
|
{
|
||||||
if (filtro.empty())
|
if (_sotini.not_empty())
|
||||||
filtro = format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
|
{
|
||||||
else
|
filtro << "(";
|
||||||
{
|
filtro << format("(92->CODSEZ > \"%s\")",(const char*)_sezini);
|
||||||
filtro << " && ";
|
filtro << " || ";
|
||||||
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
|
filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezini);
|
||||||
}
|
filtro << " && ";
|
||||||
if (_sotini.not_empty())
|
filtro << format("(92->CODSOT >= \"%s\")",(const char*)_sotini);
|
||||||
{
|
filtro << ")";
|
||||||
if (filtro.empty())
|
filtro << ")";
|
||||||
filtro = format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
|
}
|
||||||
else
|
else
|
||||||
{
|
filtro << format("(92->CODSEZ >= \"%s\")",(const char*)_sezini);
|
||||||
filtro << " && ";
|
}
|
||||||
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
|
if (_sezfin.not_empty())
|
||||||
}
|
{
|
||||||
}
|
if (filtro.not_empty())
|
||||||
|
filtro << " && ";
|
||||||
|
|
||||||
|
if (_sotfin.not_empty())
|
||||||
|
{
|
||||||
|
filtro << "(";
|
||||||
|
filtro << format("(92->CODSEZ < \"%s\")",(const char*)_sezfin);
|
||||||
|
filtro << " || ";
|
||||||
|
filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezfin);
|
||||||
|
filtro << " && ";
|
||||||
|
filtro << format("(92->CODSOT <= \"%s\")",(const char*)_sotfin);
|
||||||
|
filtro << ")";
|
||||||
|
filtro << ")";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
filtro << format("(92->CODSEZ <= \"%s\")",(const char*)_sezfin);
|
||||||
}
|
}
|
||||||
if (_sezfin.not_empty())
|
if (_punto.not_empty())
|
||||||
{
|
{
|
||||||
if (filtro.empty())
|
if (filtro.empty())
|
||||||
filtro = format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
|
filtro = format("(92->LUOGODON == \"%s\")",(const char*)_punto);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filtro << " && ";
|
filtro << " && ";
|
||||||
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
|
filtro << format("(92->LUOGODON == \"%s\")",(const char*)_punto);
|
||||||
}
|
}
|
||||||
if (_sotfin.not_empty())
|
|
||||||
{
|
|
||||||
if (filtro.empty())
|
|
||||||
filtro = format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filtro << " && ";
|
|
||||||
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_cur->setfilter((const char*) filtro, TRUE);
|
_cur->setfilter((const char*) filtro, TRUE);
|
||||||
TString16 codsez, codsot, tipodon;
|
TString16 codsez, codsot, punto, tipodon;
|
||||||
int anno, mese, giorno;
|
int anno, mese, giorno;
|
||||||
TDate data;
|
TDate data;
|
||||||
long numero;
|
long numero;
|
||||||
@ -515,6 +573,7 @@ bool TRiepilogoGiornaliero::riepilogo()
|
|||||||
for ( *_cur=0; _cur->pos() < last; ++(*_cur) )
|
for ( *_cur=0; _cur->pos() < last; ++(*_cur) )
|
||||||
{
|
{
|
||||||
prg.addstatus(1);
|
prg.addstatus(1);
|
||||||
|
punto = recdon.get(DON_LUOGODON);
|
||||||
codsez = recdon.get(DON_CODSEZ);
|
codsez = recdon.get(DON_CODSEZ);
|
||||||
codsot = recdon.get(DON_CODSOT);
|
codsot = recdon.get(DON_CODSOT);
|
||||||
if (codsez.empty())
|
if (codsez.empty())
|
||||||
@ -529,8 +588,13 @@ bool TRiepilogoGiornaliero::riepilogo()
|
|||||||
tipodon = recdon.get(DON_TIPODON);
|
tipodon = recdon.get(DON_TIPODON);
|
||||||
primadon = recdon.get_bool(DON_PRIMADON);
|
primadon = recdon.get_bool(DON_PRIMADON);
|
||||||
stat.zero();
|
stat.zero();
|
||||||
stat.put(ATS_CODSEZ, codsez);
|
if (_suddivisa == 'S')
|
||||||
stat.put(ATS_CODSOT, codsot);
|
{
|
||||||
|
stat.put(ATS_CODSEZ, codsez);
|
||||||
|
stat.put(ATS_CODSOT, codsot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stat.put(ATS_PUNTO, punto);
|
||||||
//stat.put(ATS_DATA, data);
|
//stat.put(ATS_DATA, data);
|
||||||
stat.put(ATS_ANNO, anno);
|
stat.put(ATS_ANNO, anno);
|
||||||
stat.put(ATS_MESE, mese);
|
stat.put(ATS_MESE, mese);
|
||||||
@ -552,8 +616,13 @@ bool TRiepilogoGiornaliero::riepilogo()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
stat.zero();
|
stat.zero();
|
||||||
stat.put(ATS_CODSEZ, codsez);
|
if (_suddivisa == 'S')
|
||||||
stat.put(ATS_CODSOT, codsot);
|
{
|
||||||
|
stat.put(ATS_CODSEZ, codsez);
|
||||||
|
stat.put(ATS_CODSOT, codsot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stat.put(ATS_PUNTO, punto);
|
||||||
stat.put(ATS_ANNO, anno);
|
stat.put(ATS_ANNO, anno);
|
||||||
stat.put(ATS_MESE, mese);
|
stat.put(ATS_MESE, mese);
|
||||||
stat.put(ATS_GIORNO, giorno);
|
stat.put(ATS_GIORNO, giorno);
|
||||||
|
@ -13,3 +13,6 @@
|
|||||||
#define F_DATAINI 301
|
#define F_DATAINI 301
|
||||||
#define F_DATAFIN 302
|
#define F_DATAFIN 302
|
||||||
#define F_PRIMEDON 303
|
#define F_PRIMEDON 303
|
||||||
|
#define F_SUDDIVISA 304
|
||||||
|
#define F_PUNTO 305
|
||||||
|
#define F_D_PUNTO 306
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "at3500a.h"
|
#include "at3500a.h"
|
||||||
|
|
||||||
PAGE "Riepilogo giornaliero donazioni" -1 -1 78 12
|
PAGE "Riepilogo giornaliero donazioni" -1 -1 78 15
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 77 4
|
GROUPBOX DLG_NULL 77 4
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -117,7 +117,7 @@ BEGIN
|
|||||||
HELP "Sottogruppo finale"
|
HELP "Sottogruppo finale"
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 77 4
|
GROUPBOX DLG_NULL 77 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 5 "Opzioni per il riepilogo"
|
PROMPT 1 5 "Opzioni per il riepilogo"
|
||||||
END
|
END
|
||||||
@ -139,6 +139,38 @@ BEGIN
|
|||||||
PROMPT 2 7 "Riepilogo per prime donazioni"
|
PROMPT 2 7 "Riepilogo per prime donazioni"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
RADIOBUTTON F_SUDDIVISA 75
|
||||||
|
BEGIN
|
||||||
|
FLAG "Z"
|
||||||
|
PROMPT 2 8 "Stampa per"
|
||||||
|
ITEM "S|Sezione/Sottogruppo"
|
||||||
|
MESSAGE CLEAR, F_PUNTO
|
||||||
|
MESSAGE DISABLE, F_PUNTO
|
||||||
|
ITEM "P|Punto di prelievo"
|
||||||
|
MESSAGE ENABLE, F_PUNTO
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_PUNTO 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 11 "Punto "
|
||||||
|
FLAGS "U"
|
||||||
|
USE LDN
|
||||||
|
INPUT CODTAB F_PUNTO
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@40" S0
|
||||||
|
OUTPUT F_PUNTO CODTAB
|
||||||
|
OUTPUT F_D_PUNTO S0
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
WARNING "Codice punto di prelievo non presente"
|
||||||
|
HELP "Punto di prelievo"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_D_PUNTO 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 15 11 ""
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
BUTTON DLG_OK 9 2
|
BUTTON DLG_OK 9 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -12 -1 ""
|
PROMPT -12 -1 ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user