Patch level : 1.7 at
Files correlati : at5.exe Ricompilazione Demo : [ ] Commento : stampa etichette in situazione sanitari git-svn-id: svn://10.65.10.50/trunk@12457 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
50ba8c7fb0
commit
06152123a2
169
at/at5200.cpp
169
at/at5200.cpp
@ -5,24 +5,21 @@
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "at5.h"
|
||||
|
||||
#define ALIAS_TCS 200
|
||||
#define ALIAS_LCPRES 101 // localita' postale di residenza
|
||||
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
|
||||
#define ALIAS_COMRES 502 // comune di residenza
|
||||
#define ALIAS_COMDOM 501 // comune di domicilio
|
||||
#define ALIAS_COMNAS 500 // comune di nascita
|
||||
|
||||
// nomi campi maschera
|
||||
#include "at5200a.h"
|
||||
|
||||
// nomi dei campi
|
||||
#include "soggetti.h"
|
||||
#include "contsan.h"
|
||||
#include "sezioni.h"
|
||||
#include <comuni.h>
|
||||
|
||||
#include "at5.h"
|
||||
#include "at5200a.h"
|
||||
#include "atlib.h"
|
||||
|
||||
#define ALIAS_TCS 200
|
||||
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
|
||||
#define ALIAS_COMDOM 501 // comune di domicilio
|
||||
|
||||
#define ETI_COGNOME 3 // numero campo cognome e nome in etichetta (deve essere sempre cosi') per famiglie
|
||||
|
||||
enum ts { undefined = 0, elenco = 1, etichette = 2 };
|
||||
|
||||
// definizione form per etichette
|
||||
@ -55,7 +52,7 @@ class TSitSanitaria : public TPrintapp
|
||||
TString16 _lettini, _lettfin;
|
||||
TParagraph_string _cognome_nome, _rigastampa, _dencom;
|
||||
ts _tipostampa;
|
||||
int _etlarghezza, _etcolonne;
|
||||
int _etlarghezza, _etcolonne, _etrighe, _etbordoini, _etbordofin, _netichette;
|
||||
|
||||
static bool filter_func_sitsanitaria(const TRelation* rel);
|
||||
|
||||
@ -148,22 +145,21 @@ void TSitSanitaria::filtra_sezioni()
|
||||
|
||||
bool TSitSanitaria::preprocess_page(int file, int counter)
|
||||
{
|
||||
if (_tipostampa == elenco)
|
||||
TRectype& recsog = current_cursor()->curr();
|
||||
if (_tipostampa==elenco)
|
||||
{
|
||||
TRectype& recsog = current_cursor()->curr();
|
||||
TString80 nome = recsog.get(SOG_COGNOME);
|
||||
nome << " ";
|
||||
nome << ' ';
|
||||
nome << recsog.get(SOG_NOME);
|
||||
_cognome_nome = nome;
|
||||
TString256 localita = "";
|
||||
localita = recsog.get(SOG_DOM_CAP);
|
||||
localita << ' ';
|
||||
if (recsog.get(SOG_DOM_CODLOC).not_empty())
|
||||
{
|
||||
localita << recsog.get(SOG_DOM_CAP);
|
||||
localita << " ";
|
||||
if (!recsog.get(SOG_DOM_CODLOC).blank())
|
||||
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
|
||||
localita << " - ";
|
||||
}
|
||||
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
|
||||
else
|
||||
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
|
||||
localita << ' ' << current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
|
||||
localita.trim();
|
||||
_dencom = localita;
|
||||
TDate data1(NULLDATE), data2(NULLDATE), data3(NULLDATE), data4(NULLDATE), data5(NULLDATE);
|
||||
@ -209,8 +205,8 @@ bool TSitSanitaria::preprocess_page(int file, int counter)
|
||||
}
|
||||
if (printer().rows_left() < 4)
|
||||
printer().formfeed();
|
||||
}
|
||||
if (_tipostampa==etichette)
|
||||
}
|
||||
if (_tipostampa==etichette && _etrighe == 0)
|
||||
if (printer().rows_left() < _form_eti->get_body().height())
|
||||
printer().formfeed();
|
||||
_contatore++;
|
||||
@ -223,16 +219,60 @@ void TSitSanitaria::set_page(int file, int cnt)
|
||||
switch (_tipostampa)
|
||||
{
|
||||
case etichette:
|
||||
{
|
||||
{
|
||||
TPrint_section& corpo = _form_eti->get_body();
|
||||
corpo.update();
|
||||
for (word i = 0; i < corpo.height(); i++)
|
||||
{
|
||||
TPrintrow& riga = corpo.row(i);
|
||||
set_row(i+1,riga);
|
||||
}
|
||||
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
|
||||
// altrimenti stampa sempre la stessa etichetta
|
||||
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);
|
||||
TForm_item& cognome = corpo.find_field(ETI_COGNOME);
|
||||
cognome.set(_cognome_nome);
|
||||
corpo.update();
|
||||
_contatore++;
|
||||
_netichette++;
|
||||
int nriga = 1;
|
||||
if (_etrighe > 0)
|
||||
{
|
||||
int resto = _netichette % (_etrighe*_etcolonne);
|
||||
if (resto > 0 && resto <= _etcolonne)
|
||||
nriga = nriga+_etbordoini;
|
||||
}
|
||||
for (word i = 0; i < corpo.height(); i++)
|
||||
{
|
||||
TPrintrow& riga = corpo.row(i);
|
||||
TString256 riga1 = riga.row();
|
||||
riga1.cut(_etlarghezza);
|
||||
int colonna = ((r-1)*_etlarghezza);
|
||||
TString16 formato;
|
||||
formato << '@' << colonna << 'g';
|
||||
riga1.insert(formato,0);
|
||||
set_row(nriga++,riga1);
|
||||
}
|
||||
if (r < _etcolonne)
|
||||
{
|
||||
bool avanza = TRUE;
|
||||
while (avanza)
|
||||
{
|
||||
++(*current_cursor());
|
||||
if (current_cursor()->pos()<current_cursor()->items())
|
||||
avanza = !(preprocess_page(file, cnt));
|
||||
else
|
||||
avanza = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case elenco:
|
||||
@ -308,7 +348,9 @@ void TSitSanitaria::header_sezione(const TString16 codsez, const TString16 codso
|
||||
}
|
||||
|
||||
bool TSitSanitaria::set_print(int)
|
||||
{
|
||||
{
|
||||
TPrinter& p = printer();
|
||||
p.read_configuration();
|
||||
_tipostampa = undefined;
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
@ -320,8 +362,8 @@ bool TSitSanitaria::set_print(int)
|
||||
_codsot = "**";
|
||||
break;
|
||||
case F_ETICHETTE:
|
||||
_tipostampa = etichette;
|
||||
break;
|
||||
_tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined;
|
||||
break;
|
||||
}
|
||||
if (_tipostampa != undefined)
|
||||
{
|
||||
@ -370,28 +412,30 @@ bool TSitSanitaria::set_print(int)
|
||||
}
|
||||
|
||||
void TSitSanitaria::crea_intestazione()
|
||||
{
|
||||
{
|
||||
reset_header();
|
||||
TString sep(132);
|
||||
sep = "STAMPA SITUAZIONE SANITARIA";
|
||||
sep.center_just();
|
||||
set_header(2, "@0g%s", (const char*) sep);
|
||||
TDate data_stampa = _data_stampa.string();
|
||||
set_header(2,"@0g%10s", (const char*) data_stampa);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
set_header(2, "@125g%s", (const char*) sep);
|
||||
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header(3, (const char *) sep);
|
||||
set_header(4,"@0gCodice@9gCognome e nome@61gNato il@72gTelefono abit.@87gTelefono lav.@102gTelefono altro");
|
||||
set_header(5,"@0gTessera@9gIndirizzo");
|
||||
TString256 riga = "@0gCat.@61gGruppo Rh@72gUltimo ";
|
||||
riga << _tipo1 << "@83gUltimo " << _tipo2 << "@94gUltimo " << _tipo3 << "@105gUltimo " << _tipo4 << "@116gUltimo " << _tipo5;
|
||||
set_header(6,riga);
|
||||
set_header(7,"@0g--------@9g---------------------------------------------------@61g----------@72g------------------------------------------------------");
|
||||
printer().footerlen(3);
|
||||
if (_tipostampa==elenco)
|
||||
{
|
||||
TString sep(132);
|
||||
sep = "STAMPA SITUAZIONE SANITARIA";
|
||||
sep.center_just();
|
||||
set_header(2, "@0g%s", (const char*) sep);
|
||||
TDate data_stampa = _data_stampa.string();
|
||||
set_header(2,"@0g%10s", (const char*) data_stampa);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
set_header(2, "@125g%s", (const char*) sep);
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header(3, (const char *) sep);
|
||||
set_header(4,"@0gCodice@9gCognome e nome@61gNato il@72gTelefono abit.@87gTelefono lav.@102gTelefono altro");
|
||||
set_header(5,"@0gTessera@9gIndirizzo");
|
||||
TString256 riga = "@0gCat.@61gGruppo Rh@72gUltimo ";
|
||||
riga << _tipo1 << "@83gUltimo " << _tipo2 << "@94gUltimo " << _tipo3 << "@105gUltimo " << _tipo4 << "@116gUltimo " << _tipo5;
|
||||
set_header(6,riga);
|
||||
set_header(7,"@0g--------@9g---------------------------------------------------@61g----------@72g------------------------------------------------------");
|
||||
printer().footerlen(3);
|
||||
}
|
||||
}
|
||||
|
||||
bool TSitSanitaria::user_create()
|
||||
@ -400,11 +444,8 @@ bool TSitSanitaria::user_create()
|
||||
_rel = new TRelation(LF_SOGGETTI);
|
||||
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
|
||||
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
|
||||
_rel->add("LCP", "CODTAB==RES_CODLOC",1,LF_SOGGETTI,ALIAS_LCPRES);
|
||||
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,LF_SOGGETTI,ALIAS_LCPDOM);
|
||||
_rel->add(LF_COMUNI, "COM==RES_CODCOM",1,LF_SOGGETTI,ALIAS_COMRES);
|
||||
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,LF_SOGGETTI,ALIAS_COMDOM);
|
||||
_rel->add(LF_COMUNI, "COM==COMNASC",1,LF_SOGGETTI,ALIAS_COMNAS);
|
||||
|
||||
//cursore ordinamento per sezione+sottogruppo+cognome+nome
|
||||
_cur = add_cursor(new TCursor(_rel, "", 3));
|
||||
@ -414,8 +455,10 @@ bool TSitSanitaria::user_create()
|
||||
TString16 etformato = config.get("EtFormato");
|
||||
_etlarghezza = config.get_int("EtLarghezza");
|
||||
_etcolonne = config.get_int("EtColonne");
|
||||
_etrighe = config.get_int("EtRighe");
|
||||
_etbordoini = config.get_int("EtBordoIni");
|
||||
_etbordofin = config.get_int("EtBordoFin");
|
||||
_form_eti = new TEti_sitsanitaria_form(etformato);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user