Vari errori fixed

git-svn-id: svn://10.65.10.50/trunk@98 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1994-08-30 10:46:13 +00:00
parent 34b0846f4e
commit 4bb1d58265

View File

@ -17,6 +17,7 @@
#include <clifo.h> #include <clifo.h>
#include <attiv.h> #include <attiv.h>
#include <causali.h> #include <causali.h>
#include <nditte.h>
#include <msg.h> #include <msg.h>
#include "cg3.h" #include "cg3.h"
@ -43,7 +44,7 @@ class CG3100_application : public TPrintapp
TRigaiva_array _c; TRigaiva_array _c;
TTable * _tabiva, * _tabtpd, * _tabreg; TTable * _tabiva, * _tabtpd, * _tabreg;
TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv; TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte;
TRelation * _relmov,* _relmov1,* _relmov2,* _relmov3; TRelation * _relmov,* _relmov1,* _relmov2,* _relmov3;
TCursor * _curr1, * _curr2, * _curr3; TCursor * _curr1, * _curr2, * _curr3;
TDate _data_ini, _data_fin, _datareg, _data_prec; TDate _data_ini, _data_fin, _datareg, _data_prec;
@ -65,7 +66,7 @@ class CG3100_application : public TPrintapp
real _tot_dare_giornaliero, _tot_dare_generale, _tot_avere_generale; real _tot_dare_giornaliero, _tot_dare_generale, _tot_avere_generale;
bool _intracom, _no_preprocess_page, _salto_pagina; bool _intracom, _no_preprocess_page, _salto_pagina;
bool _stampa_parte_iva,_alleg_causale,_stampa_mess_alleg_iva,_allegb,_ricser; bool _stampa_parte_iva,_alleg_causale,_stampa_mess_alleg_iva,_allegb,_ricser;
bool _settata_prima_riga; bool _settata_prima_riga, _causale_gia_stampata;
int _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,_tipod,_controllo_mov_errati; int _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,_tipod,_controllo_mov_errati;
int _numero_riga, _alleg, _tiporegistro, _tipocr, _scelta_stampa, _nr, _n; int _numero_riga, _alleg, _tiporegistro, _tipocr, _scelta_stampa, _nr, _n;
liste _tipo_lista; liste _tipo_lista;
@ -456,13 +457,13 @@ void CG3100_application::set_page(int file, int count)
case movimenti: case movimenti:
if (file == LF_RMOVIVA) if (file == LF_RMOVIVA)
break; break;
if (file == LF_RMOV) if (file == LF_RMOV)
{ {
_nr = 1; _nr = 1;
set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG)); set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG));
set_row(_nr,"@5g@3s",FLD(LF_MOV,MOV_CODCAUS)); // set_row(_nr,"@5g@3s",FLD(LF_MOV,MOV_CODCAUS));
set_row(_nr,"@9g#.20t", &_descr_causale); // set_row(_nr,"@9g#.20t", &_descr_causale);
set_row(_nr,"@31g@24s",FLD(LF_RMOV,RMV_DESCR)); set_row(_nr,"@30g@24s",FLD(LF_RMOV,RMV_DESCR));
set_row(_nr,"@56g@4n",FLD(LF_RMOV,RMV_GRUPPO)); set_row(_nr,"@56g@4n",FLD(LF_RMOV,RMV_GRUPPO));
set_row(_nr,"@61g@3n",FLD(LF_RMOV,RMV_CONTO)); set_row(_nr,"@61g@3n",FLD(LF_RMOV,RMV_CONTO));
set_row(_nr,"@65g@6n",FLD(LF_RMOV,RMV_SOTTOCONTO)); set_row(_nr,"@65g@6n",FLD(LF_RMOV,RMV_SOTTOCONTO));
@ -478,8 +479,9 @@ void CG3100_application::set_page(int file, int count)
{ {
_n = 1; _n = 1;
set_row (_n, "Registrazione n. @18g@7n", FLD(LF_MOV,MOV_NUMREG)); set_row (_n, "Registrazione n. @18g@7n", FLD(LF_MOV,MOV_NUMREG));
// set_row (_n, "@23g@3s",FLD(LF_MOV,MOV_CODCAUS));
set_row (_n, "@26gdel@30g@d",FLD(LF_MOV,MOV_DATAREG)); set_row (_n, "@26gdel@30g@d",FLD(LF_MOV,MOV_DATAREG));
set_row (_n, "@41g@40s",FLD(LF_MOV,MOV_DESCR)); set_row (_n, "@41g@40s",FLD(LF_MOV,MOV_DESCR));
set_row (_n, "@82gdocumento n.@95g@7s",FLD(LF_MOV,MOV_NUMDOC)); set_row (_n, "@82gdocumento n.@95g@7s",FLD(LF_MOV,MOV_NUMDOC));
set_row (_n, "@103gdel@107g@d", FLD(LF_MOV,MOV_DATADOC)); set_row (_n, "@103gdel@107g@d", FLD(LF_MOV,MOV_DATADOC));
set_row (_n, "@118g@4n", FLD(LF_MOV,MOV_ANNOES)); set_row (_n, "@118g@4n", FLD(LF_MOV,MOV_ANNOES));
@ -505,9 +507,9 @@ void CG3100_application::stampa_intestazione()
sep = ""; sep = "";
set_row (1,(const char*)sep); set_row (1,(const char*)sep);
if (_tipo_elenco == "C") if (_tipo_elenco == "C")
set_row (2, "Cliente@9g@b@6n", FLD(LF_MOV,MOV_CODCF)); set_row (2, "Cliente@9g@6n", FLD(LF_MOV,MOV_CODCF));
else else
set_row (2, "Fornitore@12g@b@6n", FLD(LF_MOV,MOV_CODCF)); set_row (2, "Fornitore@12g@6n", FLD(LF_MOV,MOV_CODCF));
set_row (2, "@18g#35t", &_ragsoc); set_row (2, "@18g#35t", &_ragsoc);
set_row (2, "@54gInd #29t", &_indcf); set_row (2, "@54gInd #29t", &_indcf);
set_row (2, "@87g#10t", &_civcf); set_row (2, "@87g#10t", &_civcf);
@ -521,11 +523,12 @@ void CG3100_application::stampa_intestazione()
set_row (3,"@89gPr #5t", &_provcom); set_row (3,"@89gPr #5t", &_provcom);
set_row (3, "@98gC.F. #16t", &_cofi); set_row (3, "@98gC.F. #16t", &_cofi);
if (_alleg == 0) if (_alleg == 0)
set_row (3, "@120gRifer@126g#6d", _codalleg); set_row (3, "@120gRifer@126g#6d", &_codalleg);
} }
bool CG3100_application::preprocess_page(int file,int counter) bool CG3100_application::preprocess_page(int file,int counter)
{ {
TCursor * cur = current_cursor(); TCursor * cur = current_cursor();
if (counter) return TRUE; if (counter) return TRUE;
@ -546,6 +549,8 @@ bool CG3100_application::preprocess_page(int file,int counter)
_anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES); _anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);
_tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC); _tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
_datareg = current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG); _datareg = current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG);
_causale_gia_stampata = FALSE;
//TDate data_corrente (current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG)); //TDate data_corrente (current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG));
_tiporegistro = CodiceRegistro(_registro, _anno); _tiporegistro = CodiceRegistro(_registro, _anno);
@ -567,7 +572,6 @@ bool CG3100_application::preprocess_page(int file,int counter)
if ((fl->curr() >= da) && (fl->curr() <= a)) if ((fl->curr() >= da) && (fl->curr() <= a))
//&&((_tiporegistro == 1)||(_tiporegistro == 2))) //&&((_tiporegistro == 1)||(_tiporegistro == 2)))
{ {
_caus->setkey(1); _caus->setkey(1);
_caus->curr().put(CAU_CODCAUS,_causale); _caus->curr().put(CAU_CODCAUS,_causale);
_caus->read(); _caus->read();
@ -591,6 +595,13 @@ bool CG3100_application::preprocess_page(int file,int counter)
} }
else if (file == LF_RMOV) else if (file == LF_RMOV)
{ {
if (!_causale_gia_stampata)
{
set_row(_nr,"@4g%3s", (const char*) _causale);
set_row(_nr,"@8g%.20s", (const char*) _descr_causale);
_causale_gia_stampata = TRUE;
}
if (((_controllo_mov_errati == 1)&&(segnala_errori_ogniriga()))||(_controllo_mov_errati == 2)||(_controllo_mov_errati == 3)) if (((_controllo_mov_errati == 1)&&(segnala_errori_ogniriga()))||(_controllo_mov_errati == 2)||(_controllo_mov_errati == 3))
{ {
int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO); int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO);
@ -676,32 +687,30 @@ bool CG3100_application::preprocess_page(int file,int counter)
return TRUE; return TRUE;
} }
} }
else else if (file == LF_RMOV)
if (file == LF_RMOV) {
long gruppo = atol(current_cursor()->curr(LF_RMOV).get(RMV_GRUPPO));
long conto = atol(current_cursor()->curr(LF_RMOV).get(RMV_CONTO));
long sottoconto = atol(current_cursor()->curr(LF_RMOV).get(RMV_SOTTOCONTO));
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
_importo = current_cursor()->file(LF_RMOV)->get_real(RMV_IMPORTO);
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
if (!_no_preprocess_page)
{ {
long gruppo = atol(current_cursor()->curr(LF_RMOV).get(RMV_GRUPPO)); if ((_appoggio=="D")||(_appoggio=="d"))
long conto = atol(current_cursor()->curr(LF_RMOV).get(RMV_CONTO));
long sottoconto = atol(current_cursor()->curr(LF_RMOV).get(RMV_SOTTOCONTO));
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
_importo = current_cursor()->file(LF_RMOV)->get_real(RMV_IMPORTO);
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
if (!_no_preprocess_page)
{ {
if ((_appoggio=="D")||(_appoggio=="d")) _tot_dare_generale += _importo;
{ _tot_dare += _importo;
_tot_dare_generale += _importo; }
_tot_dare += _importo; else if ((_appoggio=="A")||(_appoggio=="a"))
} {
_tot_avere += _importo;
else if ((_appoggio=="A")||(_appoggio=="a")) _tot_avere_generale += _importo;
{
_tot_avere += _importo;
_tot_avere_generale += _importo;
}
} }
return TRUE;
} }
return TRUE;
}
} }
break; break;
@ -775,20 +784,31 @@ bool CG3100_application::preprocess_page(int file,int counter)
} }
else if (file == LF_RMOVIVA) else if (file == LF_RMOVIVA)
{ {
int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO);
int conto = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO);
_pcon->zero();
_pcon->put("GRUPPO",gruppo);
_pcon->put("CONTO", conto);
_pcon->put("SOTTOCONTO", 0L);
if (_pcon->read() == NOERR)
_ricser = _pcon->get_int("RICSER");
_simbolo = SimboloValuta(_codval); _simbolo = SimboloValuta(_codval);
_allegb = CausAlleg(_codcaus); _allegb = CausAlleg(_codcaus);
_descr_doc = DescrDoc(_tipodoc); _descr_doc = DescrDoc(_tipodoc);
_totdocumenti += _totdoc; _totdocumenti += _totdoc;
_ricser = current_cursor()->curr(LF_RMOVIVA).get_int(RMI_RICSER); //_ricser = current_cursor()->curr(LF_RMOVIVA).get_int(RMI_RICSER);
_intracom = current_cursor()->curr(LF_RMOVIVA).get_bool(RMI_INTRA); _intracom = current_cursor()->curr(LF_RMOVIVA).get_bool(RMI_INTRA);
// long numeroreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG); //long numeroreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG);
if ((_codval != "LIT") && _intracom) if ((_codval != "LIT") && _intracom)
{ {
reset_row(1); reset_row(1);
set_row(1,"Corr.in lire@14g@pN",FLD(LF_RMOVIVA,RMI_CORRLIRE,"###.###.###.###")); set_row(1,"Corr.in lire@14g@pN",FLD(LF_MOV,MOV_CORRLIRE,"###.###.###.###"));
set_row(1,"@34gCorr.in valuta@49g@pN",FLD(LF_RMOVIVA,RMI_CORRVALUTA,"###.###.###.###")); set_row(1,"@34gCorr.in valuta@49g@pN",FLD(LF_MOV,MOV_CORRVALUTA,"###.###.###.###"));
if (_simbolo.not_empty()) if (_simbolo.not_empty())
set_row(1,"@65g%.5s", (const char *)_simbolo); set_row(1,"@65g%.5s", (const char *)_simbolo);
else else
@ -802,8 +822,8 @@ bool CG3100_application::preprocess_page(int file,int counter)
set_row(1,"@17g@3,rs",FLD(LF_MOV,MOV_REG)); set_row(1,"@17g@3,rs",FLD(LF_MOV,MOV_REG));
set_row(1,"@21g@5n",FLD(LF_MOV,MOV_PROTIVA)); set_row(1,"@21g@5n",FLD(LF_MOV,MOV_PROTIVA));
TString protiva = cur->curr(LF_MOV).get(MOV_PROTIVA); TString protiva = cur->curr(LF_MOV).get(MOV_PROTIVA);
TString uprotiva = cur->curr(LF_MOV).get(MOV_UPROTIVA); TString uprotiva = cur->curr(LF_MOV).get(MOV_UPROTIVA);
if (uprotiva.not_empty()) if (uprotiva.not_empty())
{ {
@ -868,8 +888,10 @@ print_action CG3100_application::postprocess_page(int file,int count)
{ {
case movimenti: case movimenti:
if (file == LF_RMOV) if (file == LF_RMOV)
{
force_setpage(); force_setpage();
break; break;
}
if (_scelta_stampa == 0) if (_scelta_stampa == 0)
{ {
if (file == LF_MOV) if (file == LF_MOV)
@ -1292,11 +1314,13 @@ bool CG3100_application::set_print(int m)
_masc = ""; _masc = "";
switch(m) switch(m)
{ {
case 1: case 1:
// case 2:
_masc = "cg3100a"; _masc = "cg3100a";
_tipo_lista = movimenti; _tipo_lista = movimenti;
break; break;
case 2: case 2:
// case 1:
_masc = "cg3100b"; _masc = "cg3100b";
_tipo_lista = fatture; _tipo_lista = fatture;
break; break;
@ -1313,6 +1337,9 @@ bool CG3100_application::set_print(int m)
reset_files(); reset_files();
TLocalisamfile* fl; TLocalisamfile* fl;
_curr1->set_filterfunction (filter_func);
_curr2->set_filterfunction (filter_func);
_curr3->set_filterfunction (filter_func_fatture);
switch (_tipo_lista) switch (_tipo_lista)
{ {
case movimenti: case movimenti:
@ -1336,8 +1363,8 @@ bool CG3100_application::set_print(int m)
{ {
select_cursor(_cur1); select_cursor(_cur1);
if (!provvis) if (!provvis)
_curr1->setfilter("(PROVVIS=\"\")"); _curr1->filter("(PROVVIS=\"\")");
else _curr1->setfilter(""); else _curr1->filter("");
fl = current_cursor()->file(LF_MOV); fl = current_cursor()->file(LF_MOV);
TRectype da (fl->curr()); TRectype da (fl->curr());
TRectype a (fl->curr()); TRectype a (fl->curr());
@ -1345,7 +1372,7 @@ bool CG3100_application::set_print(int m)
a.zero(); a.zero();
da.put(MOV_NUMREG, _numreg_ini); da.put(MOV_NUMREG, _numreg_ini);
a.put(MOV_NUMREG, _numreg_fin); a.put(MOV_NUMREG, _numreg_fin);
current_cursor()->setregion(da,a); current_cursor()->setregion(&da,&a);
add_file(LF_MOV); add_file(LF_MOV);
add_file(LF_RMOV,LF_MOV); add_file(LF_RMOV,LF_MOV);
add_file(LF_RMOVIVA,LF_MOV); add_file(LF_RMOVIVA,LF_MOV);
@ -1354,7 +1381,7 @@ bool CG3100_application::set_print(int m)
{ {
select_cursor(_cur2); select_cursor(_cur2);
if (!provvis) if (!provvis)
_curr2->setfilter("(PROVVIS=\"\")"); else _curr2->setfilter(""); _curr2->filter("(PROVVIS=\"\")"); else _curr2->filter("");
fl = current_cursor()->file(LF_MOV); fl = current_cursor()->file(LF_MOV);
TRectype da (fl->curr()); TRectype da (fl->curr());
TRectype a (fl->curr()); TRectype a (fl->curr());
@ -1362,7 +1389,7 @@ bool CG3100_application::set_print(int m)
a.zero(); a.zero();
da.put(MOV_DATAREG, _data_ini); da.put(MOV_DATAREG, _data_ini);
a.put(MOV_DATAREG, _data_fin); a.put(MOV_DATAREG, _data_fin);
current_cursor()->setregion(da,a); current_cursor()->setregion(&da,&a);
add_file(LF_MOV); add_file(LF_MOV);
add_file(LF_RMOV,LF_MOV); add_file(LF_RMOV,LF_MOV);
add_file(LF_RMOVIVA,LF_MOV); add_file(LF_RMOVIVA,LF_MOV);
@ -1399,8 +1426,8 @@ bool CG3100_application::set_print(int m)
} }
select_cursor(_cur3); select_cursor(_cur3);
if (!movprov) if (!movprov)
_curr3->setfilter("(PROVVIS=\"\")"); _curr3->filter("(PROVVIS=\"\")");
else _curr3->setfilter(""); else _curr3->filter("");
TRectype da (fl->curr()); TRectype da (fl->curr());
TRectype a (fl->curr()); TRectype a (fl->curr());
da.zero(); da.zero();
@ -1413,7 +1440,7 @@ bool CG3100_application::set_print(int m)
da.put(MOV_DATAREG, _data_ini); da.put(MOV_DATAREG, _data_ini);
a.put(MOV_DATAREG, _data_fin); a.put(MOV_DATAREG, _data_fin);
da.put(MOV_TIPO, _tipo_ini); da.put(MOV_TIPO, _tipo_ini);
current_cursor()->setregion(da,a); current_cursor()->setregion(&da,&a);
add_file(LF_MOV); add_file(LF_MOV);
add_file(LF_RMOVIVA,LF_MOV); add_file(LF_RMOVIVA,LF_MOV);
@ -1446,6 +1473,7 @@ void CG3100_application::user_create()
_relmov2->add(LF_RMOV, "NUMREG=NUMREG",1); _relmov2->add(LF_RMOV, "NUMREG=NUMREG",1);
_relmov2->add(LF_RMOVIVA, "NUMREG=NUMREG",1); _relmov2->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
_relmov3->add(LF_RMOVIVA, "NUMREG=NUMREG",1); _relmov3->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
_relmov3->add(LF_RMOV, "NUMREG=NUMREG",1);
_curr1 = new TCursor (_relmov1, "", 1); _curr1 = new TCursor (_relmov1, "", 1);
_curr2 = new TCursor (_relmov2, "", 2); _curr2 = new TCursor (_relmov2, "", 2);
@ -1455,9 +1483,9 @@ void CG3100_application::user_create()
_cur2 = add_cursor (_curr2); _cur2 = add_cursor (_curr2);
_cur3 = add_cursor (_curr3); _cur3 = add_cursor (_curr3);
_curr1->set_filterfunction (filter_func); //_curr1->set_filterfunction (filter_func);
_curr2->set_filterfunction (filter_func); //_curr2->set_filterfunction (filter_func);
_curr3->set_filterfunction (filter_func_fatture); //_curr3->set_filterfunction (filter_func_fatture);
_caus = new TLocalisamfile(LF_CAUSALI); _caus = new TLocalisamfile(LF_CAUSALI);
_clifo = new TLocalisamfile(LF_CLIFO); _clifo = new TLocalisamfile(LF_CLIFO);
@ -1465,6 +1493,7 @@ void CG3100_application::user_create()
_attiv = new TLocalisamfile(LF_ATTIV); _attiv = new TLocalisamfile(LF_ATTIV);
_pcon = new TLocalisamfile(LF_PCON); _pcon = new TLocalisamfile(LF_PCON);
_rmoviva = new TLocalisamfile(LF_RMOVIVA); _rmoviva = new TLocalisamfile(LF_RMOVIVA);
_nditte = new TLocalisamfile(LF_NDITTE);
_tabiva = new TTable(TAB_IVA); _tabiva = new TTable(TAB_IVA);
_tabtpd = new TTable(TAB_TPD); _tabtpd = new TTable(TAB_TPD);
_tabreg = new TTable("REG"); _tabreg = new TTable("REG");
@ -1621,19 +1650,23 @@ break;
default: default:
break; break;
} }
}
}
void CG3100_application::preprocess_header() void CG3100_application::preprocess_header()
{ {
int soh; // riga d'inizio dell'intestazione int soh; // riga d'inizio dell'intestazione
TString sep(132); TString sep(132);
TLocalisamfile nditte(LF_NDITTE);
reset_header(); nditte.zero();
nditte.put(NDT_CODDITTA, get_firm());
soh=1; if (nditte.read() == NOERR)
_ragsoc = nditte.get(NDT_RAGSOC);
reset_header();
soh=1;
sep << "Ditta " << get_firm(); sep << "Ditta " << get_firm();
sep << " " << _ragsoc;
sep.left_just(132); sep.left_just(132);
set_header (soh++, (const char*) sep); set_header (soh++, (const char*) sep);
@ -1697,7 +1730,7 @@ void CG3100_application::preprocess_header()
set_header (soh, "@78gcon messaggi: allegato iva"); set_header (soh, "@78gcon messaggi: allegato iva");
sep.fill('-'); sep.fill('-');
set_header (++soh, (const char *) sep); set_header (++soh, (const char *) sep);
set_header (++soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@72gDescrizione conto@93gDare@112gAvere@130gSB"); set_header (++soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@72gDescrizione conto@98gDare@116gAvere@130gSB");
} }
else else
{ {
@ -1726,7 +1759,7 @@ void CG3100_application::preprocess_header()
set_header (soh++, "@86gtutte le causali"); set_header (soh++, "@86gtutte le causali");
sep.fill('-'); sep.fill('-');
set_header (soh++, (const char *) sep); set_header (soh++, (const char *) sep);
set_header (soh++, "Rg Cod Causale@30gDescrizione@56gCodice conto@72gDescrizione conto@93gDare@112gAvere@130gSB"); set_header (soh++, "Rg Cod Causale@30gDescrizione@56gCodice conto@72gDescrizione conto@98gDare@116gAvere@130gSB");
} }
break; break;