Patch level : 1.7 at 720
Files correlati : at4.exe at9.exe Ricompilazione Demo : [ ] Commento : Convocazioni per sezione: sistemata stampa cartoline Aggiornamento dati da estrazione: sistemato benemerenze e storico git-svn-id: svn://10.65.10.50/trunk@12769 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4e1ab308ed
commit
61c80a6662
@ -146,7 +146,17 @@ void TStampaConvocazioni::set_page(int file, int cnt)
|
||||
for (int r=1;r<=_etcolonne;r++)
|
||||
{
|
||||
if (current_cursor()->pos()<current_cursor()->items())
|
||||
{
|
||||
{
|
||||
bool avanza = TRUE;
|
||||
while (avanza)
|
||||
{
|
||||
if (current_cursor()->pos()<current_cursor()->items())
|
||||
avanza = !(preprocess_page(file, cnt));
|
||||
else
|
||||
avanza = FALSE;
|
||||
if (avanza)
|
||||
++(*current_cursor());
|
||||
}
|
||||
force_setpage(TRUE);
|
||||
corpo.update();
|
||||
for (word i = 0; i < corpo.height(); i++)
|
||||
@ -161,7 +171,17 @@ void TStampaConvocazioni::set_page(int file, int cnt)
|
||||
set_row(i+1,riga1);
|
||||
}
|
||||
if (r < _etcolonne)
|
||||
++(*current_cursor());
|
||||
{
|
||||
bool avanza = TRUE;
|
||||
while (avanza)
|
||||
{
|
||||
++(*current_cursor());
|
||||
if (current_cursor()->pos()<current_cursor()->items())
|
||||
avanza = !(preprocess_page(file, cnt));
|
||||
else
|
||||
avanza = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
172
at/at9300.cpp
172
at/at9300.cpp
@ -41,6 +41,9 @@ class TProv2com: public TSkeleton_application
|
||||
TLocalisamfile* _soggetti;
|
||||
TRecord_array* _sdonazioni; // sheet donazioni
|
||||
TRecord_array* _scontrolli; // sheet controlli
|
||||
TRecord_array* _sidoneita; // sheet idoneita
|
||||
TRecord_array* _sbenem; // sheet benemerenze
|
||||
TRecord_array* _sstorico; // sheet storico
|
||||
long _lastcod;
|
||||
bool _print_header;
|
||||
|
||||
@ -51,6 +54,8 @@ protected:
|
||||
void agg_anagrafica(const TRectype& recsog, const bool aggiorna);
|
||||
void agg_donazione(const TRectype& recsog, const TRectype& recdon);
|
||||
void agg_controllo(const TRectype& recsog, const TRectype& reccon);
|
||||
void agg_benemerenza(const TRectype& recsog, const TRectype& recben);
|
||||
void agg_storico(const TRectype& recsog, const TRectype& recsto);
|
||||
void transfer();
|
||||
void print_line(const TString& message="");
|
||||
|
||||
@ -60,7 +65,7 @@ public:
|
||||
virtual ~TProv2com() {}
|
||||
};
|
||||
|
||||
static int compare_date(const TObject** o1, const TObject** o2)
|
||||
static int compare_date_con(const TObject** o1, const TObject** o2)
|
||||
{
|
||||
const TRectype& s1 = *((TRectype*)*o1);
|
||||
const TRectype& s2 = *((TRectype*)*o2);
|
||||
@ -75,6 +80,36 @@ static int compare_date(const TObject** o1, const TObject** o2)
|
||||
return d;
|
||||
}
|
||||
|
||||
static int compare_date_ben(const TObject** o1, const TObject** o2)
|
||||
{
|
||||
const TRectype& s1 = *((TRectype*)*o1);
|
||||
const TRectype& s2 = *((TRectype*)*o2);
|
||||
|
||||
const TDate d1(s1.get(BEN_DATABEN));
|
||||
const TDate d2(s2.get(BEN_DATABEN));
|
||||
|
||||
int d=0;
|
||||
if (d1>d2) d=+1;
|
||||
else
|
||||
if (d1<d2) d=-1;
|
||||
return d;
|
||||
}
|
||||
|
||||
static int compare_date_sto(const TObject** o1, const TObject** o2)
|
||||
{
|
||||
const TRectype& s1 = *((TRectype*)*o1);
|
||||
const TRectype& s2 = *((TRectype*)*o2);
|
||||
|
||||
const TDate d1(s1.get(STO_DATAISC));
|
||||
const TDate d2(s2.get(STO_DATAISC));
|
||||
|
||||
int d=0;
|
||||
if (d1>d2) d=+1;
|
||||
else
|
||||
if (d1<d2) d=-1;
|
||||
return d;
|
||||
}
|
||||
|
||||
// restituisce un riferimento all' applicazione
|
||||
inline TProv2com& app() { return (TProv2com&) main_app();}
|
||||
|
||||
@ -86,12 +121,18 @@ bool TProv2com::create()
|
||||
_soggetti = new TLocalisamfile(LF_SOGGETTI);
|
||||
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
|
||||
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
|
||||
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
|
||||
_sbenem = new TRecord_array(LF_BENEM,BEN_PROGBEN);
|
||||
_sstorico = new TRecord_array(LF_STORICO,STO_PROGSTO);
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
// distruzione dell'applicazione
|
||||
bool TProv2com::destroy()
|
||||
{
|
||||
delete _sstorico;
|
||||
delete _sbenem;
|
||||
delete _sidoneita;
|
||||
delete _scontrolli;
|
||||
delete _sdonazioni;
|
||||
delete _soggetti;
|
||||
@ -224,7 +265,7 @@ void TProv2com::transfer()
|
||||
{
|
||||
const long codice = cursore.curr(LF_BENEM).get_long(BEN_CODICE);
|
||||
if (codice == codsog)
|
||||
//fileben.write(cursore.curr(LF_BENEM));
|
||||
agg_benemerenza(cursore.curr(), cursore.curr(LF_BENEM));
|
||||
continua = cursore.next_match(LF_BENEM, "CODICE");
|
||||
}
|
||||
}
|
||||
@ -235,7 +276,7 @@ void TProv2com::transfer()
|
||||
{
|
||||
const long codice = cursore.curr(LF_STORICO).get_long(STO_CODICE);
|
||||
if (codice == codsog)
|
||||
//filesto.write(cursore.curr(LF_STORICO));
|
||||
agg_storico(cursore.curr(), cursore.curr(LF_STORICO));
|
||||
continua = cursore.next_match(LF_STORICO, "CODICE");
|
||||
}
|
||||
}
|
||||
@ -294,7 +335,9 @@ void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
||||
TString80 campo(recsog.fieldname(i));
|
||||
if (campo.not_empty())
|
||||
{
|
||||
const char operazione = _configfile->get(campo, "SOGGETTI")[0];
|
||||
char operazione = _configfile->get(campo, "SOGGETTI")[0];
|
||||
if (operazione == ' ')
|
||||
operazione = X_IGNORA;
|
||||
TString esterno = recsog.get(campo);
|
||||
TString interno = rec.get(campo);
|
||||
if (esterno != interno)
|
||||
@ -404,7 +447,8 @@ void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
||||
rec.put(SOG_UTENULTAGG, "PROV");
|
||||
_soggetti->rewrite(rec);
|
||||
if (!_print_header)
|
||||
{
|
||||
{
|
||||
print_line();
|
||||
print_line(intestazione);
|
||||
_print_header = TRUE;
|
||||
}
|
||||
@ -454,15 +498,20 @@ void TProv2com::agg_controllo(const TRectype& recsog, const TRectype& reccon)
|
||||
recnew.put(CON_CODICE, rec.get_long(SOG_CODICE));
|
||||
recnew.put(CON_PROGCON, _scontrolli->rows()+1);
|
||||
_scontrolli->add_row(recnew);
|
||||
_scontrolli->sort(compare_date);
|
||||
_scontrolli->sort(compare_date_con);
|
||||
_scontrolli->rewrite();
|
||||
calcola_donazioni_lib(rec, _sdonazioni);
|
||||
TRectype* keyi = new TRectype(LF_IDONEITA);
|
||||
keyi->put(IDO_CODICE, rec.get(SOG_CODICE));
|
||||
err = _sidoneita->read(keyi);
|
||||
con_reord(rec, _scontrolli, _sidoneita);
|
||||
don_datepross(rec);
|
||||
TDate oggi(TODAY);
|
||||
rec.put(SOG_DATAULTAGG, oggi);
|
||||
rec.put(SOG_UTENULTAGG, "PROV");
|
||||
_soggetti->rewrite(rec);
|
||||
if (!_print_header)
|
||||
{
|
||||
{
|
||||
print_line();
|
||||
print_line(intestazione);
|
||||
_print_header = TRUE;
|
||||
}
|
||||
@ -473,6 +522,113 @@ void TProv2com::agg_controllo(const TRectype& recsog, const TRectype& reccon)
|
||||
}
|
||||
}
|
||||
|
||||
void TProv2com::agg_benemerenza(const TRectype& recsog, const TRectype& recben)
|
||||
{
|
||||
TString intestazione = "";
|
||||
TString message = "";
|
||||
const TString80 cognome = recsog.get(SOG_COGNOME);
|
||||
const TString80 nome = recsog.get(SOG_NOME);
|
||||
const TDate datanasc = recsog.get_date(SOG_DATANASC);
|
||||
_soggetti->setkey(2);
|
||||
TRectype& rec = _rel->curr();
|
||||
rec.zero();
|
||||
rec.put(SOG_COGNOME, cognome);
|
||||
rec.put(SOG_NOME, nome);
|
||||
rec.put(SOG_DATANASC, datanasc);
|
||||
intestazione = cognome;
|
||||
intestazione << " ";
|
||||
intestazione << nome;
|
||||
intestazione << " ";
|
||||
intestazione << datanasc.string();
|
||||
if (_soggetti->read(rec)==NOERR)
|
||||
{
|
||||
const TString16& tipoben = recben.get(BEN_TIPOBEN);
|
||||
TLocalisamfile benem(LF_BENEM);
|
||||
benem.setkey(3);
|
||||
benem.zero();
|
||||
benem.put(BEN_CODICE, rec.get(SOG_CODICE));
|
||||
benem.put(BEN_TIPOBEN, tipoben);
|
||||
if (benem.read()==NOERR)
|
||||
{
|
||||
// esiste gia la benemerenza
|
||||
}
|
||||
else
|
||||
{
|
||||
TRectype* key = new TRectype(LF_BENEM);
|
||||
key->put(BEN_CODICE, rec.get(SOG_CODICE));
|
||||
int err = _sbenem->read(key);
|
||||
TRectype recnew(recben);
|
||||
recnew.put(BEN_CODICE, rec.get_long(SOG_CODICE));
|
||||
recnew.put(BEN_PROGBEN, _sbenem->rows()+1);
|
||||
_sbenem->add_row(recnew);
|
||||
_sbenem->sort(compare_date_ben);
|
||||
_sbenem->rewrite();
|
||||
TDate oggi(TODAY);
|
||||
rec.put(SOG_DATAULTAGG, oggi);
|
||||
rec.put(SOG_UTENULTAGG, "PROV");
|
||||
_soggetti->rewrite(rec);
|
||||
if (!_print_header)
|
||||
{
|
||||
print_line();
|
||||
print_line(intestazione);
|
||||
_print_header = TRUE;
|
||||
}
|
||||
message.format(" INSERITA BENEMERENZA %s", (const char*) tipoben);
|
||||
print_line(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TProv2com::agg_storico(const TRectype& recsog, const TRectype& recsto)
|
||||
{
|
||||
TString intestazione = "";
|
||||
TString message = "";
|
||||
const TString80 cognome = recsog.get(SOG_COGNOME);
|
||||
const TString80 nome = recsog.get(SOG_NOME);
|
||||
const TDate datanasc = recsog.get_date(SOG_DATANASC);
|
||||
_soggetti->setkey(2);
|
||||
TRectype& rec = _rel->curr();
|
||||
rec.zero();
|
||||
rec.put(SOG_COGNOME, cognome);
|
||||
rec.put(SOG_NOME, nome);
|
||||
rec.put(SOG_DATANASC, datanasc);
|
||||
intestazione = cognome;
|
||||
intestazione << " ";
|
||||
intestazione << nome;
|
||||
intestazione << " ";
|
||||
intestazione << datanasc.string();
|
||||
if (_soggetti->read(rec)==NOERR)
|
||||
{
|
||||
TRectype recnew(recsto);
|
||||
recnew.put(STO_CODICE, rec.get_long(SOG_CODICE));
|
||||
TRectype* key = new TRectype(LF_STORICO);
|
||||
key->put(STO_CODICE, rec.get(SOG_CODICE));
|
||||
int err = _sstorico->read(key);
|
||||
const int progsto = recsto.get_int(STO_PROGSTO);
|
||||
TLocalisamfile storico(LF_STORICO);
|
||||
storico.setkey(1);
|
||||
storico.zero();
|
||||
storico.put(STO_CODICE, rec.get(SOG_CODICE));
|
||||
storico.put(STO_PROGSTO, progsto);
|
||||
if (storico.read()!=NOERR)
|
||||
recnew.put(STO_PROGSTO, _sstorico->rows()+1);
|
||||
_sstorico->add_row(recnew);
|
||||
_sstorico->sort(compare_date_sto);
|
||||
_sstorico->rewrite();
|
||||
TDate oggi(TODAY);
|
||||
rec.put(SOG_DATAULTAGG, oggi);
|
||||
rec.put(SOG_UTENULTAGG, "PROV");
|
||||
_soggetti->rewrite(rec);
|
||||
if (!_print_header)
|
||||
{
|
||||
print_line();
|
||||
print_line(intestazione);
|
||||
_print_header = TRUE;
|
||||
}
|
||||
message.format(" INSERITA RIGA DI STORICO");
|
||||
print_line(message);
|
||||
}
|
||||
}
|
||||
|
||||
int at9300(int argc, char* argv[])
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user