Patch level : 1.7 at
Files correlati : at2.exe at2100a.msk Ricompilazione Demo : [ ] Commento : in stampa sospesi aggiunta stampa cartoline git-svn-id: svn://10.65.10.50/trunk@11642 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fcd3061aa7
commit
74ba074e67
177
at/at2100.cpp
177
at/at2100.cpp
@ -10,13 +10,15 @@
|
||||
|
||||
#include "at2.h"
|
||||
#include "at2100a.h"
|
||||
#include "at4100b.h"
|
||||
#include "at4100c.h"
|
||||
#include "atlib.h"
|
||||
|
||||
#define ALIAS_LCPDOM 100
|
||||
#define ALIAS_TCS 200
|
||||
#define ALIAS_GAZ 300 // gruppi aziendale
|
||||
|
||||
enum ts { undefined=0, sintetico=1, completo=2, etichette=3, lettere=4 };
|
||||
enum ts { undefined=0, sintetico=1, completo=2, etichette=3, lettere=4, cartoline=5 };
|
||||
|
||||
// definizione form per etichette
|
||||
class TEti_sospesi_form : public TForm
|
||||
@ -39,6 +41,7 @@ class TStampaSospesi : public TPrintapp
|
||||
TLocalisamfile* _contsan;
|
||||
TEti_sospesi_form* _form_eti;
|
||||
TEti_sospesi_form* _form_let;
|
||||
TEti_sospesi_form* _form_car;
|
||||
TAssoc_array _categorie;
|
||||
TParagraph_string _cognome_nome, _dencom, _motivo;
|
||||
TDate _data_stampa;
|
||||
@ -46,8 +49,14 @@ class TStampaSospesi : public TPrintapp
|
||||
ts _tipostampa;
|
||||
TString16 _codsez, _codsot, _motivo1, _motivo2, _motivo3, _motivo4, _motivo5, _tiposo, _prosstipo;
|
||||
TString16 _gruppoazie, _gruppoold;
|
||||
int _etlarghezza, _etcolonne, _contatore, _totale;
|
||||
int _contatore, _totale;
|
||||
int _etlarghezza, _etcolonne, _etrighe, _etbordoini, _etbordofin, _netichette;
|
||||
int _caxpag, _cabordoini, _cabordofin, _ncartoline;
|
||||
bool _motivi, _pergruppo;
|
||||
TString16 _orario, _datacart;
|
||||
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
|
||||
TString80 _note, _intest1, _intest2, _intest3, _intest4;
|
||||
bool _usomodo, _usasez;
|
||||
|
||||
static bool filter_func_sospesi(const TRelation* rel);
|
||||
|
||||
@ -58,8 +67,10 @@ protected:
|
||||
virtual void set_page(int file, int cnt);
|
||||
virtual bool preprocess_page(int file, int counter);
|
||||
virtual print_action postprocess_print(int file, int counter);
|
||||
ts dati_cartolina();
|
||||
|
||||
public:
|
||||
void dati_sezione(const TString16 codsez, const TString16 codsot);
|
||||
void crea_intestazione();
|
||||
void filtra_sezioni();
|
||||
void header_sezione(const TString16 codsez, const TString16 codsot);
|
||||
@ -76,6 +87,51 @@ TCursor* TEti_sospesi_form::cursor() const { return app().current_cursor(); }
|
||||
|
||||
TRelation* TEti_sospesi_form::relation() const { return cursor()->relation(); }
|
||||
|
||||
ts TStampaSospesi::dati_cartolina()
|
||||
{
|
||||
TMask msk("at4100b");
|
||||
if (msk.run() == K_ENTER)
|
||||
{
|
||||
_invitoper = msk.get(F_INVITOPER);
|
||||
_data = msk.get(F_DATA);
|
||||
_presso1 = msk.get(F_PRESSO1);
|
||||
_presso2 = msk.get(F_PRESSO2);
|
||||
_presso3 = msk.get(F_PRESSO3);
|
||||
_presso4 = msk.get(F_PRESSO4);
|
||||
_datacart = msk.get(F_DATACART);
|
||||
_orario = msk.get(F_ORARIO);
|
||||
_note = msk.get(F_NOTE);
|
||||
_usasez = msk.get_bool(F_USASEZ);
|
||||
return cartoline;
|
||||
}
|
||||
else
|
||||
return undefined;
|
||||
}
|
||||
|
||||
void TStampaSospesi::dati_sezione(const TString16 codsez, const TString16 codsot)
|
||||
{
|
||||
_intest1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ1);
|
||||
_intest2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ2);
|
||||
_intest3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ3);
|
||||
_intest4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ4);
|
||||
if (_usasez)
|
||||
{
|
||||
if (_presso1.blank())
|
||||
{
|
||||
_presso1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE1);
|
||||
_presso2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE2);
|
||||
_presso3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE3);
|
||||
_presso4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE4);
|
||||
}
|
||||
if (_orario.blank())
|
||||
_orario = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVORA);
|
||||
if (_note.blank())
|
||||
_note = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVNOTE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void TStampaSospesi::filtra_sezioni()
|
||||
{
|
||||
const TString16 sezini = _msk->get(F_SEZINI);
|
||||
@ -101,16 +157,95 @@ void TStampaSospesi::set_page(int file, int cnt)
|
||||
switch (_tipostampa)
|
||||
{
|
||||
case etichette:
|
||||
{
|
||||
{
|
||||
TPrint_section& corpo = _form_eti->get_body();
|
||||
for (int r=1;r<=_etcolonne;r++)
|
||||
{
|
||||
if (current_cursor()->pos()<current_cursor()->items())
|
||||
{
|
||||
_netichette++;
|
||||
force_setpage(TRUE);
|
||||
corpo.update();
|
||||
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)
|
||||
++(*current_cursor());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cartoline:
|
||||
{
|
||||
TPrint_section& corpo = _form_car->get_body();
|
||||
const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
|
||||
const TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
|
||||
if ((_codsez!=codsez)||(_codsot!=codsot))
|
||||
{
|
||||
_codsez = codsez;
|
||||
_codsot = codsot;
|
||||
dati_sezione(codsez, codsot);
|
||||
corpo.reset();
|
||||
TForm_item& intest1 = corpo.find_field(CAR_INTEST1);
|
||||
intest1.set(_intest1);
|
||||
TForm_item& intest2 = corpo.find_field(CAR_INTEST2);
|
||||
intest2.set(_intest2);
|
||||
TForm_item& intest3 = corpo.find_field(CAR_INTEST3);
|
||||
intest3.set(_intest3);
|
||||
TForm_item& intest4 = corpo.find_field(CAR_INTEST4);
|
||||
intest4.set(_intest4);
|
||||
TForm_item& invito = corpo.find_field(CAR_INVITOPER);
|
||||
invito.set(_invitoper);
|
||||
TForm_item& data = corpo.find_field(CAR_DATA);
|
||||
data.set(_data);
|
||||
TForm_item& presso1 = corpo.find_field(CAR_PRESSO1);
|
||||
presso1.set(_presso1);
|
||||
TForm_item& presso2 = corpo.find_field(CAR_PRESSO2);
|
||||
presso2.set(_presso2);
|
||||
TForm_item& presso3 = corpo.find_field(CAR_PRESSO3);
|
||||
presso3.set(_presso3);
|
||||
TForm_item& presso4 = corpo.find_field(CAR_PRESSO4);
|
||||
presso4.set(_presso4);
|
||||
TForm_item& orario = corpo.find_field(CAR_ORARIO);
|
||||
orario.set(_orario);
|
||||
TForm_item& datacart = corpo.find_field(CAR_DATACART);
|
||||
datacart.set(_datacart);
|
||||
TForm_item& note = corpo.find_field(CAR_NOTE);
|
||||
note.set(_note);
|
||||
}
|
||||
corpo.update();
|
||||
for (word i = 0; i < corpo.height(); i++)
|
||||
{
|
||||
TPrintrow& riga = corpo.row(i);
|
||||
set_row(i+1,riga);
|
||||
word primariga = 0;
|
||||
word ultimariga = corpo.height();
|
||||
if (_caxpag > 0)
|
||||
{
|
||||
if (_ncartoline % _caxpag == 0) // numero cartoline per pagina
|
||||
primariga = _cabordoini; // bordo iniziale
|
||||
if (_ncartoline % _caxpag == _caxpag-1) // numero cartoline per pagina - 1
|
||||
ultimariga -= _cabordofin; // bordo finale
|
||||
}
|
||||
int nriga = 1;
|
||||
for (word i = primariga; i < ultimariga; i++)
|
||||
{
|
||||
TPrintrow& riga = corpo.row(i);
|
||||
set_row(nriga++,riga);
|
||||
}
|
||||
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
|
||||
// altrimenti stampa sempre la stessa etichetta
|
||||
force_setpage(TRUE);
|
||||
_ncartoline++;
|
||||
}
|
||||
break;
|
||||
case lettere:
|
||||
@ -296,8 +431,8 @@ bool TStampaSospesi::preprocess_page(int file, int counter)
|
||||
header_sezione(codsez, codsot);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_tipostampa==etichette)
|
||||
}
|
||||
if (_tipostampa==etichette && _etrighe == 0)
|
||||
if (printer().rows_left() < _form_eti->get_body().height())
|
||||
printer().formfeed();
|
||||
if (_tipostampa==lettere)
|
||||
@ -416,6 +551,9 @@ bool TStampaSospesi::set_print(int m)
|
||||
_totale = 0;
|
||||
}
|
||||
break;
|
||||
case F_CARTOLINE:
|
||||
_tipostampa = (configura_stampante(p, "AT_CARTOLINE", "cartoline")) ? cartoline : undefined;
|
||||
break;
|
||||
case F_ETICHETTE:
|
||||
_tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined;
|
||||
break;
|
||||
@ -424,7 +562,11 @@ bool TStampaSospesi::set_print(int m)
|
||||
break;
|
||||
}
|
||||
if (_tipostampa != undefined)
|
||||
{
|
||||
{
|
||||
if (_tipostampa == cartoline)
|
||||
dati_cartolina();
|
||||
_ncartoline = 0;
|
||||
_netichette = 0;
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
// filtro per sezioni selezionate
|
||||
@ -577,10 +719,21 @@ bool TStampaSospesi::user_create()
|
||||
add_cursor(new TSorted_cursor(_rel,"90->CODSEZ|90->CODSOT|90->COGNOME|90->NOME","",3));
|
||||
_msk = new TMask("at2100a");
|
||||
TConfig config(CONFIG_STUDIO);
|
||||
|
||||
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_sospesi_form(etformato);
|
||||
|
||||
TString16 caformato = config.get("CaFormato");
|
||||
_form_car = new TEti_sospesi_form(caformato);
|
||||
_caxpag = config.get_int("CaPerPag");
|
||||
_cabordoini = config.get_int("CaBordoIni");
|
||||
_cabordofin = config.get_int("CaBordoFin");
|
||||
|
||||
_form_let = new TEti_sospesi_form("ATLETTER");
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -50,3 +50,4 @@
|
||||
#define F_COMPLETO 502
|
||||
#define F_ETICHETTE 503
|
||||
#define F_LETTERE 504
|
||||
#define F_CARTOLINE 505
|
||||
|
@ -2,31 +2,37 @@
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
BUTTON F_SINTETICO 9 2
|
||||
BEGIN
|
||||
PROMPT -15 -11 "~Sintetico"
|
||||
PROMPT -16 -11 "~Sintetico"
|
||||
MESSAGE EXIT,F_SINTETICO
|
||||
END
|
||||
|
||||
BUTTON F_COMPLETO 9 2
|
||||
BEGIN
|
||||
PROMPT -25 -11 "~Completo"
|
||||
PROMPT -26 -11 "~Completo"
|
||||
MESSAGE EXIT,F_COMPLETO
|
||||
END
|
||||
|
||||
BUTTON F_ETICHETTE 9 2
|
||||
BEGIN
|
||||
PROMPT -35 -11 "~Etichette"
|
||||
PROMPT -36 -11 "~Etichette"
|
||||
MESSAGE EXIT,F_ETICHETTE
|
||||
END
|
||||
|
||||
BUTTON F_LETTERE 9 2
|
||||
BEGIN
|
||||
PROMPT -45 -11 "~Lettere"
|
||||
PROMPT -46 -11 "~Lettere"
|
||||
MESSAGE EXIT,F_LETTERE
|
||||
END
|
||||
|
||||
BUTTON F_CARTOLINE 9 2
|
||||
BEGIN
|
||||
PROMPT -56 -11 "C~artoline"
|
||||
MESSAGE EXIT,F_CARTOLINE
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -55 -11 ""
|
||||
PROMPT -66 -11 ""
|
||||
END
|
||||
ENDPAGE
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user