Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Programmi vari per AVIS (non a menu)


git-svn-id: svn://10.65.10.50/trunk@6399 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1998-03-20 13:39:02 +00:00
parent 2d7298502f
commit 29add7546a
6 changed files with 488 additions and 42 deletions

@ -13,6 +13,7 @@
#include "soggetti.h"
#include "contsan.h"
#include "idoneita.h"
#include "sezioni.h"
class TRiordinaControlli : public TPrintapp
{
@ -32,11 +33,32 @@ protected:
virtual bool preprocess_page(int file, int counter);
public:
void filtra_sezioni();
TRiordinaControlli() {}
};
HIDDEN inline TRiordinaControlli& app() { return (TRiordinaControlli&) main_app(); }
void TRiordinaControlli::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a (LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TRiordinaControlli::preprocess_page(int file, int counter)
{
bool rewrite = FALSE;
@ -62,8 +84,6 @@ bool TRiordinaControlli::preprocess_page(int file, int counter)
void TRiordinaControlli::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
//set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
//set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME));
}
bool TRiordinaControlli::set_print(int)
@ -76,15 +96,21 @@ bool TRiordinaControlli::set_print(int)
TRectype a(LF_SOGGETTI);
const long codini = _msk->get_long(F_CODINI);
const long codfin = _msk->get_long(F_CODFIN);
da.zero();
a.zero();
if (codini != 0)
da.put(SOG_CODICE, codini);
if (codfin != 0)
a.put(SOG_CODICE, codfin);
current_cursor()->setregion(da,a);
//current_cursor()->setfilter(format("STATO == \"RF\""));
if ((codini != 0) || (codfin != 0))
{
da.zero();
a.zero();
if (codini != 0)
da.put(SOG_CODICE, codini);
if (codfin != 0)
a.put(SOG_CODICE, codfin);
_cur = add_cursor(new TCursor(_rel,"", 1, &da, &a));
}
else
{
_cur = add_cursor(new TCursor(_rel,"", 3));
filtra_sezioni();
}
reset_files();
add_file(LF_SOGGETTI);
reset_print();
@ -102,7 +128,6 @@ bool TRiordinaControlli::user_create()
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
_idoneita = new TLocalisamfile(LF_IDONEITA);
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
_cur = add_cursor(new TCursor(_rel, "", 1));
long items = _rel->lfile().items();
return TRUE;
}

@ -1,3 +1,12 @@
// riordino controlli
#define F_CODINI 101
#define F_CODFIN 102
#define F_SEZINI 103
#define F_D_SEZINI 104
#define F_SOTINI 105
#define F_D_SOTINI 106
#define F_SEZFIN 107
#define F_D_SEZFIN 108
#define F_SOTFIN 109
#define F_D_SOTFIN 110

@ -1,19 +1,130 @@
#include "at4800a.h"
#include "at7600a.h"
PAGE "Riordina controlli" -1 -1 78 20
NUMBER F_CODINI 9
BEGIN
PROMPT 2 2 "Codice iniziale "
PROMPT 2 10 "Codice iniziale "
HELP "Codice soggetto iniziale (vuoto = inizio)"
END
NUMBER F_CODFIN 9
BEGIN
PROMPT 2 3 "Codice finale "
PROMPT 2 11 "Codice finale "
HELP "Codice soggetto finale (vuoto = fine)"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
INPUT CODSOT F_SOTINI
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZINI CODSEZ
OUTPUT F_D_SEZINI DENSEZ
OUTPUT F_SOTINI CODSOT
OUTPUT F_D_SOTINI DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da cui partire"
END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZINI
CHECKTYPE NORMAL
HELP "Sezione da cui partire"
END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
INPUT DENSOT F_D_SOTINI
COPY DISPLAY F_D_SEZINI
COPY OUTPUT F_D_SEZINI
CHECKTYPE NORMAL
HELP "Sottogruppo da cui partire"
END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
INPUT CODSOT F_SOTFIN
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZFIN CODSEZ
OUTPUT F_D_SEZFIN DENSEZ
OUTPUT F_SOTFIN CODSOT
OUTPUT F_D_SOTFIN DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione finale"
END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZFIN
CHECKTYPE NORMAL
HELP "Sezione finale"
END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
INPUT DENSOT F_D_SOTFIN
COPY DISPLAY F_D_SEZFIN
COPY OUTPUT F_D_SEZFIN
CHECKTYPE NORMAL
HELP "Sottogruppo finale"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 14 ""

@ -1,20 +1,28 @@
#include <mask.h>
#include <printapp.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include <recarray.h>
//#include <utility.h>
#include "at7.h"
#include "atlib.h"
#include "at7800a.h"
// nomi dei campi
#include "soggetti.h"
#include "contsan.h"
#include "idoneita.h"
#include "sezioni.h"
class TCatvuota_app : public TPrintapp
class TRiminiRO_app : public TPrintapp
{
TMask* _msk;
TRelation* _rel;
TLocalisamfile* _contsan;
TRecord_array* _scontrolli;
TLocalisamfile* _idoneita;
TRecord_array* _sidoneita;
int _cur;
TString16 _catavi;
TDate _datarif;
protected:
virtual bool user_create();
@ -24,62 +32,210 @@ protected:
virtual bool preprocess_page(int file, int counter);
public:
TCatvuota_app() {}
void filtra_sezioni();
TRiminiRO_app() {}
};
HIDDEN inline TCatvuota_app& app() { return (TCatvuota_app&) main_app(); }
HIDDEN inline TRiminiRO_app& app() { return (TRiminiRO_app&) main_app(); }
bool TCatvuota_app::preprocess_page(int file, int counter)
void TRiminiRO_app::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a (LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TRiminiRO_app::preprocess_page(int file, int counter)
{
bool rewrite = FALSE;
TRectype& recsog = current_cursor()->curr();
recsog.put(SOG_CATDON, _catavi);
current_cursor()->file().rewrite();
return TRUE;
const long codice = recsog.get_long(SOG_CODICE);
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, codice);
int err = _scontrolli->read(keyc);
if (err == NOERR)
{
TDate primocon(NULLDATE);
TString16 tipocon;
int numido = 0;
int numcon = 0;
for (int c=1; c<=_scontrolli->rows(); c++)
{
TRectype& riga = _scontrolli->row(c, TRUE);
tipocon = riga.get(CON_TIPOCON);
TDate datacon = riga.get_date(CON_DATACON);
// mi segno la data del primo controllo per inserire una PI
// il giorno prima nei donatori che non hanno l'idoneita'
if (c==1)
primocon = datacon;
// se il controllo è avvenuto prima della data di riferimento
if (datacon <= _datarif)
{
if (tipocon == "RO")
{
numcon++;
riga.put(CON_TIPOCON,"R1");
riga.put(CON_IDON1," ");
riga.put(CON_IDON2," ");
riga.put(CON_IDON3," ");
riga.put(CON_IDON4," ");
riga.put(CON_INTSI,0);
riga.put(CON_INTAF,0);
}
if (tipocon == "ID")
{
TString16 motivo = riga.get(CON_MOTIVO);
TString80 responsab = riga.get(CON_RESPONSAB);
if (motivo.empty() && responsab.empty())
{
numcon++;
riga.put(CON_TIPOCON,"V1");
riga.put(CON_IDON1," ");
riga.put(CON_IDON2," ");
riga.put(CON_IDON3," ");
riga.put(CON_IDON4," ");
riga.put(CON_INTSI,0);
riga.put(CON_INTAF,0);
}
}
}
tipocon = riga.get(CON_TIPOCON);
if ((tipocon == "ID") || (tipocon == "RO") || (tipocon == "PI"))
{
numido++;
if (!((riga.get(CON_IDON1) == "PL") || (riga.get(CON_IDON2) == "PL") || (riga.get(CON_IDON3) == "PL") || (riga.get(CON_IDON4) == "PL")))
riga.put(CON_INTAF,0);
if ((riga.get(CON_IDON1).empty()) && (riga.get(CON_IDON2).empty()) && (riga.get(CON_IDON3).empty()) && (riga.get(CON_IDON4).empty()))
{
riga.put(CON_IDON1, "SI");
riga.put(CON_INTSI, recsog.get(SOG_INTSI));
if (recsog.get_int(SOG_INTSI) == 0)
riga.put(CON_INTSI, 94);
}
}
}
if ((numido == 0) && (numcon > 0))
{
--primocon;
TRectype riga(LF_CONTSAN);
riga.put(CON_CODICE, codice);
riga.put(CON_PROGCON, 1);
riga.put(CON_DATACON, primocon);
riga.put(CON_TIPOCON, "PI");
riga.put(CON_IDON1, recsog.get(SOG_IDON1));
riga.put(CON_IDON2, recsog.get(SOG_IDON2));
riga.put(CON_IDON3, recsog.get(SOG_IDON3));
riga.put(CON_IDON4, recsog.get(SOG_IDON4));
riga.put(CON_INTSI, recsog.get(SOG_INTSI));
riga.put(CON_INTAF, recsog.get(SOG_INTAF));
riga.put(CON_RESPONSAB, "CONVERSIONE");
if (!((riga.get(CON_IDON1) == "PL") || (riga.get(CON_IDON2) == "PL") || (riga.get(CON_IDON3) == "PL") || (riga.get(CON_IDON4) == "PL")))
riga.put(CON_INTAF,0);
_scontrolli->insert_row(riga);
}
if ((numcon > 0) || (numido > 0))
_scontrolli->rewrite();
}
TRectype* keyi = new TRectype(LF_IDONEITA);
keyi->put(IDO_CODICE, codice);
int erri = _sidoneita->read(keyi);
if ((err == NOERR || erri == NOERR) && (_scontrolli->rows() > 0 || _sidoneita->rows() > 0))
{
con_reord(recsog,_scontrolli, _sidoneita);
rewrite = TRUE;
}
if (rewrite)
current_cursor()->file().rewrite();
return rewrite;
}
void TCatvuota_app::set_page(int file, int cnt)
void TRiminiRO_app::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@62g@S", FLD(LF_SOGGETTI,SOG_CATDON));
}
bool TCatvuota_app::set_print(int)
bool TRiminiRO_app::set_print(int)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
reset_files();
{
_datarif = _msk->get_date(F_DATARIF);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
const long codini = _msk->get_long(F_CODINI);
const long codfin = _msk->get_long(F_CODFIN);
if ((codini != 0) || (codfin != 0))
{
da.zero();
a.zero();
if (codini != 0)
da.put(SOG_CODICE, codini);
if (codfin != 0)
a.put(SOG_CODICE, codfin);
TString filtro;
if ((sezini == sezfin) && (sotini == sotfin))
filtro << SOG_CODSEZ << " == \"" << sezini << "\"";
else
filtro = "";
_cur = add_cursor(new TCursor(_rel,filtro, 1, &da, &a));
}
else
{
_cur = add_cursor(new TCursor(_rel,"", 3));
filtra_sezioni();
}
reset_files();
add_file(LF_SOGGETTI);
reset_print();
_catavi = "AV";
current_cursor()->setfilter("(CATDON == \"\")", TRUE);
return TRUE;
}
else
return FALSE;
}
bool TCatvuota_app::user_create()
bool TRiminiRO_app::user_create()
{
_msk = new TMask("at7800a");
_rel = new TRelation(LF_SOGGETTI);
_cur = add_cursor(new TCursor(_rel, "", 1));
_contsan = new TLocalisamfile(LF_CONTSAN);
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
_idoneita = new TLocalisamfile(LF_IDONEITA);
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
return TRUE;
}
bool TCatvuota_app::user_destroy()
bool TRiminiRO_app::user_destroy()
{
delete _rel;
delete _msk;
delete _scontrolli;
delete _contsan;
delete _sidoneita;
delete _idoneita;
return TRUE;
}
int at7800(int argc, char* argv[])
{
TCatvuota_app a;
a.run(argc, argv, "Correzioni categorie vuote");
TRiminiRO_app a;
a.run(argc, argv, "Correzione controlli RO");
return 0;
}

15
at/at7800a.h Executable file

@ -0,0 +1,15 @@
// riordino controlli
#define F_CODINI 101
#define F_CODFIN 102
#define F_SEZINI 103
#define F_D_SEZINI 104
#define F_SOTINI 105
#define F_D_SOTINI 106
#define F_SEZFIN 107
#define F_D_SEZFIN 108
#define F_SOTFIN 109
#define F_D_SOTFIN 110
#define F_DATARIF 111

@ -1,4 +1,134 @@
PAGE "Correzione soggetti senza categoria don." -1 -1 78 20
#include "at7800a.h"
PAGE "Rimini: correzione controlli RO" -1 -1 78 20
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
INPUT CODSOT F_SOTINI
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZINI CODSEZ
OUTPUT F_D_SEZINI DENSEZ
OUTPUT F_SOTINI CODSOT
OUTPUT F_D_SOTINI DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da cui partire"
END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZINI
CHECKTYPE NORMAL
HELP "Sezione da cui partire"
END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
INPUT DENSOT F_D_SOTINI
COPY DISPLAY F_D_SEZINI
COPY OUTPUT F_D_SEZINI
CHECKTYPE NORMAL
HELP "Sottogruppo da cui partire"
END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
INPUT CODSOT F_SOTFIN
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZFIN CODSEZ
OUTPUT F_D_SEZFIN DENSEZ
OUTPUT F_SOTFIN CODSOT
OUTPUT F_D_SOTFIN DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione finale"
END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZFIN
CHECKTYPE NORMAL
HELP "Sezione finale"
END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
INPUT DENSOT F_D_SOTFIN
COPY DISPLAY F_D_SEZFIN
COPY OUTPUT F_D_SEZFIN
CHECKTYPE NORMAL
HELP "Sottogruppo finale"
END
NUMBER F_CODINI 9
BEGIN
PROMPT 2 5 "Codice iniziale "
HELP "Codice soggetto iniziale (vuoto = inizio)"
END
NUMBER F_CODFIN 9
BEGIN
PROMPT 2 6 "Codice finale "
HELP "Codice soggetto finale (vuoto = fine)"
END
DATE F_DATARIF
BEGIN
PROMPT 2 8 "Data di riferimento "
HELP "Data fino a cui modificare i RO"
END
BUTTON DLG_OK 9 2
BEGIN