From f404830196757bc6ec523813c6a8c02f10bb6a63 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 7 Nov 1994 16:27:02 +0000 Subject: [PATCH] Modifiche per permettere la ripetizione della stampa git-svn-id: svn://10.65.10.50/trunk@555 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg1100.cpp | 91 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/cg/cg1100.cpp b/cg/cg1100.cpp index 6af71f522..f2940d65b 100755 --- a/cg/cg1100.cpp +++ b/cg/cg1100.cpp @@ -92,7 +92,7 @@ public: bool elabora_riga(); // decide se fare salto pagina o no - void scegli_cur(); + void do_sort(); void set_completa (); void set_con_IV (); void set_senza_IV (); @@ -132,17 +132,30 @@ void CG1100_application::process_link(int id, const char* txt) void CG1100_application::init_sort() { - _bil = new bil_ivd; - _sort = new TSort (sizeof(bil_ivd)); - - _sort -> addsortkey ((char*)&(_bil->sez) - (char*)&(_bil->sez),1); - _sort -> addsortkey ((char*)&(_bil->let) - (char*)&(_bil->sez),1); - _sort -> addsortkey ((char*)&(_bil->numr) - (char*)&(_bil->sez),4); - _sort -> addsortkey ((char*)&(_bil->num) - (char*)&(_bil->sez),2); - _sort -> addsortkey ((char*)&(_bil->gruppo) - (char*)&(_bil->sez),3); - _sort -> addsortkey ((char*)&(_bil->conto) - (char*)&(_bil->sez),3); - _sort -> addsortkey ((char*)&(_bil->sottoc) - (char*)&(_bil->sez),6); - _sort->init(); + switch (_tipo_stampa) + { + case con_IV_direttiva: + _sort->reset(sizeof(bil_ivd)); + + _sort -> addsortkey ((char*)&(_bil->sez) - (char*)&(_bil->sez),1); + _sort -> addsortkey ((char*)&(_bil->let) - (char*)&(_bil->sez),1); + _sort -> addsortkey ((char*)&(_bil->numr) - (char*)&(_bil->sez),4); + _sort -> addsortkey ((char*)&(_bil->num) - (char*)&(_bil->sez),2); + _sort -> addsortkey ((char*)&(_bil->gruppo) - (char*)&(_bil->sez),3); + _sort -> addsortkey ((char*)&(_bil->conto) - (char*)&(_bil->sez),3); + _sort -> addsortkey ((char*)&(_bil->sottoc) - (char*)&(_bil->sez),6); + break; + case con_ana_bil: + { + TRecfield codcbl (*_rec, PCN_CODCBL); + + _sort->reset(_rec->len()); + _sort->addsortkey (codcbl); + break; + } + default: + break; + } } void CG1100_application::set_bil_key(bil_ivd* b, char sezione, char lettera, @@ -182,8 +195,8 @@ void CG1100_application::riempi_record(char sez,char let,const TString& numr, void CG1100_application::postclose_print() { - if (_tipo_stampa == con_IV_direttiva) - delete _sort; + // if (_tipo_stampa == con_IV_direttiva) + // delete _sort; } print_action CG1100_application::postprocess_page(int file,int counter) @@ -296,12 +309,13 @@ default: ////////////////////////////////////////////////////////////// // Crea sort se necessario e seleziona il cursore opportuno ////////////////////////////////////////////////////////////// -void CG1100_application::scegli_cur() +void CG1100_application::do_sort() { switch (_tipo_stampa) { case completa: - select_cursor (_cur_c1); + case senza_IV_direttiva: + case senza_ana_bil: break; case con_IV_direttiva: { @@ -310,8 +324,7 @@ void CG1100_application::scegli_cur() int num_conto; bool classe_conto = FALSE; - init_sort(); - + _sort->init(); select_cursor (_cur_c1); TCursor * cursor = current_cursor(); @@ -339,7 +352,7 @@ void CG1100_application::scegli_cur() if ((g != 0) && (c != 0) && (s == 0)) { - if (sez != '0') + if (sez != '\0' && sez != '0') { sez_conto = sez; @@ -366,7 +379,7 @@ void CG1100_application::scegli_cur() riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,descr,sez_opp,let_opp,numr_opp,num_opp); else { - if (sez != '0') + if (sez != '\0' && sez != '0') { if (let == '\0') if ((sez == '1')||(sez == '2')) @@ -379,21 +392,14 @@ void CG1100_application::scegli_cur() } _sort->endsort(); - delete _bil; + // delete _bil; select_cursor (_cur_c2); break; } - case senza_IV_direttiva: - select_cursor (_cur_c1); - break; - case con_ana_bil: { - TRecfield codcbl (*_rec, PCN_CODCBL); - - _sort->addsortkey (codcbl); _sort->init(); select_cursor (_cur_c1); @@ -419,9 +425,6 @@ void CG1100_application::scegli_cur() select_cursor (_cur_c2); break; } - case senza_ana_bil: - select_cursor (_cur_c1); - break; default: break; } @@ -429,7 +432,7 @@ void CG1100_application::scegli_cur() bool CG1100_application::preprocess_print (int file,int counter) { - //scegli_cur(); + do_sort(); switch (_tipo_stampa) { case con_IV_direttiva: @@ -582,10 +585,10 @@ void CG1100_application::set_con_IV() } } } - set_row (_i,"@58g%3d", _gruppo); - set_row (_i,"@62g%3d", _conto); + set_row (_i,"@58g$[r]%3d$[n]", _gruppo); + set_row (_i,"@62g$[r]%3d$[n]", _conto); if (_sottoc != 0) - set_row (_i,"@66g%6ld", _sottoc); + set_row (_i,"@66g$[r]%6ld$[n]", _sottoc); set_row (_i,"@73g%.40s", (const char*) descr); if (sez_opp != '0') @@ -1019,7 +1022,19 @@ bool CG1100_application::set_print(int) _prima_volta = TRUE; } - scegli_cur(); + switch (_tipo_stampa) + { + case completa: + case senza_IV_direttiva: + case senza_ana_bil: + select_cursor (_cur_c1); break; + case con_IV_direttiva: + case con_ana_bil: + select_cursor (_cur_c2); break; + default: + break; + } + init_sort(); _resetta_righe_stampa = TRUE; return TRUE; @@ -1188,6 +1203,8 @@ void CG1100_application::user_create() _tipo_stampa = completa; _salto_pag = FALSE; + _bil = new bil_ivd; + _sort = new TSort(); } @@ -1197,6 +1214,8 @@ void CG1100_application::user_destroy() delete _rel; delete _rec; delete _descr; + delete _bil; + delete _sort; } int cg1100(int argc, char* argv[])