Pulizia stampe (cg1 - fase 1).

git-svn-id: svn://10.65.10.50/trunk@51 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1994-08-23 12:53:59 +00:00
parent ec0c54497d
commit 5f96e2e4ea
7 changed files with 7833 additions and 7967 deletions

View File

@ -6,20 +6,28 @@
int main(int argc,char** argv) int main(int argc,char** argv)
{ {
const int n = (argc > 1) ? atoi(argv[1]+1) : -1; const int n = (argc > 1) ? atoi(argv[1]+1) : -1;
switch(n) switch(n)
{ {
case 0: cg1100(argc,argv); break; case 0:
case 1: cg1200(argc,argv); break; cg1100(argc,argv); break;
case 2: cg1300(argc,argv); break; case 1:
case 3: cg1400(argc,argv); break; cg1200(argc,argv); break;
case 4: cg1500(argc,argv); break; case 2:
// case 5: cg1600(argc,argv); break; cg1300(argc,argv); break;
case 6: cg1700(argc,argv); break; case 3:
default: error_box(usage, argv[0]); break; cg1400(argc,argv); break;
} case 4:
cg1500(argc,argv); break;
case 5:
cg1600(argc,argv); break;
case 6:
cg1700(argc,argv); break;
default:
error_box(usage, argv[0]); break;
}
return n < 0; return n < 0;
} }

View File

@ -21,7 +21,7 @@ int cg1200(int argc, char* argv[]);
int cg1300(int argc, char* argv[]); int cg1300(int argc, char* argv[]);
int cg1400(int argc, char* argv[]); int cg1400(int argc, char* argv[]);
int cg1500(int argc, char* argv[]); int cg1500(int argc, char* argv[]);
//int cg1600(int argc, char* argv[]); int cg1600(int argc, char* argv[]);
int cg1700(int argc, char* argv[]); int cg1700(int argc, char* argv[]);
#endif // __CG1_H #endif // __CG1_H

View File

@ -3,14 +3,16 @@
#include <mask.h> #include <mask.h>
#include <printapp.h> #include <printapp.h>
#include <scanner.h> // #include <scanner.h>
#include <relation.h> #include <relation.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <lffiles.h>
#include <sort.h> #include <sort.h>
#include <pconti.h> #include <mailbox.h>
#include <execp.h>
#include <lffiles.h>
#include <pconti.h>
#include "cg1.h" #include "cg1.h"
#include "cg1100.h" #include "cg1100.h"
@ -25,7 +27,7 @@ enum stampe {
senza_IV_direttiva=3, senza_IV_direttiva=3,
con_ana_bil=4, con_ana_bil=4,
senza_ana_bil=5 senza_ana_bil=5
}; };
class CG1100_application : public TPrintapp class CG1100_application : public TPrintapp
{ {
@ -33,9 +35,9 @@ class CG1100_application : public TPrintapp
TTable _tab_anabil ; // tabella codici analisi di bilancio TTable _tab_anabil ; // tabella codici analisi di bilancio
TRectype* _rec; TRectype* _rec;
TSort* _sort; TSort* _sort;
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
stampe _tipo_stampa; stampe _tipo_stampa;
bool _salto_pag; bool _salto_pag;
int _pcont_reclen; int _pcont_reclen;
int _cur_c1, _cur_c2, _cur_c3, _cur_c4; int _cur_c1, _cur_c2, _cur_c3, _cur_c4;
@ -63,31 +65,35 @@ public:
void set_senza_ana (); void set_senza_ana ();
const char * decodifica_codanabil (const char * ); const char * decodifica_codanabil (const char * );
const char * decodifica_IV_sez (const char * ); // const char * decodifica_IV_sez (const char * );
const char * decodifica_IV_dir (const char * , const char * , const char * , int); const char * decodifica_IV_dir (const char * sezivd,
const char * lettivd = "",
const char * numrivd = "",
int numivd = 0);
void process_link(int id, const char* txt);
CG1100_application() : _tab (TAB_IVD), _tab_anabil (TAB_ANABIL) {} CG1100_application() : _tab (TAB_IVD), _tab_anabil (TAB_ANABIL) {}
}; };
void CG1100_application::process_link(int id, const char* txt)
{
TString ss = "1|"; ss << txt;
TMessage fs(cmd2name("cg0","0"), MSG_LN, ss);
TMailbox m;
m.send(fs);
TExternal_app cg0("cg -0");
if (cg0.run()) beep();
}
print_action CG1100_application::postprocess_page(int file,int counter) print_action CG1100_application::postprocess_page(int file,int counter)
{ {
switch (_tipo_stampa) switch (_tipo_stampa)
{ {
case completa: case completa:
break;
case con_IV_direttiva:
const char * buf;
if ( (buf = _sort->retrieve()) != NULL)
{
(*_rec) = buf;
return REPEAT_PAGE;
}
break;
case senza_IV_direttiva: case senza_IV_direttiva:
case senza_ana_bil:
break; break;
case con_IV_direttiva:
case con_ana_bil: case con_ana_bil:
{ {
const char * buf; const char * buf;
@ -97,11 +103,7 @@ print_action CG1100_application::postprocess_page(int file,int counter)
return REPEAT_PAGE; return REPEAT_PAGE;
} }
break; break;
} }
case senza_ana_bil:
break;
default: default:
break; break;
@ -113,21 +115,20 @@ void CG1100_application::set_page(int file,int counter)
{ {
switch (_tipo_stampa) switch (_tipo_stampa)
{ {
case completa: case completa:
set_completa(); set_completa();
break; break;
case con_IV_direttiva: case con_IV_direttiva:
break; case con_ana_bil:
case senza_IV_direttiva: break;
set_senza_IV(); case senza_IV_direttiva:
break; set_senza_IV();
case con_ana_bil: break;
break; case senza_ana_bil:
case senza_ana_bil: set_senza_ana ();
set_senza_ana (); break;
break; default:
default: break;
break;
} }
} }
@ -140,75 +141,75 @@ void CG1100_application::scegli_cur()
switch (_tipo_stampa) switch (_tipo_stampa)
{ {
case completa: case completa:
select_cursor (_cur_c1); select_cursor (_cur_c1);
break; break;
case con_IV_direttiva: case con_IV_direttiva:
{
TRecfield sezivd (*_rec, PCN_SEZIVD);
TRecfield lettivd (*_rec, PCN_LETTIVD);
TRecfield numrivd (*_rec, PCN_NUMRIVD);
TRecfield numivd (*_rec, PCN_NUMIVD);
_sort->addsortkey (sezivd);
_sort->addsortkey (lettivd);
_sort->addsortkey (numrivd);
_sort->addsortkey (numivd);
_sort->init();
select_cursor (_cur_c1);
TCursor * cursor = current_cursor();
long last = cursor->items();
for ( *cursor = 0; cursor->pos() < last; ++(*cursor) )
{ {
TRecfield sezivd (*_rec, PCN_SEZIVD); c1 = cursor->curr(LF_PCON).get(PCN_SEZIVD);
TRecfield lettivd (*_rec, PCN_LETTIVD); if ( c1.trim().not_empty() )
TRecfield numrivd (*_rec, PCN_NUMRIVD); _sort->sort (cursor->curr(LF_PCON).string());
TRecfield numivd (*_rec, PCN_NUMIVD);
_sort->addsortkey (sezivd);
_sort->addsortkey (lettivd);
_sort->addsortkey (numrivd);
_sort->addsortkey (numivd);
_sort->init();
select_cursor (_cur_c1);
TCursor * cursor = current_cursor();
long last = cursor->items();
for ( *cursor = 0; cursor->pos() < last; ++(*cursor) )
{
c1 = cursor->curr(LF_PCON).get(PCN_SEZIVD);
if ( c1.trim().not_empty() )
_sort->sort (cursor->curr(LF_PCON).string());
}
_sort->endsort();
select_cursor (_cur_c2);
break;
} }
case senza_IV_direttiva: _sort->endsort();
select_cursor (_cur_c3);
break;
case con_ana_bil: select_cursor (_cur_c2);
break;
}
case senza_IV_direttiva:
select_cursor (_cur_c3);
break;
case con_ana_bil:
{
TRecfield codcbl (*_rec, PCN_CODCBL);
_sort->addsortkey (codcbl);
_sort->init();
select_cursor (_cur_c1);
TCursor * cursor = current_cursor();
long last = cursor->items();
for ( *cursor = 0; cursor->pos() < last; ++(*cursor) )
{ {
TRecfield codcbl (*_rec, PCN_CODCBL); c1 = cursor->curr(LF_PCON).get(PCN_CODCBL);
if ( c1.trim().not_empty() )
_sort->addsortkey (codcbl); _sort->sort (cursor->curr(LF_PCON).string());
_sort->init();
select_cursor (_cur_c1);
TCursor * cursor = current_cursor();
long last = cursor->items();
for ( *cursor = 0; cursor->pos() < last; ++(*cursor) )
{
c1 = cursor->curr(LF_PCON).get(PCN_CODCBL);
if ( c1.trim().not_empty() )
_sort->sort (cursor->curr(LF_PCON).string());
}
_sort->endsort();
select_cursor (_cur_c2);
break;
} }
case senza_ana_bil:
select_cursor (_cur_c4); _sort->endsort();
break; select_cursor (_cur_c2);
default: break;
break; }
case senza_ana_bil:
select_cursor (_cur_c4);
break;
default:
break;
} }
} }
@ -221,43 +222,36 @@ bool CG1100_application::preprocess_print (int file,int counter)
switch (_tipo_stampa) switch (_tipo_stampa)
{ {
case con_IV_direttiva: case con_IV_direttiva:
if ((buf = _sort->retrieve()) != NULL) case con_ana_bil:
{ if ((buf = _sort->retrieve()) != NULL)
(*_rec) = buf; {
return TRUE; (*_rec) = buf;
} return TRUE;
else }
return FALSE; else
case con_ana_bil: return FALSE;
if ((buf = _sort->retrieve()) != NULL) default:
{ break;
(*_rec) = buf;
return TRUE;
}
else
return FALSE;
default:
break;
} }
return TRUE; return TRUE;
} }
void CG1100_application::set_con_IV() void CG1100_application::set_con_IV()
{ {
// campi della classe // campi della classe
TString c1, c2, c3; TString c1, c2, c3;
int c4; int c4;
TString descr_IV_sez, descr_IV_dir; TString descr_IV_sez, descr_IV_dir;
// campi della classe di segno opposto // campi della classe di segno opposto
TString o1, o2,o3; TString o1, o2,o3;
int o4; int o4;
// Descrizioni // Descrizioni
TString d1; TString d1;
// gruppo, conto e sottoconto // gruppo, conto e sottoconto
int g,c,s; int g,c,s;
c1 = _rec->get(PCN_SEZIVD); c1 = _rec->get(PCN_SEZIVD);
@ -265,7 +259,7 @@ void CG1100_application::set_con_IV()
c3 = _rec->get(PCN_NUMRIVD); c3 = _rec->get(PCN_NUMRIVD);
c4 = _rec->get_int(PCN_NUMIVD); c4 = _rec->get_int(PCN_NUMIVD);
descr_IV_sez = decodifica_IV_sez (c1); descr_IV_sez = decodifica_IV_dir (c1);
descr_IV_dir = decodifica_IV_dir (c1, c2, c3, c4); descr_IV_dir = decodifica_IV_dir (c1, c2, c3, c4);
o1 = _rec->get (PCN_SEZIVDOPP); o1 = _rec->get (PCN_SEZIVDOPP);
@ -290,9 +284,9 @@ void CG1100_application::set_con_IV()
set_row (2, "@18g%40s", (const char *) descr_IV_dir); set_row (2, "@18g%40s", (const char *) descr_IV_dir);
set_row (2, "@60g%03d.", (const char *) g); set_row (2, "@60g$[r]%03d$[n].", (const char *) g);
set_row (2, "@64g%03d.", (const char *) c); set_row (2, "@64g$[r]%03d$[n].", (const char *) c);
set_row (2, "@68g%06d", (const char *) s); set_row (2, "@68g$[r]%06d$[n]", (const char *) s);
set_row (2, "@78g%2d", (const char *) c4); set_row (2, "@78g%2d", (const char *) c4);
@ -304,9 +298,9 @@ void CG1100_application::set_senza_IV()
reset_row (1); reset_row (1);
set_row (1, "@1g@pn", FLD(lnum,PCN_GRUPPO, "@@@.") ); set_row (1, "@1g$[r]@pn$[n]", FLD(lnum,PCN_GRUPPO, "@@@.") );
set_row (1, "@5g@pn", FLD(lnum,PCN_CONTO, "@@@.") ); set_row (1, "@5g$[r]@pn$[n]", FLD(lnum,PCN_CONTO, "@@@.") );
set_row (1, "@9g@pn", FLD(lnum, PCN_SOTTOCONTO, "@@@@@@") ); set_row (1, "@9g$[r]@pn$[n]", FLD(lnum, PCN_SOTTOCONTO, "@@@@@@") );
set_row (1, "@16g@50s", FLD(lnum,PCN_DESCR) ); set_row (1, "@16g@50s", FLD(lnum,PCN_DESCR) );
@ -321,17 +315,17 @@ void CG1100_application::set_senza_IV()
set_row (1, "@107g@f", FLD(lnum, PCN_COMPENS) ); set_row (1, "@107g@f", FLD(lnum, PCN_COMPENS) );
set_row (1, "@114g@1n", FLD(lnum, PCN_TIPOSPRIC) ); set_row (1, "@114g@1n", FLD(lnum, PCN_TIPOSPRIC) );
set_row (1, "@120g@1s", FLD(lnum, PCN_SEZSALDI) ); set_row (1, "@120g@1s", FLD(lnum, PCN_SEZSALDI) );
// set_row (1, "@118g@f", FLD(lnum, PCN_STSOTTAB)); // set_row (1, "@118g@f", FLD(lnum, PCN_STSOTTAB));
} }
void CG1100_application::set_con_ana() void CG1100_application::set_con_ana()
{ {
TString CodTabAnabil, DescrCodTabAnabil(30); TString CodTabAnabil, DescrCodTabAnabil(30);
// Descrizioni // Descrizioni
TString d1; TString d1;
const char * d; const char * d;
// gruppo, conto e sottoconto // gruppo, conto e sottoconto
int g,c; int g,c;
long s; long s;
char tmcf; char tmcf;
@ -352,12 +346,11 @@ void CG1100_application::set_con_ana()
CodTabAnabil = _rec->get(PCN_CODCBL); CodTabAnabil = _rec->get(PCN_CODCBL);
set_row (1, "%-10s", (const char *)CodTabAnabil); set_row (1, "%-10s", (const char *)CodTabAnabil);
// DescrCodTabAnabil = decodifica_codanabil(CodTabAnabil);
set_row (1, "@15g%-10s", (const char *)DescrCodTabAnabil); set_row (1, "@15g%-10s", (const char *)DescrCodTabAnabil);
set_row (1, "@61g%03d.", g ); set_row (1, "@61g$[r]%03d$[n].", g );
set_row (1, "%03d.", c ); set_row (1, "$[r]%03d$[n].", c );
set_row (1, "%06ld", s ); set_row (1, "$[r]%06ld$[n]", s );
int r=1; int r=1;
while ((d = desc_conto.get()) != NULL) while ((d = desc_conto.get()) != NULL)
@ -374,9 +367,9 @@ void CG1100_application::set_senza_ana()
reset_row (1); reset_row (1);
set_row (1, "@1g@pn", FLD(lnum,PCN_GRUPPO, "@@@.") ); set_row (1, "@1g$[r]@pn$[n]", FLD(lnum,PCN_GRUPPO, "@@@.") );
set_row (1, "@5g@pn", FLD(lnum,PCN_CONTO, "@@@.") ); set_row (1, "@5$[r]g@pn$[n]", FLD(lnum,PCN_CONTO, "@@@.") );
set_row (1, "@9g@pn", FLD(lnum, PCN_SOTTOCONTO, "@@@@@@") ); set_row (1, "@9$[r]g@pn$[n]", FLD(lnum, PCN_SOTTOCONTO, "@@@@@@") );
set_row (1, "@16g@50s", FLD(lnum,PCN_DESCR) ); set_row (1, "@16g@50s", FLD(lnum,PCN_DESCR) );
@ -391,7 +384,6 @@ void CG1100_application::set_senza_ana()
set_row (1, "@107g@f", FLD(lnum, PCN_COMPENS) ); set_row (1, "@107g@f", FLD(lnum, PCN_COMPENS) );
set_row (1, "@114g@1n", FLD(lnum, PCN_TIPOSPRIC) ); set_row (1, "@114g@1n", FLD(lnum, PCN_TIPOSPRIC) );
set_row (1, "@120g@1s", FLD(lnum, PCN_SEZSALDI) ); set_row (1, "@120g@1s", FLD(lnum, PCN_SEZSALDI) );
// set_row (1, "@118g@f", FLD(lnum, PCN_STSOTTAB));
} }
@ -401,9 +393,9 @@ void CG1100_application::set_completa()
reset_row (1); reset_row (1);
set_row (1, "@1g@pn", FLD(lnum,PCN_GRUPPO, "@@@.") ); set_row (1, "@1g$[r]@pn$[n]", FLD(lnum,PCN_GRUPPO, "@@@.") );
set_row (1, "@5g@pn", FLD(lnum,PCN_CONTO, "@@@.") ); set_row (1, "@5g$[r]@pn$[n]", FLD(lnum,PCN_CONTO, "@@@.") );
set_row (1, "@9g@pn", FLD(lnum, PCN_SOTTOCONTO, "@@@@@@") ); set_row (1, "@9g$[r]@pn", FLD(lnum, PCN_SOTTOCONTO, "@@@@@@") );
set_row (1, "@16g@50s", FLD(lnum,PCN_DESCR) ); set_row (1, "@16g@50s", FLD(lnum,PCN_DESCR) );
@ -418,7 +410,6 @@ void CG1100_application::set_completa()
set_row (1, "@107g@f", FLD(lnum, PCN_COMPENS) ); set_row (1, "@107g@f", FLD(lnum, PCN_COMPENS) );
set_row (1, "@114g@1n", FLD(lnum, PCN_TIPOSPRIC) ); set_row (1, "@114g@1n", FLD(lnum, PCN_TIPOSPRIC) );
set_row (1, "@120g@1s", FLD(lnum, PCN_SEZSALDI) ); set_row (1, "@120g@1s", FLD(lnum, PCN_SEZSALDI) );
// set_row (1, "@118g@f", FLD(lnum, PCN_STSOTTAB));
} }
bool CG1100_application::elabora_riga() bool CG1100_application::elabora_riga()
@ -426,62 +417,46 @@ bool CG1100_application::elabora_riga()
static int old_gruppo = 0; static int old_gruppo = 0;
int new_gruppo = 0, new_conto = 0; int new_gruppo = 0, new_conto = 0;
long new_sottoc = 0l; long new_sottoc = 0l;
TRectype& curr_rec = *_rec;
switch (_tipo_stampa) switch (_tipo_stampa)
{ {
case completa: case completa:
case senza_ana_bil: case senza_ana_bil:
case senza_IV_direttiva: case senza_IV_direttiva:
curr_rec = current_cursor()->curr(LF_PCON); break;
case con_ana_bil:
case con_IV_direttiva:
curr_rec = *_rec; break;
default:
break;
}
new_gruppo = curr_rec.get_int(PCN_GRUPPO);
new_conto = curr_rec.get_int(PCN_CONTO);
new_sottoc = curr_rec.get_long(PCN_SOTTOCONTO);
if (new_gruppo != 0 && new_conto != 0)
{ {
TRectype curr_rec = current_cursor()->curr(LF_PCON); // se e' un sottoconto stampo sotttab in 127
new_gruppo = curr_rec.get_int(PCN_GRUPPO); if (new_sottoc != 0)
new_conto = curr_rec.get_int(PCN_CONTO);
new_sottoc = curr_rec.get_long(PCN_SOTTOCONTO);
// se e' un sottoconto stampo sotttab in 127
if ((new_gruppo != 0) && (new_conto != 0) && (new_sottoc != 0))
{ {
set_row (1, "@127g@f", FLD(LF_PCON, PCN_STSOTTAB)); set_row (1, "@127g@f", FLD(LF_PCON, PCN_STSOTTAB));
set_row (1, "@124g "); set_row (1, "@124g ");
} }
else else
// se e' un conto stampo sotttab in 124 // se e' un conto stampo sotttab in 124
if ((new_gruppo != 0) && (new_conto != 0) && (new_sottoc == 0))
{
set_row (1, "@124g@f", FLD(LF_PCON, PCN_STSOTTAB));
set_row (1, "@127g ");
}
break;
}
case con_ana_bil:
case con_IV_direttiva:
new_gruppo = _rec->get_int(PCN_GRUPPO);
new_conto = _rec->get_int(PCN_CONTO);
new_sottoc = _rec->get_long(PCN_SOTTOCONTO);
// se e' un sottoconto stampo sotttab in 127
if ((new_gruppo != 0) && (new_conto != 0) && (new_sottoc != 0))
{ {
set_row (1, "@127g%c", (char)_rec->get_bool(PCN_STSOTTAB)); set_row (1, "@124g@f", FLD(LF_PCON, PCN_STSOTTAB));
set_row (1, "@124g "); set_row (1, "@127g ");
} }
else
// se e' un conto stampo sotttab in 124
if ((new_gruppo != 0) && (new_conto != 0) && (new_sottoc == 0))
{
set_row (1, "@124g%c", (char)_rec->get_bool(PCN_STSOTTAB));
set_row (1, "@127g ");
}
break;
default:
break;
} }
// Gestione salto pagina
// Gestione salto pagina if (_salto_pag && new_gruppo != old_gruppo)
if (old_gruppo == 0) old_gruppo = new_gruppo;
if (new_gruppo != old_gruppo)
{ {
const bool salta = old_gruppo > 0;
old_gruppo = new_gruppo; old_gruppo = new_gruppo;
if (_salto_pag) return TRUE; return salta;
} }
return FALSE; return FALSE;
} }
@ -490,9 +465,6 @@ bool CG1100_application::preprocess_page(int file,int counter)
{ {
if (elabora_riga()) if (elabora_riga())
printer().formfeed(); printer().formfeed();
// set_auto_ff(TRUE);
// else
// set_auto_ff(FALSE);
if (_tipo_stampa == con_IV_direttiva) set_con_IV(); if (_tipo_stampa == con_IV_direttiva) set_con_IV();
if (_tipo_stampa == con_ana_bil) set_con_ana(); if (_tipo_stampa == con_ana_bil) set_con_ana();
@ -501,7 +473,7 @@ bool CG1100_application::preprocess_page(int file,int counter)
bool CG1100_application::set_print(int) bool CG1100_application::set_print(int)
{ {
KEY tasto; KEY tasto;
tasto = _msk->run(); tasto = _msk->run();
@ -512,6 +484,7 @@ bool CG1100_application::set_print(int)
intesta (_tipo_stampa); intesta (_tipo_stampa);
scegli_cur(); scegli_cur();
enable_link("Collegamento Piano dei conti : ", 'r');
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -519,13 +492,11 @@ bool CG1100_application::set_print(int)
void CG1100_application::intesta (stampe tipo) void CG1100_application::intesta (stampe tipo)
{ {
int soh; // riga d'inizio dell'intestazione int soh = 1; // riga d'inizio dell'intestazione
TString sep(132); TString sep(132);
reset_header (); reset_header ();
soh=1;
sep << "Ditta : " << get_firm(); sep << "Ditta : " << get_firm();
sep.left_just(132); sep.left_just(132);
@ -565,7 +536,7 @@ void CG1100_application::intesta (stampe tipo)
set_header (soh++, "Codice @61gCodici Piano@113gDett.alleg.Bilancio"); set_header (soh++, "Codice @61gCodici Piano@113gDett.alleg.Bilancio");
set_header (soh++, "Tabella@16gDescrizione@60gdei Conti @78gDescrizione @113gSot.con. * Moviment."); set_header (soh++, "Tabella@16gDescrizione@60gdei Conti @78gDescrizione @113gSot.con. * Moviment.");
break; break;
case senza_ana_bil: case senza_ana_bil:
set_header (soh++, "Conto @67gSez. Classe@85gTipo@96gDettaglio@112gSpesa @123gDet.bil."); set_header (soh++, "Conto @67gSez. Classe@85gTipo@96gDettaglio@112gSpesa @123gDet.bil.");
@ -587,7 +558,10 @@ const char * CG1100_application::decodifica_IV_dir (const char * sezivd, const c
TString dep (CODTABLEN); TString dep (CODTABLEN);
_tab.curr().zero(); _tab.curr().zero();
dep << format ("%1s%1s%8s%02d", sezivd, lettivd, numrivd, numivd); if (numrivd != 0)
dep.format("%1s%1s%8s%02d", sezivd, lettivd, numrivd, numivd);
else
dep.format("%1s%1s%8s", sezivd, lettivd, numrivd);
_tab.curr().put("CODTAB", (const char*)dep); _tab.curr().put("CODTAB", (const char*)dep);
_tab.read(); _tab.read();
@ -597,8 +571,8 @@ const char * CG1100_application::decodifica_IV_dir (const char * sezivd, const c
const char * CG1100_application::decodifica_codanabil (const char * codpcab) const char * CG1100_application::decodifica_codanabil (const char * codpcab)
{ {
// TString dep (CODTABLEN); // TString dep (CODTABLEN);
// non sara' un tabella ma un file // non sara' un tabella ma un file
_tab_anabil.curr().zero(); _tab_anabil.curr().zero();
_tab_anabil.curr().put("CODTAB", (const char*) codpcab); _tab_anabil.curr().put("CODTAB", (const char*) codpcab);
@ -607,20 +581,20 @@ const char * CG1100_application::decodifica_codanabil (const char * codpcab)
return _tab_anabil.curr().get ("S0"); return _tab_anabil.curr().get ("S0");
} }
const char * CG1100_application::decodifica_IV_sez (const char * sezivd) //const char * CG1100_application::decodifica_IV_sez (const char * sezivd)
{ //{
TString dep (CODTABLEN); // TString dep (CODTABLEN);
TString dep2(CODTABLEN); // TString dep2(CODTABLEN);
_tab.zero(); // _tab.zero();
dep << format ("%1s", sezivd); // dep << format ("%1s", sezivd);
_tab.put("CODTAB", dep); // _tab.put("CODTAB", dep);
_tab.read(); // _tab.read();
dep2 = _tab.get("CODTAB"); // dep2 = _tab.get("CODTAB");
if (dep != dep2) // if (dep != dep2)
_tab.zero(); // _tab.zero();
return _tab.get ("S0"); // return _tab.get ("S0");
} //}
void CG1100_application::user_create() void CG1100_application::user_create()
{ {

View File

@ -2,7 +2,12 @@
#include <mask.h> #include <mask.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <mailbox.h>
#include <execp.h>
#include <clifo.h>
#include <saldi.h>
#include <comuni.h>
#include "cg1200a.h" #include "cg1200a.h"
#include "cg1200b.h" #include "cg1200b.h"
@ -47,21 +52,23 @@ public:
TRectype& look_com(TString& cod); TRectype& look_com(TString& cod);
const char* look_tab(const char* tabname, TString& cod, const char* look_tab(const char* tabname, TString& cod,
const char* fld = "S0"); const char* fld = "S0");
const char* get_field(int ln, const char* fn) const char* get_field(int ln, const char* fn)
{ return current_cursor()->curr(ln).get(fn); } { return current_cursor()->curr(ln).get(fn); }
void set_rows(); void set_rows();
void set_elenco(); void set_elenco();
void set_rubriche(); void set_rubriche();
void set_etichette(); void set_etichette();
void process_link(int id, const char* txt);
CG1200_App() : TPrintapp(), _piva(30), _telefono(50), CG1200_App() : TPrintapp(), _piva(30), _telefono(50),
_name(60) _name(60)
{ {
_rel = NULL; _pr_type = undefined; _startrow = 2; _startcol = 3; _rel = NULL; _pr_type = undefined; _startrow = 2; _startcol = 3;
_rows_et = 9; _cols_et = 40; _rows_et = 9; _cols_et = 40;
} }
}; };
@ -70,6 +77,27 @@ public:
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
void CG1200_App::process_link(int id, const char* txt)
{
TString ss = "1|";
switch (_pr_what)
{
case clienti :
ss << "C|"; break;
case fornitori :
ss << "F|"; break;
case both :
default :
break;
}
ss << txt;
TMessage fs(cmd2name("cg0","1"), MSG_LN, ss);
TMailbox m;
m.send(fs);
TExternal_app cg0("cg -1");
if (cg0.run()) beep();
}
TRectype& CG1200_App::look_com(TString& cod) TRectype& CG1200_App::look_com(TString& cod)
{ {
_comuni->curr().zero(); _comuni->curr().zero();
@ -81,7 +109,7 @@ TRectype& CG1200_App::look_com(TString& cod)
} }
const char* CG1200_App::look_tab(const char* tabname, TString& cod, const char* CG1200_App::look_tab(const char* tabname, TString& cod,
const char* fld) const char* fld)
{ {
TTable tab(tabname); TTable tab(tabname);
tab.curr().zero(); tab.curr().zero();
@ -94,35 +122,35 @@ const char* CG1200_App::look_tab(const char* tabname, TString& cod,
bool CG1200_App::preprocess_page(int counter) bool CG1200_App::preprocess_page(int counter)
{ {
if (_mov_only) if (_mov_only)
{ {
// se non movimentato // se non movimentato
_saldi->curr().zero(); _saldi->curr().zero();
_saldi->curr().put("GRUPPO",get_field(LF_CLIFO,"GRUPPO")); _saldi->curr().put(SLD_GRUPPO,get_field(LF_CLIFO,CLI_GRUPPO));
_saldi->curr().put("CONTO",get_field(LF_CLIFO,"CONTO")); _saldi->curr().put(SLD_CONTO,get_field(LF_CLIFO, CLI_CONTO));
_saldi->curr().put("SOTTOCONTO",get_field(LF_CLIFO,"CODCF")); _saldi->curr().put(SLD_SOTTOCONTO,get_field(LF_CLIFO,CLI_CODCF));
_saldi->read(); _saldi->read();
if (_saldi->curr().get("GRUPPO") == get_field(LF_CLIFO,"GRUPPO") && if (_saldi->curr().get(SLD_GRUPPO) == get_field(LF_CLIFO, CLI_GRUPPO) &&
_saldi->curr().get("CONTO") == get_field(LF_CLIFO,"CONTO") && _saldi->curr().get(SLD_CONTO) == get_field(LF_CLIFO,CLI_CONTO) &&
_saldi->curr().get("SOTTOCONTO") == get_field(LF_CLIFO,"CODCF")) _saldi->curr().get(SLD_SOTTOCONTO) == get_field(LF_CLIFO,CLI_CODCF))
// OSTIA! e' MOVIMENTATO! // OSTIA! e' MOVIMENTATO!
return FALSE; return FALSE;
} }
// set variable fields // set variable fields
_piva = get_field(LF_CLIFO,"COFI"); _piva = get_field(LF_CLIFO, CLI_COFI);
if (_piva.empty()) _piva = get_field(LF_CLIFO,"PAIV"); if (_piva.empty()) _piva = get_field(LF_CLIFO, CLI_PAIV);
_telefono = get_field(LF_CLIFO,"PTEL"); _telefono = get_field(LF_CLIFO, CLI_PTEL);
if (!_telefono.empty()) _telefono << "/"; if (!_telefono.empty()) _telefono << "/";
_telefono << get_field(LF_CLIFO,"TEL"); _telefono << get_field(LF_CLIFO, CLI_TEL);
_name = get_field(LF_CLIFO,"RAGSOC"); _name = get_field(LF_CLIFO, CLI_RAGSOC);
if (strcmp(get_field(LF_CLIFO,"TIPOAPER"),"F") == 0) if (strcmp(get_field(LF_CLIFO, CLI_TIPOAPER),"F") == 0)
{ {
TString surname = _name.mid(30,50); surname.trim(); TString surname = _name.mid(30,50); surname.trim();
_name = _name.mid(0,30); _name.trim(); _name = _name.mid(0,30); _name.trim();
_name << " " << surname; _name << " " << surname;
} }
return TRUE; return TRUE;
} }
@ -131,29 +159,29 @@ print_action CG1200_App::postprocess_print(int counter)
{ {
static bool more = FALSE; static bool more = FALSE;
if (_pr_what == both) if (_pr_what == both)
{
if (more)
{ {
if (more) more = FALSE;
{ select_cursor(ccli());
more = FALSE; return NEXT_PAGE;
select_cursor(ccli());
return NEXT_PAGE;
}
else
{
more = TRUE;
select_cursor(cfor());
return REPEAT_PAGE;
}
} }
else
{
more = TRUE;
select_cursor(cfor());
return REPEAT_PAGE;
}
}
return NEXT_PAGE; return NEXT_PAGE;
} }
bool mask_ctrl_handler(TMask_field& mf, KEY k) bool mask_ctrl_handler(TMask_field& mf, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
{ {
mf.mask().stop_run(mf.dlg()); mf.mask().stop_run(mf.dlg());
} }
return TRUE; return TRUE;
} }
@ -162,19 +190,19 @@ bool mask_ctrl_handler(TMask_field& mf, KEY k)
void CG1200_App::set_rows() void CG1200_App::set_rows()
{ {
switch(_pr_type) switch(_pr_type)
{ {
case elenco: case elenco:
set_elenco(); set_elenco();
break; break;
case rubriche: case rubriche:
set_rubriche(); set_rubriche();
break; break;
case etichette: case etichette:
set_etichette(); set_etichette();
break; break;
default: default:
break; break;
} }
} }
void CG1200_App::set_elenco() void CG1200_App::set_elenco()
@ -184,28 +212,28 @@ void CG1200_App::set_elenco()
// intestazione // intestazione
set_header(1, "Ditta /*TBI*/@82gStudio /*TBI*/@102gData @<@125gPag @#"); set_header(1, "Ditta /*TBI*/@82gStudio /*TBI*/@102gData @<@125gPag @#");
set_header(2, "Elenco %s",(_pr_what == both ? "Clienti+Fornitori" : set_header(2, "Elenco %s",(_pr_what == both ? "Clienti+Fornitori" :
(_pr_what == clienti ? "Clienti" : "Fornitori"))); (_pr_what == clienti ? "Clienti" : "Fornitori")));
set_header(3, (const char *)(TString(132).fill('-'))); set_header(3, (const char *)(TString(132).fill('-')));
set_header(4, "Codice Ragione sociale@55gIndirizzo@91gC.a.p.Localita'" set_header(4, "Codice Ragione sociale@55gIndirizzo@91gC.a.p.Localita'"
"@117gPr Telefono"); "@117gPr Telefono");
set_header(5,"@8gLuogo di nascita@29gData@40gProv. Nazione " set_header(5,"@8gLuogo di nascita@29gData@40gProv. Nazione "
"Partita IVA Codice fiscale@91gConto di costo/ricavo"); "Partita IVA Codice fiscale@91gConto di costo/ricavo");
set_header(6,"@55gCodice per allegato@90gPercipiente 770"); set_header(6,"@55gCodice per allegato@90gPercipiente 770");
set_header(7, (const char *)(TString(132).fill('-'))); set_header(7, (const char *)(TString(132).fill('-')));
// body // body
set_row(1,"@pn #s@55g@s@91g@s @s@117g@s #s", set_row(1,"$[r]@pn$[n} #s@55g@s@91g@s @s@117g@s #s",
FLD(LF_CLIFO, "CODCF","@@@@@@"), FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"),
(const char*)_name, (const char*)_name,
FLD(LF_CLIFO, "INDCF"), FLD(LF_CLIFO, CLI_INDCF),
FLD(LF_CLIFO, "CAPCF"), FLD(LF_CLIFO, CLI_CAPCF),
FLD(LF_COMUNI,"DENCOM"), FLD(LF_COMUNI,COM_DENCOM),
FLD(LF_COMUNI,"PROVCOM"), FLD(LF_COMUNI,COM_PROVCOM),
(const char*)_telefono); (const char*)_telefono);
set_row(2,"@54g#s@90g@2n @2n @pn", set_row(2,"@54g#s@90g@2n @2n @pn",
(const char *)_piva, (const char *)_piva,
FLD(LF_CLIFO,"GRUPPORIC"), FLD(LF_CLIFO,CLI_GRUPPORIC),
FLD(LF_CLIFO,"CONTORIC"), FLD(LF_CLIFO,CLI_CONTORIC),
FLD(LF_CLIFO,"SOTTOCRIC","@@@@@@")); FLD(LF_CLIFO, CLI_SOTTOCRIC,"@@@@@@"));
for(int i = 0; i < _interline; i++) for(int i = 0; i < _interline; i++)
set_row(i+3,""); set_row(i+3,"");
@ -218,32 +246,32 @@ void CG1200_App::set_rubriche()
// intestazione // intestazione
set_header(1, "Ditta /*TBI*/@82gStudio /*TBI*/@102gData @<@125gPag @#"); set_header(1, "Ditta /*TBI*/@82gStudio /*TBI*/@102gData @<@125gPag @#");
set_header(2, "Rubrica %s",(_pr_what == both ? "Clienti+Fornitori" : set_header(2, "Rubrica %s",(_pr_what == both ? "Clienti+Fornitori" :
(_pr_what == clienti ? "Clienti" : "Fornitori"))); (_pr_what == clienti ? "Clienti" : "Fornitori")));
set_header(3, (const char *)(TString(132).fill('-'))); set_header(3, (const char *)(TString(132).fill('-')));
set_header(4, "Codice C Ragione sociale@41gIndirizzo@77gCap@83gLocalita'" set_header(4, "Codice C Ragione sociale@41gIndirizzo@77gCap@83gLocalita'"
"@104gPr Partita iva Telefono"); "@104gPr Partita iva Telefono");
set_header(5, (const char *)(TString(132).fill('-'))); set_header(5, (const char *)(TString(132).fill('-')));
// body // body
set_row(1,"@pn #s@55g@s@91g@s @s@117g@s #s", set_row(1,"$[r]@pn$[n] #s@55g@s@91g@s @s@117g@s #s",
FLD(LF_CLIFO,"CODCF","@@@@@@"), FLD(LF_CLIFO,CLI_CODCF,"@@@@@@"),
(const char *)_name, (const char *)_name,
FLD(LF_CLIFO,"INDCF"), FLD(LF_CLIFO,CLI_INDCF),
FLD(LF_CLIFO,"CAPCF"), FLD(LF_CLIFO, CLI_CAPCF),
FLD(LF_COMUNI,"DENCOM"), FLD(LF_COMUNI, COM_DENCOM),
FLD(LF_COMUNI,"PROVCOM"), FLD(LF_COMUNI, COM_PROVCOM),
(const char*)_telefono); (const char*)_telefono);
} }
bool mask2_reset_fields(TMask_field& mf, KEY k) bool mask2_reset_fields(TMask_field& mf, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
{ {
CG1200_App* a = (CG1200_App*)MainApp(); CG1200_App* a = (CG1200_App*)MainApp();
mf.mask().field(FLD_CGB_STARTROW).set(format("%d",a->_startrow)); mf.mask().field(FLD_CGB_STARTROW).set(format("%d",a->_startrow));
mf.mask().field(FLD_CGB_STARTCOL).set(format("%d",a->_startcol)); mf.mask().field(FLD_CGB_STARTCOL).set(format("%d",a->_startcol));
mf.mask().field(FLD_CGB_ROWSET).set(format("%d",a->_rows_et)); mf.mask().field(FLD_CGB_ROWSET).set(format("%d",a->_rows_et));
mf.mask().field(FLD_CGB_COLSET).set(format("%d",a->_cols_et)); mf.mask().field(FLD_CGB_COLSET).set(format("%d",a->_cols_et));
} }
return TRUE; return TRUE;
} }
@ -276,14 +304,14 @@ void CG1200_App::set_etichette()
set_row(i,""); set_row(i,"");
set_row(_startrow, format("@%dg#%ds",_startcol, _cols_et - _startcol), set_row(_startrow, format("@%dg#%ds",_startcol, _cols_et - _startcol),
(const char*)_name); (const char*)_name);
set_row(_startrow+1, format("@%dg@%ds",_startcol, _cols_et - _startcol), set_row(_startrow+1, format("@%dg@%ds",_startcol, _cols_et - _startcol),
FLD(LF_CLIFO,"INDCF")); FLD(LF_CLIFO, CLI_INDCF));
set_row(_startrow+2, format("@%dg@5s @%ds @2s",_startcol, set_row(_startrow+2, format("@%dg@5s @%ds @2s",_startcol,
_cols_et - _startcol - 9), _cols_et - _startcol - 9),
FLD(LF_CLIFO,"CAPCF"), FLD(LF_CLIFO, CLI_CAPCF),
FLD(LF_COMUNI,"DENCOM"), FLD(LF_COMUNI, COM_DENCOM),
FLD(LF_COMUNI,"PROVCOM")); FLD(LF_COMUNI, COM_PROVCOM));
for (i = _startrow+3; i <= _rows_et; i++) for (i = _startrow+3; i <= _rows_et; i++)
set_row(i,""); set_row(i,"");
@ -299,23 +327,25 @@ bool CG1200_App::set_print(int)
// set print type // set print type
switch (mask.last_key()) switch (mask.last_key())
{ {
case K_ESC: case K_ESC:
return FALSE; return FALSE;
break; break;
case BUT_CG12_ELENCO: case BUT_CG12_ELENCO:
_pr_type = elenco; _pr_type = elenco;
break; break;
case BUT_CG12_ETICHETTE: case BUT_CG12_ETICHETTE:
_pr_type = etichette; _pr_type = etichette;
break; break;
case BUT_CG12_RUBRICHE: case BUT_CG12_RUBRICHE:
_pr_type = rubriche; _pr_type = rubriche;
break; break;
} }
_sort = atoi(mask.get(RDB_CG12_SORT)); _sort = atoi(mask.get(RDB_CG12_SORT));
_pr_what = (pw)atoi(mask.get(RDB_CG12_TYPE)); _pr_what = (pw)atoi(mask.get(RDB_CG12_TYPE));
if (_pr_what != both && _pr_type != rubriche)
enable_link("Collegamento Archivio clienti e fornitori : ", 'r');
_interline = atoi(mask.get(LST_CG12_INTERLINE)); _interline = atoi(mask.get(LST_CG12_INTERLINE));
_mov_only = mask.get(CHK_CG12_MOVIM) == "X"; _mov_only = mask.get(CHK_CG12_MOVIM) == "X";
@ -327,44 +357,44 @@ bool CG1200_App::set_print(int)
else select_cursor(ccli()); else select_cursor(ccli());
if (_pr_what != both) if (_pr_what != both)
{
// filter
if (_sort == 1)
{ {
// filter cod_from = mask.get(_pr_what == clienti ? FLD_CLI_CODFR
if (_sort == 1) : FLD_FOR_CODFR);
{ cod_to = mask.get(_pr_what == clienti ? FLD_CLI_CODTO
cod_from = mask.get(_pr_what == clienti ? FLD_CLI_CODFR : FLD_FOR_CODTO);
: FLD_FOR_CODFR);
cod_to = mask.get(_pr_what == clienti ? FLD_CLI_CODTO
: FLD_FOR_CODTO);
}
else
{
cod_from = mask.get(_pr_what == clienti ? FLD_CLI_RAGSOCFR
: FLD_FOR_RAGSOCFR);
cod_to = mask.get(_pr_what == clienti ? FLD_CLI_RAGSOCTO
: FLD_FOR_RAGSOCTO);
}
if ((!cod_from.empty() || !cod_to.empty()) && _pr_what != both)
{
fl = current_cursor()->file(LF_CLIFO);
TRectype tr1(fl->curr());
TRectype tr2(fl->curr());
tr1.zero(); tr2.zero();
if (_sort == 1)
{
tr1.put("CODCF",cod_from);
tr2.put("CODCF",cod_to);
tr1.put("TIPOCF", _pr_what == clienti ? "C" : "F");
tr2.put("TIPOCF", _pr_what == clienti ? "C" : "F");
}
else
{
tr1.put("RAGSOC",cod_from);
tr2.put("RAGSOC",cod_to);
}
current_cursor()->setregion(cod_from.empty() ? NULL : &tr1,
cod_to.empty() ? NULL : &tr2);
}
} }
else
{
cod_from = mask.get(_pr_what == clienti ? FLD_CLI_RAGSOCFR
: FLD_FOR_RAGSOCFR);
cod_to = mask.get(_pr_what == clienti ? FLD_CLI_RAGSOCTO
: FLD_FOR_RAGSOCTO);
}
if ((!cod_from.empty() || !cod_to.empty()) && _pr_what != both)
{
fl = current_cursor()->file(LF_CLIFO);
TRectype tr1(fl->curr());
TRectype tr2(fl->curr());
tr1.zero(); tr2.zero();
if (_sort == 1)
{
tr1.put(CLI_CODCF,cod_from);
tr2.put(CLI_CODCF,cod_to);
tr1.put(CLI_TIPOCF, _pr_what == clienti ? "C" : "F");
tr2.put(CLI_TIPOCF, _pr_what == clienti ? "C" : "F");
}
else
{
tr1.put(CLI_RAGSOC,cod_from);
tr2.put(CLI_RAGSOC,cod_to);
}
current_cursor()->setregion(cod_from.empty() ? NULL : &tr1,
cod_to.empty() ? NULL : &tr2);
}
}
// initialize (non dovrebbe servire) // initialize (non dovrebbe servire)
(*current_cursor()) = 0l; (*current_cursor()) = 0l;
@ -384,17 +414,17 @@ bool CG1200_App::preprocess_print(int counter)
void CG1200_App::user_create() void CG1200_App::user_create()
{ {
// set relation and cursors // set relation and cursors
_rel = new TRelation(LF_CLIFO); _rel = new TRelation(LF_CLIFO);
_rel->add(LF_COMUNI, "COM=COMCF"); _rel->add(LF_COMUNI, "COM=COMCF");
_comuni = _rel->lfile(LF_COMUNI); _comuni = _rel->lfile(LF_COMUNI);
_saldi = new TLocalisamfile(LF_SALDI); _saldi->setkey(2); _saldi = new TLocalisamfile(LF_SALDI); _saldi->setkey(2);
_cur_c1 = add_cursor(new TCursor(_rel,"TIPOCF=\"C\"",1)); _cur_c1 = add_cursor(new TCursor(_rel,"TIPOCF=\"C\"",1));
_cur_c2 = add_cursor(new TCursor(_rel,"TIPOCF=\"C\"",2)); _cur_c2 = add_cursor(new TCursor(_rel,"TIPOCF=\"C\"",2));
_cur_f1 = add_cursor(new TCursor(_rel,"TIPOCF=\"F\"",1)); _cur_f1 = add_cursor(new TCursor(_rel,"TIPOCF=\"F\"",1));
_cur_f2 = add_cursor(new TCursor(_rel,"TIPOCF=\"F\"",2)); _cur_f2 = add_cursor(new TCursor(_rel,"TIPOCF=\"F\"",2));
add_file(LF_CLIFO); add_file(LF_CLIFO);
enable_print_menu(); enable_print_menu();
} }
bool CG1200_App::destroy() bool CG1200_App::destroy()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -50,9 +50,9 @@ $(EP)cg0500a.msk : cg0500a.uml
$(O)/cg1.o: cg1.cpp $(I10) $(I24) $(I32) $(O)/cg1.o: cg1.cpp $(I10) $(I24) $(I32)
$(O)/cg1100.o: cg1100.cpp $(I6) $(I10) $(I24) $(I27) $(I33) cg1100.h $(O)/cg1100.o: cg1100.cpp $(I6) $(I10) $(I24) $(I27) $(I33) $(I47) $(I48) cg1100.h $(IP)pconti.h
$(O)/cg1200.o: cg1200.cpp $(I6) $(I10) $(I24) $(I27) $(I33) cg1200a.h $(O)/cg1200.o: cg1200.cpp $(I6) $(I10) $(I24) $(I27) $(I33) $(I47) $(I48) cg1200a.h $(IP)saldi.h $(IP)clifo.h $(IP)comuni.h
$(O)/cg1300.o: cg1200.cpp $(I24) $(I31) $(I33) $(I51) $(O)/cg1300.o: cg1200.cpp $(I24) $(I31) $(I33) $(I51)