Correzioni alla stampa registri
git-svn-id: svn://10.65.10.50/trunk@440 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e5ac04167f
commit
5109dcc44a
160
cg/cg4400.cpp
160
cg/cg4400.cpp
@ -54,7 +54,6 @@ HIDDEN int compare_fields(const TObject** o1, const TObject** o2)
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
bool CG4400_application::mask_select (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
@ -377,10 +376,12 @@ void CG4400_application::user_create()
|
||||
d->add(" ");
|
||||
d->add(_nditte->get("CODDITTA"));
|
||||
d->add(_nditte->get("RAGSOC"));
|
||||
_ditte->add(d);
|
||||
_ditte->add(*d);
|
||||
}
|
||||
_n_ditte = _ditte->items();
|
||||
|
||||
_com = new TLocalisamfile(LF_COMUNI);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_tab = new TLocalisamfile(LF_TAB);
|
||||
_tabcom = new TLocalisamfile(LF_TABCOM);
|
||||
_tabreg = new TTable("REG");
|
||||
@ -695,7 +696,8 @@ void CG4400_application::set_page_tot_reg()
|
||||
set_row(r, "%s", (const char *) riga);
|
||||
r++;
|
||||
set_row(r, "Legenda Tipo Operazione: 1=operazione intracomunitaria 2=AF art.34 comma 3");
|
||||
set_row(r, "@78g3=operazione intracomunitaria e AF art.34 comma 3");
|
||||
if (_auto_intraf)
|
||||
set_row(r, "@78g3=operazione intracomunitaria e AF art.34 comma 3");
|
||||
r++;
|
||||
set_row(++r, "Tipo documento@30gTotale documento");
|
||||
r+=2;
|
||||
@ -943,7 +945,6 @@ bool CG4400_application::compila_reg(const TMask& m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -968,6 +969,9 @@ bool CG4400_application::preprocess_print(int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
long items = _cur->items();
|
||||
if (!items)
|
||||
return FALSE;
|
||||
_iva_array.destroy();
|
||||
_riga_rmi.destroy();
|
||||
_tot_iva_array.destroy();
|
||||
@ -975,6 +979,7 @@ bool CG4400_application::preprocess_print(int file, int counter)
|
||||
_dataregp = "";
|
||||
_mov_empty = TRUE;
|
||||
_primast = _u_stampata;
|
||||
_auto_intraf = FALSE;
|
||||
set_print_zero();
|
||||
}
|
||||
return TRUE;
|
||||
@ -1010,6 +1015,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
if (_tipo_stampa == 2)
|
||||
++ _u_stampata;
|
||||
_auto_intraf = FALSE;
|
||||
printer().formfeed();
|
||||
}
|
||||
|
||||
@ -1038,7 +1044,10 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
}
|
||||
|
||||
if ( intra && autof)
|
||||
{
|
||||
_auto_intraf = TRUE;
|
||||
tipo_op = "3";
|
||||
}
|
||||
else if (intra)
|
||||
tipo_op = "1";
|
||||
else if (autof)
|
||||
@ -1065,7 +1074,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
set_row(_r, "@9g%5d", protiva);
|
||||
set_row(_r, "@15g%s", (const char*) app);
|
||||
set_row(_r, "@24g%s", (const char*) numdoc);
|
||||
set_row(_r, "@32g%6d", codcf);
|
||||
set_row(_r, "@32g%ld", codcf);
|
||||
set_row(_r, "@39g%.28s",(const char*) ragsoc);
|
||||
set_row(_r, "@68g%s", (const char*) tipo_op);
|
||||
set_row(_r, "@70g%2s", (const char*) _tipodoc);
|
||||
@ -1249,7 +1258,12 @@ print_action CG4400_application::postprocess_print(int file, int counter)
|
||||
{
|
||||
if (_tipo_stampa == 2)
|
||||
++ _u_stampata;
|
||||
printer().formfeed();
|
||||
/*
|
||||
TRecnotype pos = _cur->pos();
|
||||
long items = _cur->items();
|
||||
if (pos < items-1)
|
||||
printer().formfeed();
|
||||
*/
|
||||
}
|
||||
/*
|
||||
if (_stampa_tutti_i_registri)
|
||||
@ -1384,12 +1398,12 @@ void CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
if (anno > _annoes)
|
||||
break;
|
||||
if (anno == _annoes)
|
||||
if ( (tipo == 1) || (tipo == 2) ) //registro iva
|
||||
if ( tipo == 1 || tipo == 2 ) //registro iva
|
||||
{
|
||||
_tipo_reg = _tabreg->get_int("I0");
|
||||
_desc_lib = _tabreg->get("S0");
|
||||
if (_tipo_stampa != 3)
|
||||
_data_da = _tabreg->get_date("D3");
|
||||
_data_da = _tabreg->get_date("D3");
|
||||
_pagine_stampate = _tabreg->get_int("I1");
|
||||
_codreg = codtab.mid(4,3);
|
||||
_codatt = _tabreg->get("S8");
|
||||
@ -1400,9 +1414,15 @@ void CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
// printer().formfeed();
|
||||
_cur->set_filterfunction(NULL);
|
||||
_cur->set_filterfunction(filter_func);
|
||||
//set_page_number(_u_stampata + 1);
|
||||
print();
|
||||
if (_tipo_stampa != 3) aggiorna_reg();
|
||||
// Vado a vedere se ci sono movimenti
|
||||
(*_cur) = 0L;
|
||||
const long items = _cur->items();
|
||||
if (items > 0)
|
||||
{
|
||||
//set_page_number(_u_stampata + 1);
|
||||
print();
|
||||
if (_tipo_stampa != 3) aggiorna_reg();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1444,21 +1464,94 @@ bool CG4400_application::set_ditte(TMask& m)
|
||||
return tasto == K_ENTER;
|
||||
}
|
||||
|
||||
int CG4400_application::stampa_intestazione_ditta()
|
||||
TRectype& look_comuni (const char * cod, TLocalisamfile *comuni)
|
||||
{
|
||||
TDati_ditta tditta(get_firm(), _stampa_width);
|
||||
TString riga (tditta.prima_riga());
|
||||
int r=1;
|
||||
comuni->zero();
|
||||
comuni->put(COM_COM, cod);
|
||||
comuni->read();
|
||||
if (comuni->bad())
|
||||
comuni->zero();
|
||||
|
||||
return comuni->curr();
|
||||
}
|
||||
|
||||
void CG4400_application::get_dati_ditta()
|
||||
{
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TString codanagr;
|
||||
TString tipoa;
|
||||
|
||||
nditte.zero();
|
||||
nditte.put(NDT_CODDITTA, get_firm());
|
||||
nditte.read();
|
||||
|
||||
if (nditte.bad()) nditte.zero();
|
||||
|
||||
codanagr = nditte.get(NDT_CODANAGR);
|
||||
tipoa = nditte.get(NDT_TIPOA);
|
||||
_ragsoc = nditte.get(NDT_RAGSOC);
|
||||
|
||||
anag.setkey(1);
|
||||
anag.zero();
|
||||
anag.put (ANA_TIPOA, tipoa);
|
||||
anag.put (ANA_CODANAGR, codanagr);
|
||||
anag.read();
|
||||
if (anag.bad()) anag.zero();
|
||||
|
||||
set_header (r, "%s", (const char *) riga);
|
||||
_cofi = anag.get(ANA_COFI);
|
||||
_paiva = anag.get(ANA_PAIV);
|
||||
_comunefis = anag.get(ANA_COMRF);
|
||||
|
||||
if (_comunefis.empty())
|
||||
_comunefis = anag.get(ANA_COMRES);
|
||||
|
||||
TRectype dep = look_comuni (_comunefis, _com);
|
||||
|
||||
_comunefis = dep.get(COM_DENCOM);
|
||||
_provfis = dep.get(COM_PROVCOM);
|
||||
_cap = dep.get(COM_CAPCOM);
|
||||
if (_comunefis.empty())
|
||||
{
|
||||
_viafis = anag.get(ANA_INDRF);
|
||||
_viafis.rtrim();
|
||||
_viafis << " " << anag.get (ANA_CIVRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
_viafis = anag.get(ANA_INDRES);
|
||||
_viafis.rtrim();
|
||||
_viafis << " " << anag.get (ANA_CIVRES);
|
||||
}
|
||||
}
|
||||
|
||||
int CG4400_application::stampa_intestazione()
|
||||
{
|
||||
int r = 1;
|
||||
TString codice_ditta;
|
||||
TString riga(_stampa_width);
|
||||
//TString riga(132);
|
||||
|
||||
get_dati_ditta();
|
||||
codice_ditta << get_firm();
|
||||
|
||||
set_header (r, "Ditta %s %s %s %s %s %s", (const char*)codice_ditta,
|
||||
(const char*)_ragsoc, (const char*)_viafis,
|
||||
(const char*)_cap, (const char*)_comunefis,
|
||||
(const char*)_provfis);
|
||||
r++;
|
||||
|
||||
riga = tditta.seconda_riga();
|
||||
|
||||
//printer().setdate(_data);
|
||||
if (_tipo_stampa == 3)
|
||||
riga = "STAMPA DI PROVA Data @<";
|
||||
else
|
||||
riga = "Data @<";
|
||||
riga.right_just(_stampa_width-6);
|
||||
//riga.right_just(127);
|
||||
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
|
||||
set_header (r, "%s", (const char*) riga);
|
||||
r++;
|
||||
|
||||
return r;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void CG4400_application::preprocess_header()
|
||||
@ -1468,33 +1561,34 @@ void CG4400_application::preprocess_header()
|
||||
TString riga(_stampa_width);
|
||||
TString data;
|
||||
|
||||
if (_tipo_stampa != 3) //cioe' si tratta di una stampa definitiva
|
||||
{
|
||||
if ( (_tipo_stampa == 1) || (_tipo_stampa == 4) )
|
||||
data.format("%s %s %d", (const char*)"mese di", itom(_datareg.month()),
|
||||
_datareg.year());
|
||||
else data.format("%s %s %d", (const char*)"mese di", itom(_fino_a_mese), _annoes);
|
||||
}
|
||||
else
|
||||
data = _data_da.string();
|
||||
//if (_tipo_stampa != 3) //cioe' si tratta di una stampa definitiva
|
||||
//{
|
||||
if ( (_tipo_stampa == 1) || (_tipo_stampa == 4) )
|
||||
data.format("%s %s %d", (const char*)"mese di", itom(_datareg.month()),
|
||||
_datareg.year());
|
||||
else if (_tipo_stampa == 2)
|
||||
data.format("%s %s %d", (const char*)"mese di", itom(_fino_a_mese), _annoes);
|
||||
//}
|
||||
else //stampa di prova
|
||||
//data = _data_da.string();
|
||||
data.format("%s %s %d", (const char*)"mese di", itom(_data_da.month()), _annoes);
|
||||
|
||||
reset_header();
|
||||
|
||||
if (_tipo_stampa == 2)
|
||||
{
|
||||
if (_stampa_ind_ditta)
|
||||
r = stampa_intestazione_ditta();
|
||||
r = stampa_intestazione();
|
||||
long num = _u_stampata + 1;
|
||||
set_header(r++, "@94gProgr.Studio %ld@114gProgr.Utente @#", num);
|
||||
}
|
||||
else
|
||||
r = stampa_intestazione_ditta();
|
||||
r = stampa_intestazione();
|
||||
set_header(r, "Registro IVA: %s %s %s Attivita\' %s %s",
|
||||
(const char *) _codreg, (const char *) _desc_lib,
|
||||
(const char *) data, (const char *) _codatt,
|
||||
(const char *) _attivita);
|
||||
r++;
|
||||
|
||||
riga.fill('-');
|
||||
set_header(r, riga);
|
||||
r++;
|
||||
|
27
cg/cg4400.h
27
cg/cg4400.h
@ -24,30 +24,11 @@
|
||||
//enum STAMPA { bollati=1, unici=2 };
|
||||
const int TABREG = (int)TTable::name2log("REG");
|
||||
|
||||
class TDati_ditta : public TObject
|
||||
{
|
||||
TLocalisamfile * _nditte, * _anag, *_comuni;
|
||||
TString80 _ragsoc, _viafis;
|
||||
TString16 _cofi, _paiva, _comunefis, _provfis, _cap;
|
||||
long _codditta;
|
||||
int _stampa_width;
|
||||
|
||||
protected:
|
||||
void get_dati_ditta();
|
||||
TRectype& look_com (const char * codice);
|
||||
|
||||
public:
|
||||
const char* prima_riga ();
|
||||
const char* seconda_riga ();
|
||||
TDati_ditta (long cod_ditta, int stampa_width);
|
||||
virtual ~TDati_ditta();
|
||||
};
|
||||
|
||||
class CG4400_application : public TPrintapp
|
||||
{
|
||||
TCursor * _cur;
|
||||
TRelation *_rel;
|
||||
TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom;
|
||||
TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom, *_com, *_anag;
|
||||
TTable *_tabreg, *_tablbu, *_tabinl, *_tablim, *_tabpim;
|
||||
TRigaiva_array _iva_array, _riga_rmi;
|
||||
TTipodoc_array _doc_array;
|
||||
@ -57,7 +38,7 @@ class CG4400_application : public TPrintapp
|
||||
TArray_sheet *_ditte;
|
||||
|
||||
TRecnotype _nrec;
|
||||
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri;
|
||||
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf;
|
||||
char _frequiva;
|
||||
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
|
||||
long _n_ditte, _u_stampata, _primast;
|
||||
@ -66,6 +47,7 @@ class CG4400_application : public TPrintapp
|
||||
real _totale_doc;
|
||||
TString _codreg, _desc_lib, _codatt, _attivita;
|
||||
TString _tipodoc, _descr_doc, _codlib;
|
||||
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
|
||||
|
||||
protected:
|
||||
const char* desc_attivita (const char * codatt);
|
||||
@ -91,7 +73,8 @@ protected:
|
||||
void user_create();
|
||||
void user_destroy();
|
||||
bool preprocess_page(int, int);
|
||||
int stampa_intestazione_ditta();
|
||||
int stampa_intestazione();
|
||||
void get_dati_ditta();
|
||||
bool preprocess_print(int, int);
|
||||
print_action postprocess_print(int, int);
|
||||
print_action postprocess_page (int, int);
|
||||
|
Loading…
x
Reference in New Issue
Block a user