Modifiche alla stampa registri

git-svn-id: svn://10.65.10.50/trunk@197 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1994-09-08 16:15:07 +00:00
parent f114c65d04
commit fbcc614384
3 changed files with 269 additions and 243 deletions

View File

@ -4,7 +4,7 @@
#include "cg4400.h" #include "cg4400.h"
#include "cg4400a.h" #include "cg4400a.h"
static TString256 TMP; TFixed_string TMP (__tmp, MAXSTR);
HIDDEN CG4400_application * app() { return (CG4400_application*) MainApp(); } HIDDEN CG4400_application * app() { return (CG4400_application*) MainApp(); }
@ -329,7 +329,7 @@ const char * CG4400_application::descr_doc(const char * tipo)
else else
TMP = ""; TMP = "";
return TMP; return __tmp;
} }
const char * CG4400_application::descr_iva(const char * cod) const char * CG4400_application::descr_iva(const char * cod)
@ -344,7 +344,7 @@ const char * CG4400_application::descr_iva(const char * cod)
else else
TMP = ""; TMP = "";
return TMP; return __tmp;
} }
const char * CG4400_application::desc_attivita(const char * codatt) const char * CG4400_application::desc_attivita(const char * codatt)
@ -357,7 +357,7 @@ const char * CG4400_application::desc_attivita(const char * codatt)
TMP = attiv.get("S0"); TMP = attiv.get("S0");
else else
TMP = ""; TMP = "";
return TMP; return __tmp;
} }
const char * CG4400_application::ricerca_cf(char tipocf, long codcf) const char * CG4400_application::ricerca_cf(char tipocf, long codcf)
@ -369,7 +369,7 @@ const char * CG4400_application::ricerca_cf(char tipocf, long codcf)
TMP = _clifo->get(CLI_RAGSOC); TMP = _clifo->get(CLI_RAGSOC);
else else
TMP = ""; TMP = "";
return TMP; return __tmp;
} }
const char * CG4400_application::ricerca_occ(const char * occ) const char * CG4400_application::ricerca_occ(const char * occ)
@ -383,7 +383,7 @@ const char * CG4400_application::ricerca_occ(const char * occ)
TMP = occas.get(OCC_RAGSOC); TMP = occas.get(OCC_RAGSOC);
else else
TMP = ""; TMP = "";
return TMP; return __tmp;
} }
void CG4400_application::user_create() void CG4400_application::user_create()
@ -706,6 +706,7 @@ void CG4400_application::cerca_reg(const TString& c, byte& t, TDate& d)
void CG4400_application::set_page_tot_reg() void CG4400_application::set_page_tot_reg()
{ {
reset_print();
TString riga(_stampa_width); TString riga(_stampa_width);
int r=1, rr=0, row=0; int r=1, rr=0, row=0;
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap; real tot_imponib, tot_imposta, tot_imponibp, tot_impostap;
@ -728,7 +729,13 @@ void CG4400_application::set_page_tot_reg()
} }
_doc_array.destroy(); _doc_array.destroy();
if (rr > 0)
rr++; rr++;
else
rr = r;
if (_nrec > 0) //numero records di rmoviva
{
set_row(++rr, "@26g---------- P E R I O D O ----------"); set_row(++rr, "@26g---------- P E R I O D O ----------");
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
set_row(rr,"@82g------ P R O G R E S S I V I ------"); set_row(rr,"@82g------ P R O G R E S S I V I ------");
@ -752,7 +759,6 @@ void CG4400_application::set_page_tot_reg()
set_row(rr++, "@86gImponibile@106gImposta"); set_row(rr++, "@86gImponibile@106gImposta");
else rr++; else rr++;
rr++; rr++;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00; tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_tot_iva_array.sort(compare_rows); _tot_iva_array.sort(compare_rows);
@ -777,7 +783,6 @@ void CG4400_application::set_page_tot_reg()
tot_impostap += riga._impostap; tot_impostap += riga._impostap;
} }
_tot_iva_array.destroy(); _tot_iva_array.destroy();
row++; row++;
set_row(++row, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta); set_row(++row, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
@ -791,7 +796,6 @@ void CG4400_application::set_page_tot_reg()
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00; tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_iva_array.sort(compare); _iva_array.sort(compare);
for (int s = 0; s < _iva_array.items(); s++) for (int s = 0; s < _iva_array.items(); s++)
{ {
TRigaiva& riga = (TRigaiva&)_iva_array[s]; TRigaiva& riga = (TRigaiva&)_iva_array[s];
@ -867,6 +871,7 @@ void CG4400_application::set_page_tot_reg()
_iva_array.destroy(); _iva_array.destroy();
} }
} }
}
bool CG4400_application::compila_reg(const TMask& m) bool CG4400_application::compila_reg(const TMask& m)
{ {
@ -989,7 +994,7 @@ bool CG4400_application::preprocess_print(int file, int counter)
_doc_array.destroy(); _doc_array.destroy();
_dataregp = ""; _dataregp = "";
_mov_empty = TRUE; _mov_empty = TRUE;
//_primast = get_page_number(); _primast = _u_stampata;
set_print_zero(); set_print_zero();
} }
return TRUE; return TRUE;
@ -1086,8 +1091,8 @@ bool CG4400_application::preprocess_page(int file, int counter)
set_row(_r, "@70g%2s", (const char*) _tipodoc); set_row(_r, "@70g%2s", (const char*) _tipodoc);
set_row(_r, "@72g%r", &totdoc); set_row(_r, "@72g%r", &totdoc);
int nrec = riga_rmoviva(); _nrec = riga_rmoviva();
if (nrec > 0) if (_nrec > 0)
{ {
for (int j = 0; j < _riga_rmi.items(); j++) for (int j = 0; j < _riga_rmi.items(); j++)
{ {
@ -1100,9 +1105,11 @@ bool CG4400_application::preprocess_page(int file, int counter)
set_row(rr, "@108g%r", &riga._imposta); set_row(rr, "@108g%r", &riga._imposta);
} }
_riga_rmi.destroy(); _riga_rmi.destroy();
}
int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_TIPOCR); int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_TIPOCR);
set_row(_r, "@124g%d", tipocr); set_row(_r, "@124g%d", tipocr);
}
//int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_TIPOCR);
//set_row(_r, "@124g%d", tipocr);
if (_tipo_stampa == 3) //stampa di prova if (_tipo_stampa == 3) //stampa di prova
{ {
set_row(_r, "@125g%6d", numreg); set_row(_r, "@125g%6d", numreg);
@ -1123,7 +1130,9 @@ void CG4400_application::aggiorna_reg()
long pag; long pag;
//long stampate; //long stampate;
const word ultimast = get_page_number(); word ultimast = get_page_number();
if (_stampa_tutti_i_registri) //ho fatto un salto pagina dopo avere stampato un registro
--ultimast;
codtab << _annoes << _codreg; codtab << _annoes << _codreg;
Tabreg.zero(); Tabreg.zero();
@ -1141,6 +1150,7 @@ void CG4400_application::aggiorna_reg()
} }
if (_tipo_stampa == 2) //stampa su libro unico if (_tipo_stampa == 2) //stampa su libro unico
//sulla tabella %inl (indice libro unico) devo generare una riga per ogni registro stampato //sulla tabella %inl (indice libro unico) devo generare una riga per ogni registro stampato
if (!_mov_empty)
{ {
bool trovato = FALSE; bool trovato = FALSE;
codtab = ""; codtab = "";
@ -1180,12 +1190,12 @@ void CG4400_application::aggiorna_reg()
nuovo.put("CODTAB", cod); nuovo.put("CODTAB", cod);
nuovo.put("I0", (long)_annoes); nuovo.put("I0", (long)_annoes);
nuovo.put("I1", (long)_fino_a_mese); nuovo.put("I1", (long)_fino_a_mese);
nuovo.put("I2", (long)_u_stampata + 1); nuovo.put("I2", (long)(_primast + 1));
nuovo.put("I3", (long)(_u_stampata + ultimast)); nuovo.put("I3", (long)(_primast + ultimast));
nuovo.put("I4", get_firm()); nuovo.put("I4", get_firm());
nuovo.put("S0", _codreg); nuovo.put("S0", _codreg);
nuovo.put("I5", (long)numini); nuovo.put("I5", (long)numini);
nuovo.put("I6", (long)(numini + ultimast)); nuovo.put("I6", (long)(numini + ultimast - 1));
if (trovato) if (trovato)
TabInl.rewrite(nuovo); TabInl.rewrite(nuovo);
@ -1207,7 +1217,7 @@ void CG4400_application::aggiorna_lib()
if (lbu.read() == NOERR) if (lbu.read() == NOERR)
{ {
lbu.put("I0", (long) _fino_a_mese); lbu.put("I0", (long) _fino_a_mese);
lbu.put("I1", (long) _u_stampata - 1); lbu.put("I1", (long) _u_stampata);
lbu.rewrite(); lbu.rewrite();
} }
} }
@ -1255,7 +1265,7 @@ print_action CG4400_application::postprocess_print(int file, int counter)
if ( (_tipo_stampa != 3) && (!_stampa_tutti_i_registri) ) if ( (_tipo_stampa != 3) && (!_stampa_tutti_i_registri) )
aggiorna_reg(); aggiorna_reg();
if (_stampa_tutti_i_registri) if (_stampa_tutti_i_registri)
if (!_mov_empty ) //if (!_mov_empty )
{ {
if (_tipo_stampa == 2) if (_tipo_stampa == 2)
++ _u_stampata; ++ _u_stampata;
@ -1314,7 +1324,7 @@ bool CG4400_application::set_print(int n)
if (set_ditte(m)) if (set_ditte(m))
if (_selected.ones() > 0l) if (_selected.ones() > 0l)
{ {
_annoes = m.get_int(ANNO); _annoes = m.get_int(ANNO);//in realta' e' l'anno IVA !!!
_tipo_stampa = m.get_int(TIPO_STAMPA); _tipo_stampa = m.get_int(TIPO_STAMPA);
//Se stampa di prova l'utente indica data_da e data_a //Se stampa di prova l'utente indica data_da e data_a
if (_tipo_stampa == 3) if (_tipo_stampa == 3)
@ -1393,6 +1403,7 @@ void CG4400_application::stampa_registri_IVA(const TMask& m)
anno = atoi(codtab.mid(0,4)); anno = atoi(codtab.mid(0,4));
if (anno > _annoes) if (anno > _annoes)
break; break;
if (anno == _annoes)
if ( (tipo == 1) || (tipo == 2) ) //registro iva if ( (tipo == 1) || (tipo == 2) ) //registro iva
{ {
_tipo_reg = _tabreg->get_int("I0"); _tipo_reg = _tabreg->get_int("I0");

View File

@ -24,6 +24,9 @@
#include "cglib03.h" #include "cglib03.h"
//const int MAXSTR = 255;
//static char __tmp[MAXSTR];
//enum STAMPA { bollati=1, unici=2 }; //enum STAMPA { bollati=1, unici=2 };
const int TABREG = (int)TTable::name2log("REG"); const int TABREG = (int)TTable::name2log("REG");
@ -75,10 +78,11 @@ class CG4400_application : public TPrintapp
TArray_sheet *_ditte; TArray_sheet *_ditte;
TBit_array _selected; TBit_array _selected;
TArray _nomiditte; //array descrizioni ditte per sheet TArray _nomiditte; //array descrizioni ditte per sheet
TRecnotype _nrec;
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri; bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri;
char _frequiva; char _frequiva;
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg; TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
long _n_ditte, _u_stampata; long _n_ditte, _u_stampata, _primast;
int _fino_a_mese, _tipo_reg, _tipo_stampa, _pagine_stampate; int _fino_a_mese, _tipo_reg, _tipo_stampa, _pagine_stampate;
int _annoes, _r, _stampa_width; // riga corrente di stampa int _annoes, _r, _stampa_width; // riga corrente di stampa
real _totale_doc; real _totale_doc;

View File

@ -13,7 +13,6 @@
#include "cg4400.h" #include "cg4400.h"
static TString256 tmp;
TRectype& TDati_ditta::look_com(const char * cod) TRectype& TDati_ditta::look_com(const char * cod)
{ {
@ -40,8 +39,8 @@ TDati_ditta::~TDati_ditta()
void TDati_ditta::get_dati_ditta () void TDati_ditta::get_dati_ditta ()
{ {
TString16 codanagr; TString codanagr;
char tipoa; TString tipoa;
_nditte->zero(); _nditte->zero();
_nditte->put(NDT_CODDITTA, _codditta); _nditte->put(NDT_CODDITTA, _codditta);
@ -50,8 +49,8 @@ void TDati_ditta::get_dati_ditta ()
if (_nditte->bad()) _nditte->zero(); if (_nditte->bad()) _nditte->zero();
_ragsoc = _nditte->get(NDT_RAGSOC); _ragsoc = _nditte->get(NDT_RAGSOC);
codanagr = _nditte->get(NDT_CODANAGR); codanagr = _nditte->curr().get(NDT_CODANAGR);
tipoa = _nditte->get_char(NDT_TIPOA); tipoa = _nditte->curr().get(NDT_TIPOA);
_anag->setkey(1); _anag->setkey(1);
_anag->zero(); _anag->zero();
@ -88,22 +87,34 @@ void TDati_ditta::get_dati_ditta ()
const char * TDati_ditta::prima_riga() const char * TDati_ditta::prima_riga()
{ {
//TString riga(_stampa_width);
//tmp = "";
TString tmp(132);
get_dati_ditta(); get_dati_ditta();
tmp << "Ditta " << _codditta << ' ' << _ragsoc << " Via " << _viafis << ' '
<< _cap << ' ' << _comunefis << ' ' << _provfis; /*
riga.format("Ditta %d %s Via %s %s %s %s", _codditta,
(const char *)_ragsoc,(const char *)_viafis, (const char *)_cap,
(const char *)_comunefis, (const char *)_provfis);
*/
tmp.format("Ditta %ld ", _codditta);
tmp << format("%s %s %s %s %s",
(const char *)_ragsoc,(const char *)_viafis, (const char *)_cap,
(const char *)_comunefis, (const char *)_provfis);
//tmp = riga;
return tmp; return tmp;
} }
const char * TDati_ditta::seconda_riga() const char * TDati_ditta::seconda_riga()
{ {
TString riga(_stampa_width); //TString riga(_stampa_width);
tmp = ""; //tmp = "";
riga = "Data @<"; TString tmp(132);
riga.right_just(_stampa_width-15); tmp = "Data @<";
riga.overwrite (format ("Partita iva %s @26gCodice fiscale %s", tmp.right_just(_stampa_width-15);
tmp.overwrite (format ("Partita iva %s @26gCodice fiscale %s",
(const char*)_paiva, (const char*)_cofi)); (const char*)_paiva, (const char*)_cofi));
tmp = riga; //tmp = riga;
return __tmp; return tmp;
} }