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 "cg4400a.h"
static TString256 TMP;
TFixed_string TMP (__tmp, MAXSTR);
HIDDEN CG4400_application * app() { return (CG4400_application*) MainApp(); }
@ -329,7 +329,7 @@ const char * CG4400_application::descr_doc(const char * tipo)
else
TMP = "";
return TMP;
return __tmp;
}
const char * CG4400_application::descr_iva(const char * cod)
@ -344,7 +344,7 @@ const char * CG4400_application::descr_iva(const char * cod)
else
TMP = "";
return TMP;
return __tmp;
}
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");
else
TMP = "";
return TMP;
return __tmp;
}
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);
else
TMP = "";
return TMP;
return __tmp;
}
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);
else
TMP = "";
return TMP;
return __tmp;
}
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()
{
reset_print();
TString riga(_stampa_width);
int r=1, rr=0, row=0;
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap;
@ -728,144 +729,148 @@ void CG4400_application::set_page_tot_reg()
}
_doc_array.destroy();
rr++;
set_row(++rr, "@26g---------- P E R I O D O ----------");
if (_tipo_stampa != 3)
set_row(rr,"@82g------ P R O G R E S S I V I ------");
rr++;
set_row(rr, "Cod.");
if (_tipo_reg == 2)
{
set_row(rr, "@36gA C Q U I S T I");
if (_tipo_stampa != 3)
set_row(rr, "@92gA C Q U I S T I");
}
if (_tipo_reg == 1)
{
set_row(rr, "@37gV E N D I T E");
if (_tipo_stampa != 3)
set_row(rr, "@93gV E N D I T E");
}
rr++;
set_row(rr, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rr++, "@86gImponibile@106gImposta");
else rr++;
rr++;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_tot_iva_array.sort(compare_rows);
for (int k = 0; k < _tot_iva_array.items(); k++)
{
TRiga& riga = (TRiga&)_tot_iva_array[k];
row = rr+k;
set_row(row, "%3s", (const char*)riga._codiva);
TString descr = descr_iva(riga._codiva);
set_row(row, "@5g%s", (const char*)descr);
set_row(row, "@25g%r", &riga._imponibile);
set_row(row, "@41g%r", &riga._imposta);
if (_tipo_stampa != 3)
{
set_row(row, "@81g%r", &riga._imponibilep);
set_row(row, "@98g%r", &riga._impostap);
}
tot_imponib += riga._imponibile;
tot_imposta += riga._imposta;
tot_imponibp += riga._imponibilep;
tot_impostap += riga._impostap;
}
_tot_iva_array.destroy();
if (rr > 0)
rr++;
else
rr = r;
row++;
set_row(++row, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(row, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
//la stampa "tipi di indetraibilita'" viene fatta solo per gli acquisti
if (_tipo_reg == 2)
if (_nrec > 0) //numero records di rmoviva
{
row+=2;
int tdetprec = -1;
int rw = row;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_iva_array.sort(compare);
for (int s = 0; s < _iva_array.items(); s++)
set_row(++rr, "@26g---------- P E R I O D O ----------");
if (_tipo_stampa != 3)
set_row(rr,"@82g------ P R O G R E S S I V I ------");
rr++;
set_row(rr, "Cod.");
if (_tipo_reg == 2)
{
TRigaiva& riga = (TRigaiva&)_iva_array[s];
switch (riga._tipodet)
{
case 1: if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Indetraibile su op.es. -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 3: if (tdetprec == 1)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Passaggi interni -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 9: if ( (tdetprec == 1) || (tdetprec == 3) )
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- N.D. 9 - acquisti indeducibili per ART.19 -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
default: break;
}
}
if (tdetprec == 9)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
set_row(rr, "@36gA C Q U I S T I");
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
set_row(rr, "@92gA C Q U I S T I");
}
_iva_array.destroy();
}
if (_tipo_reg == 1)
{
set_row(rr, "@37gV E N D I T E");
if (_tipo_stampa != 3)
set_row(rr, "@93gV E N D I T E");
}
rr++;
set_row(rr, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rr++, "@86gImponibile@106gImposta");
else rr++;
rr++;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_tot_iva_array.sort(compare_rows);
for (int k = 0; k < _tot_iva_array.items(); k++)
{
TRiga& riga = (TRiga&)_tot_iva_array[k];
row = rr+k;
set_row(row, "%3s", (const char*)riga._codiva);
TString descr = descr_iva(riga._codiva);
set_row(row, "@5g%s", (const char*)descr);
set_row(row, "@25g%r", &riga._imponibile);
set_row(row, "@41g%r", &riga._imposta);
if (_tipo_stampa != 3)
{
set_row(row, "@81g%r", &riga._imponibilep);
set_row(row, "@98g%r", &riga._impostap);
}
tot_imponib += riga._imponibile;
tot_imposta += riga._imposta;
tot_imponibp += riga._imponibilep;
tot_impostap += riga._impostap;
}
_tot_iva_array.destroy();
row++;
set_row(++row, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(row, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
//la stampa "tipi di indetraibilita'" viene fatta solo per gli acquisti
if (_tipo_reg == 2)
{
row+=2;
int tdetprec = -1;
int rw = row;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_iva_array.sort(compare);
for (int s = 0; s < _iva_array.items(); s++)
{
TRigaiva& riga = (TRigaiva&)_iva_array[s];
switch (riga._tipodet)
{
case 1: if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Indetraibile su op.es. -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 3: if (tdetprec == 1)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Passaggi interni -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 9: if ( (tdetprec == 1) || (tdetprec == 3) )
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- N.D. 9 - acquisti indeducibili per ART.19 -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
default: break;
}
}
if (tdetprec == 9)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
}
_iva_array.destroy();
}
}
}
bool CG4400_application::compila_reg(const TMask& m)
@ -989,7 +994,7 @@ bool CG4400_application::preprocess_print(int file, int counter)
_doc_array.destroy();
_dataregp = "";
_mov_empty = TRUE;
//_primast = get_page_number();
_primast = _u_stampata;
set_print_zero();
}
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, "@72g%r", &totdoc);
int nrec = riga_rmoviva();
if (nrec > 0)
_nrec = riga_rmoviva();
if (_nrec > 0)
{
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);
}
_riga_rmi.destroy();
int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_TIPOCR);
set_row(_r, "@124g%d", tipocr);
}
int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_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
{
set_row(_r, "@125g%6d", numreg);
@ -1123,7 +1130,9 @@ void CG4400_application::aggiorna_reg()
long pag;
//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;
Tabreg.zero();
@ -1141,59 +1150,60 @@ void CG4400_application::aggiorna_reg()
}
if (_tipo_stampa == 2) //stampa su libro unico
//sulla tabella %inl (indice libro unico) devo generare una riga per ogni registro stampato
{
bool trovato = FALSE;
codtab = "";
codtab << _annoes << _codlib;
TabInl.zero();
TRectype nuovo (TabInl.curr());
TRectype recprec (TabInl.curr());
TabInl.put("CODTAB", codtab);
TRectype rec (TabInl.curr());
TabInl.read (_isgteq);
for (; !TabInl.eof(); TabInl.next())
{
if (TabInl.curr() != rec) break;
trovato = TRUE;
recprec = TabInl.curr();
}
TString cod = "";
if (trovato)
{
TString16 cod_inl = recprec.get("CODTAB");
long numero_riga = atol(cod_inl.mid(7,6)) + 1;
TString16 num_riga (format("%6d", numero_riga));
cod_inl = cod_inl.mid(0,7);
nuovo = recprec;
cod << cod_inl << num_riga;
}
else
if (!_mov_empty)
{
TString16 num_riga ( format("%6d", 1L) );
cod << codtab << num_riga;
}
long numini = _pagine_stampate + 1;
nuovo.put("CODTAB", cod);
nuovo.put("I0", (long)_annoes);
nuovo.put("I1", (long)_fino_a_mese);
nuovo.put("I2", (long)_u_stampata + 1);
nuovo.put("I3", (long)(_u_stampata + ultimast));
nuovo.put("I4", get_firm());
nuovo.put("S0", _codreg);
nuovo.put("I5", (long)numini);
nuovo.put("I6", (long)(numini + ultimast));
if (trovato)
TabInl.rewrite(nuovo);
else
TabInl.write(nuovo);
_u_stampata += ultimast;
}
bool trovato = FALSE;
codtab = "";
codtab << _annoes << _codlib;
TabInl.zero();
TRectype nuovo (TabInl.curr());
TRectype recprec (TabInl.curr());
TabInl.put("CODTAB", codtab);
TRectype rec (TabInl.curr());
TabInl.read (_isgteq);
for (; !TabInl.eof(); TabInl.next())
{
if (TabInl.curr() != rec) break;
trovato = TRUE;
recprec = TabInl.curr();
}
TString cod = "";
if (trovato)
{
TString16 cod_inl = recprec.get("CODTAB");
long numero_riga = atol(cod_inl.mid(7,6)) + 1;
TString16 num_riga (format("%6d", numero_riga));
cod_inl = cod_inl.mid(0,7);
nuovo = recprec;
cod << cod_inl << num_riga;
}
else
{
TString16 num_riga ( format("%6d", 1L) );
cod << codtab << num_riga;
}
long numini = _pagine_stampate + 1;
nuovo.put("CODTAB", cod);
nuovo.put("I0", (long)_annoes);
nuovo.put("I1", (long)_fino_a_mese);
nuovo.put("I2", (long)(_primast + 1));
nuovo.put("I3", (long)(_primast + ultimast));
nuovo.put("I4", get_firm());
nuovo.put("S0", _codreg);
nuovo.put("I5", (long)numini);
nuovo.put("I6", (long)(numini + ultimast - 1));
if (trovato)
TabInl.rewrite(nuovo);
else
TabInl.write(nuovo);
_u_stampata += ultimast;
}
}
void CG4400_application::aggiorna_lib()
@ -1207,7 +1217,7 @@ void CG4400_application::aggiorna_lib()
if (lbu.read() == NOERR)
{
lbu.put("I0", (long) _fino_a_mese);
lbu.put("I1", (long) _u_stampata - 1);
lbu.put("I1", (long) _u_stampata);
lbu.rewrite();
}
}
@ -1255,12 +1265,12 @@ print_action CG4400_application::postprocess_print(int file, int counter)
if ( (_tipo_stampa != 3) && (!_stampa_tutti_i_registri) )
aggiorna_reg();
if (_stampa_tutti_i_registri)
if (!_mov_empty )
{
if (_tipo_stampa == 2)
++ _u_stampata;
printer().formfeed();
}
//if (!_mov_empty )
{
if (_tipo_stampa == 2)
++ _u_stampata;
printer().formfeed();
}
/*
if (_stampa_tutti_i_registri)
{
@ -1314,7 +1324,7 @@ bool CG4400_application::set_print(int n)
if (set_ditte(m))
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);
//Se stampa di prova l'utente indica data_da e data_a
if (_tipo_stampa == 3)
@ -1355,7 +1365,7 @@ bool CG4400_application::set_print(int n)
compila_lib();
stampa_registri_IVA(m);
}
else warning_box("Nessuna ditta selezionata!");
else warning_box("Nessuna ditta selezionata!");
return FALSE;
}
@ -1393,26 +1403,27 @@ void CG4400_application::stampa_registri_IVA(const TMask& m)
anno = atoi(codtab.mid(0,4));
if (anno > _annoes)
break;
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");
_pagine_stampate = _tabreg->get_int("I1");
_codreg = codtab.mid(4,3);
_codatt = _tabreg->get("S8");
_attivita = desc_attivita(_codatt);
_desc_lib = _tabreg->get ("S0");
//_primast = get_page_number();
//if (!_mov_empty )
// printer().formfeed();
_cur->set_filterfunction(NULL);
_cur->set_filterfunction(filter_func);
//set_page_number(_u_stampata + 1);
print();
if (_tipo_stampa != 3) aggiorna_reg();
}
if (anno == _annoes)
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");
_pagine_stampate = _tabreg->get_int("I1");
_codreg = codtab.mid(4,3);
_codatt = _tabreg->get("S8");
_attivita = desc_attivita(_codatt);
_desc_lib = _tabreg->get ("S0");
//_primast = get_page_number();
//if (!_mov_empty )
// printer().formfeed();
_cur->set_filterfunction(NULL);
_cur->set_filterfunction(filter_func);
//set_page_number(_u_stampata + 1);
print();
if (_tipo_stampa != 3) aggiorna_reg();
}
}
}
if (_tipo_stampa == 2)

View File

@ -24,6 +24,9 @@
#include "cglib03.h"
//const int MAXSTR = 255;
//static char __tmp[MAXSTR];
//enum STAMPA { bollati=1, unici=2 };
const int TABREG = (int)TTable::name2log("REG");
@ -75,10 +78,11 @@ class CG4400_application : public TPrintapp
TArray_sheet *_ditte;
TBit_array _selected;
TArray _nomiditte; //array descrizioni ditte per sheet
TRecnotype _nrec;
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri;
char _frequiva;
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 _annoes, _r, _stampa_width; // riga corrente di stampa
real _totale_doc;

View File

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