Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Stampa per categorie: configurazione stampante per etichette normali e per notiziario + aggiunto due categorie donatori


git-svn-id: svn://10.65.10.50/trunk@7703 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1999-01-26 14:18:25 +00:00
parent cdb37cef28
commit bd5d062287
3 changed files with 219 additions and 81 deletions

View File

@ -14,6 +14,7 @@
#include "at2.h"
#include "at2700a.h"
#include "atlib.h"
#include "at4100b.h"
#include "at4100c.h"
@ -35,7 +36,7 @@
#define ETI_COGNOME 3 // numero campo cognome e nome in etichetta (deve essere sempre cosi') per famiglie
enum ts { undefined=0, sintetico=1, completo=2, schede=3, etichette=4, cartoline=5, personale=6 };
enum ts { undefined=0, sintetico=1, completo=2, schede=3, etichette=4, cartoline=5, personale=6, notiziario=7 };
// definizione form per etichette
class TEti_percat_form : public TForm
@ -65,6 +66,7 @@ class TStampaPerCategorie : public TPrintapp
TRecord_array* _sbenemerenze;
TRecord_array* _sfamiglia;
TEti_percat_form* _form_eti;
TEti_percat_form* _form_neti;
TEti_percat_form* _form_car;
TEti_percat_form* _form_sch;
TEti_percat_form* _form_per;
@ -78,12 +80,12 @@ class TStampaPerCategorie : public TPrintapp
TString16 _lettini, _lettfin, _capini, _capfin;
TString16 _gruppoazie, _gruppoold;
bool _pergruppo, _perfamiglie;
int _contatore;
long _contatore;
TString16 _codsez, _codsot, _orario, _datacart;
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
bool _usomodo, _usasez;
int _etlarghezza, _etcolonne, _schxpag, _lenpage;
int _etlarghezza, _etcolonne, _schxpag, _lenpage, _etnlarghezza, _etncolonne;
bool _stampa80, _etictot;
protected:
@ -180,13 +182,23 @@ void TStampaPerCategorie::filtra_sezioni()
void TStampaPerCategorie::footer_gruppo()
{
// stampa totale soggetti appartenenti al gruppo
if (_tipostampa == etichette && _etictot)
if ((_tipostampa==etichette || _tipostampa==notiziario) && _etictot)
{
TPrint_section& corpo = _form_eti->get_body();
if (_tipostampa==notiziario)
corpo = _form_neti->get_body();
TPrintrow riga;
for (word i = 0; i < corpo.height(); i++)
{
riga.reset();
if (i==0)
{
TString80 totale = format("TOTALE %d", _contatore);
TPrintrow riga;
riga.put(totale);
}
printer().print(riga);
}
}
else
{
reset_footer();
@ -216,13 +228,23 @@ print_action TStampaPerCategorie::postprocess_print(int file, int counter)
void TStampaPerCategorie::footer_sezione()
{
// stampa totale soggetti appartenenti alla sezione
if (_tipostampa == etichette && _etictot)
if ((_tipostampa==etichette || _tipostampa==notiziario) && _etictot)
{
TPrint_section& corpo = _form_eti->get_body();
if (_tipostampa==notiziario)
corpo = _form_neti->get_body();
TPrintrow riga;
for (word i = 0; i < corpo.height(); i++)
{
riga.reset();
if (i==0)
{
TString80 totale = format("TOTALE %d", _contatore);
TPrintrow riga;
riga.put(totale);
}
printer().print(riga);
}
}
else
{
reset_footer();
@ -275,6 +297,7 @@ void TStampaPerCategorie::set_page(int file, int cnt)
TForm_item& cognome = corpo.find_field(ETI_COGNOME);
cognome.set(_cognome_nome);
corpo.update();
_contatore++;
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
@ -302,6 +325,55 @@ void TStampaPerCategorie::set_page(int file, int cnt)
}
}
break;
case notiziario:
{
TPrint_section& corpo = _form_neti->get_body();
for (int r=1;r<=_etncolonne;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++;
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etnlarghezza);
int colonna = ((r-1)*_etnlarghezza);
TString16 formato;
formato << '@' << colonna << 'g';
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etncolonne)
{
bool avanza = TRUE;
while (avanza)
{
++(*current_cursor());
if (current_cursor()->pos()<current_cursor()->items())
avanza = !(preprocess_page(file, cnt));
else
avanza = FALSE;
}
}
}
}
}
break;
case personale:
{
TPrint_section& corpo = _form_per->get_body();
@ -513,7 +585,7 @@ bool TStampaPerCategorie::filter_func_percat(const TRelation* rel)
if (app()._catdon.items() == 0 && app()._catnondon.items() == 0)
filtrato = TRUE;
// filtro per iniziale cognome
if (filtrato && (!app()._lettini.blank()) && (!app()._lettfin.blank()))
if (filtrato && ((!app()._lettini.blank()) || (!app()._lettfin.blank())))
{
TString80 cognome = sog.get(SOG_COGNOME);
int leni = app()._lettini.len();
@ -533,11 +605,14 @@ void TStampaPerCategorie::header_sezione(const TString16 codsez, const TString16
TString intestazione(132);
intestazione = "Sezione: ";
intestazione << codsez;
if (!codsot.blank())
{
intestazione << '/';
intestazione << codsot;
}
intestazione << ' ';
intestazione << densez;
if ((densot.ok())&& (densot.not_empty()))
if (!densot.blank())
{
intestazione << '/';
intestazione << densot;
@ -560,18 +635,11 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
TString256 localita = "";
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S6");
if (localita.not_empty() && localita.ok())
{
localita << ' ';
localita << recsog.get(SOG_DOM_CAP);
localita << " ";
if (!recsog.get(SOG_DOM_CODLOC).blank())
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
localita << " - ";
}
else
{
localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM);
localita << ' ';
}
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
localita << ' ' << current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
localita.trim();
@ -636,7 +704,9 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
if (_tipostampa==notiziario)
if (printer().rows_left() < _form_neti->get_body().height())
printer().formfeed();
if (_perfamiglie)
{
TRectype& recfam = current_cursor()->curr(LF_FAMIGLIE);
@ -753,12 +823,15 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
cognome << recsog.get(SOG_NOME);
_cognome_nome = cognome;
}
if (_tipostampa!=etichette && _tipostampa!=notiziario)
_contatore++;
return TRUE;
}
bool TStampaPerCategorie::set_print(int m)
{
TPrinter& p = printer();
p.read_configuration();
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
@ -779,7 +852,12 @@ bool TStampaPerCategorie::set_print(int m)
printer().formlen(_lenpage/_schxpag);
break;
case F_ETICHETTE:
_tipostampa=etichette;
{
if (_msk->get_bool(F_NOTIZIARIO))
_tipostampa = (configura_stampante(p, "AT_NOTIZIARIO", "et. notiziario")) ? notiziario : undefined;
else
_tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined;
}
break;
case F_CARTOLINE:
_tipostampa=cartoline;
@ -789,7 +867,7 @@ bool TStampaPerCategorie::set_print(int m)
{
if (_tipostampa == cartoline)
dati_cartolina();
if (_tipostampa == etichette)
if (_tipostampa==etichette || _tipostampa==notiziario)
_cognome_nome.set_width(200);
_codsez = "**";
_codsot = "**";
@ -805,6 +883,8 @@ bool TStampaPerCategorie::set_print(int m)
_lettini.left(15);
_lettfin = _msk->get(F_LETTFIN);
_lettfin.left(15);
if (_lettfin.blank())
_lettfin = "ZZZZZZZZZZZZZZZ";
if (_pergruppo)
{
_gruppoazie = _msk->get(F_GRUPPOAZIE);
@ -821,8 +901,13 @@ bool TStampaPerCategorie::set_print(int m)
chiave << "90->CODSEZ|90->CODSOT|UPPER(90->COGNOME)|UPPER(90->NOME)";
}
TString256 filtro = "";
if (_pergruppo)
{
if (_gruppoazie.not_empty())
filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
else
filtro.format("(90->GRUPPOAZIE != \"\")");
}
if (_capini.not_empty())
{
if (filtro.not_empty())
@ -835,8 +920,7 @@ bool TStampaPerCategorie::set_print(int m)
filtro << " && ";
filtro << format("(90->DOM_CAP <= \"%s\")",(const char*)_capfin);
}
bool notiziario = _msk->get_bool(F_NOTIZIARIO);
if (notiziario)
if (_tipostampa==notiziario)
{
if (filtro.not_empty())
filtro << " && ";
@ -868,18 +952,24 @@ bool TStampaPerCategorie::set_print(int m)
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
const TString16 catset = _msk->get(F_CAT7);
const TString16 catott = _msk->get(F_CAT8);
if (catpri.not_empty())
_catdon.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
if (catsec.not_empty())
_catdon.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
if (catter.not_empty())
_catdon.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
if (catqua.not_empty())
_catdon.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
if (catqui.not_empty())
_catdon.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
if (catses.not_empty())
_catdon.add((const char*) catses);
if (catset.not_empty())
_catdon.add((const char*) catset);
if (catott.not_empty())
_catdon.add((const char*) catott);
_catnondon.destroy();
const TString16 catnpri = _msk->get(F_CATN1);
const TString16 catnsec = _msk->get(F_CATN2);
@ -887,17 +977,17 @@ bool TStampaPerCategorie::set_print(int m)
const TString16 catnqua = _msk->get(F_CATN4);
const TString16 catnqui = _msk->get(F_CATN5);
const TString16 catnses = _msk->get(F_CATN6);
if (catnpri.not_empty() && catnpri.ok())
if (catnpri.not_empty())
_catnondon.add((const char*) catnpri);
if (catnsec.not_empty() && catnsec.ok())
if (catnsec.not_empty())
_catnondon.add((const char*) catnsec);
if (catnter.not_empty() && catnter.ok())
if (catnter.not_empty())
_catnondon.add((const char*) catnter);
if (catnqua.not_empty() && catnqua.ok())
if (catnqua.not_empty())
_catnondon.add((const char*) catnqua);
if (catnqui.not_empty() && catnqui.ok())
if (catnqui.not_empty())
_catnondon.add((const char*) catnqui);
if (catnses.not_empty() && catnses.ok())
if (catnses.not_empty())
_catnondon.add((const char*) catnses);
current_cursor()->set_filterfunction (filter_func_percat, TRUE);
reset_print();
@ -1033,6 +1123,10 @@ bool TStampaPerCategorie::user_create()
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_percat_form(etformato);
TString16 etnformato = config.get("EtNFormato");
_etnlarghezza = config.get_int("EtNLarghezza");
_etncolonne = config.get_int("EtNColonne");
_form_neti = new TEti_percat_form(etnformato);
_stampa80 = config.get_bool("Stampa80");
_etictot = config.get_bool("EticTot");
_form_car = new TEti_percat_form("ATCARTO1");

View File

@ -22,6 +22,10 @@
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_CAT7 213
#define F_D_CAT7 214
#define F_CAT8 215
#define F_D_CAT8 216
#define F_CATN1 301
#define F_D_CATN1 302

View File

@ -163,7 +163,7 @@ BEGIN
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 5
GROUPBOX DLG_NULL 77 6
BEGIN
PROMPT 1 4 "Categorie donatori"
END
@ -231,7 +231,7 @@ END
STRING F_CAT4 2
BEGIN
PROMPT 40 5 ""
PROMPT 2 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
@ -245,13 +245,13 @@ END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 5 ""
PROMPT 8 8 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 6 ""
PROMPT 40 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
@ -265,13 +265,13 @@ END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 6 ""
PROMPT 46 5 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 7 ""
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
@ -284,19 +284,59 @@ BEGIN
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT7 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT7
COPY DISPLAY F_CAT1
OUTPUT F_CAT7 CODTAB
OUTPUT F_D_CAT7 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT7 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
STRING F_CAT8 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT8
COPY DISPLAY F_CAT1
OUTPUT F_CAT8 CODTAB
OUTPUT F_D_CAT8 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT8 30
BEGIN
PROMPT 46 8 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 9 "Categorie non donatori"
PROMPT 1 10 "Categorie non donatori"
END
STRING F_CATN1 2
BEGIN
PROMPT 2 10 ""
PROMPT 2 11 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN1
@ -311,13 +351,13 @@ END
STRING F_D_CATN1 30
BEGIN
PROMPT 8 10 ""
PROMPT 8 11 ""
FLAGS "D"
END
STRING F_CATN2 2
BEGIN
PROMPT 2 11 ""
PROMPT 2 12 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN2
@ -331,13 +371,13 @@ END
STRING F_D_CATN2 30
BEGIN
PROMPT 8 11 ""
PROMPT 8 12 ""
FLAGS "D"
END
STRING F_CATN3 2
BEGIN
PROMPT 2 12 ""
PROMPT 2 13 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN3
@ -351,13 +391,13 @@ END
STRING F_D_CATN3 30
BEGIN
PROMPT 8 12 ""
PROMPT 8 13 ""
FLAGS "D"
END
STRING F_CATN4 2
BEGIN
PROMPT 40 10 ""
PROMPT 40 11 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN4
@ -371,13 +411,13 @@ END
STRING F_D_CATN4 30
BEGIN
PROMPT 46 10 ""
PROMPT 46 11 ""
FLAGS "D"
END
STRING F_CATN5 2
BEGIN
PROMPT 40 11 ""
PROMPT 40 12 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN5
@ -391,13 +431,13 @@ END
STRING F_D_CATN5 30
BEGIN
PROMPT 46 11 ""
PROMPT 46 12 ""
FLAGS "D"
END
STRING F_CATN6 2
BEGIN
PROMPT 40 12 ""
PROMPT 40 13 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN6
@ -411,25 +451,25 @@ END
STRING F_D_CATN6 30
BEGIN
PROMPT 46 12 ""
PROMPT 46 13 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 7
BEGIN
PROMPT 1 14 "Opzioni di stampa"
PROMPT 1 15 "Opzioni di stampa"
END
BOOLEAN F_PERGRUPPO
BEGIN
PROMPT 2 15 "Stampa per gruppo aziendale"
PROMPT 2 16 "Stampa per gruppo aziendale"
MESSAGE TRUE ENABLE,F_GRUPPOAZIE|ENABLE,F_D_GRUPPOAZIE
MESSAGE FALSE RESET,F_GRUPPOAZIE|RESET,F_D_GRUPPOAZIE|DISABLE,F_GRUPPOAZIE|DISABLE,F_D_GRUPPOAZIE
END
STRING F_GRUPPOAZIE 4
BEGIN
PROMPT 35 15 ""
PROMPT 35 16 ""
FLAGS "U"
USE GAZ
INPUT CODTAB F_GRUPPOAZIE
@ -444,7 +484,7 @@ END
STRING F_D_GRUPPOAZIE 30
BEGIN
PROMPT 43 15 ""
PROMPT 43 16 ""
FLAGS "U"
USE GAZ KEY 2
INPUT S0 F_D_GRUPPOAZIE
@ -458,31 +498,31 @@ END
BOOLEAN F_NOTIZIARIO
BEGIN
PROMPT 2 16 "Stampa per notiziario"
PROMPT 2 17 "Stampa per notiziario"
END
BOOLEAN F_PERCAP
BEGIN
PROMPT 2 17 "Ordinamento per CAP"
PROMPT 2 18 "Ordinamento per CAP"
MESSAGE TRUE DISABLE,1@|ENABLE,2@
MESSAGE FALSE ENABLE,1@|DISABLE,2@
END
STRINGA F_CAPINI 5
BEGIN
PROMPT 35 17 "Stampa solo dal cap "
PROMPT 35 18 "Stampa solo dal cap "
GROUP 2
END
STRINGA F_CAPFIN 5
BEGIN
PROMPT 61 17 "al cap "
PROMPT 61 18 "al cap "
GROUP 2
END
STRING F_LETTINI 15
BEGIN
PROMPT 2 18 "Selezione iniziali cognome: da "
PROMPT 2 19 "Selezione iniziali cognome: da "
GROUP 1
FLAG "U"
//PICTURE "!!"
@ -490,7 +530,7 @@ END
STRING F_LETTFIN 15
BEGIN
PROMPT 50 18 "a "
PROMPT 50 19 "a "
GROUP 1
FLAG "U"
//VALIDATE (#F_LETTINI<=#F_LETTFIN)
@ -499,7 +539,7 @@ END
BOOLEAN F_PERFAMIGLIE
BEGIN
PROMPT 2 19 "Raggruppa per famiglie (solo etichette)"
PROMPT 2 20 "Raggruppa per famiglie (solo etichette)"
END
ENDPAGE