From 8f0bdf750a88297db40831ee544fa2fe40957fc9 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 3 May 1995 08:27:56 +0000 Subject: [PATCH] Corretti errori MI232-547-608-692-557 git-svn-id: svn://10.65.10.50/trunk@1323 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3200.cpp | 1851 ++++++++++++++++++++++++++++++++++++++---------- cg/cg3200a.uml | 5 +- 2 files changed, 1480 insertions(+), 376 deletions(-) diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index bfe8e5687..90705f23d 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -1,3 +1,8 @@ +//Versione dei mastrini aggiornata con le modifiche del periodo 18 Apr - 27 Apr 1995 +//Le modifiche riguardano: +// - Stampa due mastrini per pagina e conseguente numerazione. +// - Stampa mastrini in continuo e relativa numerazione. + #include #include #include @@ -30,7 +35,8 @@ class TMastrini_application : public TPrintapp static bool data_inizio (TMask_field& f, KEY k); static bool data_fine (TMask_field& f, KEY k); static bool gruppo_hnd (TMask_field& f, KEY k); - static bool conto_hnd (TMask_field& f, KEY k); + static bool contoi_hnd (TMask_field& f, KEY k); + static bool contof_hnd (TMask_field& f, KEY k); friend bool sottoc_handler_ini (TMask_field& f, KEY k); friend bool sottoc_handler_fine (TMask_field& f, KEY k); @@ -46,6 +52,7 @@ class TMastrini_application : public TPrintapp TLocalisamfile* _caus; TSaldo* _sld; TParagraph_string* _d18,* _d23,* _d30; + TArray _riga, _lista; TDate _data_ini,_data_fine,_data_finese,_data_finesesucc,_ultima_data_reg; TDate _datareg,_datadoc,_data_inizioese,_datareg_stampa,_inizioes; @@ -63,7 +70,7 @@ class TMastrini_application : public TPrintapp char _sezivd,_lettivd; TString _descrizione,_sezione,_numdoc,_descrizionemov,_numrivd,_descr; TString _dataregs, _datadocs; - int _gruppocontr,_contocontr; + int _gruppocontr,_contocontr,_nummast,_pagina; long _sottocontocontr; bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov; @@ -71,14 +78,17 @@ class TMastrini_application : public TPrintapp int _annomsk,_annoesmsk,_annoes,_annomsksucc,_tipo_mask,_anno_ghost; int _anno_corrente,_anno_precedente,_indbil,_numero_pag; long _sottoc,_numreg,_numgio,_protiva; - bool _stampa_progressivi_si,_competenza,_inizio_stampa,_puoi_stampare; + bool _stampa_progressivi_si,_competenza,_inizio_stampa,_puoi_stampare,_cambia_mastrino; char _tmcf,_tipo_contr; TDate _dataregrmov; - int _gruppof,_contof; + int _gruppof,_contof; long _sottocf; TString _dataregrmovstring,_importo_str,_saldo_movimenti_str,_saldo_progressivi_str; + int _rw, _conta_mastrini, _indice_array, _item, _item_lista, _indice_lista; + int _ddociva_len; + protected: virtual bool user_create() ; virtual bool user_destroy(); @@ -102,17 +112,23 @@ public: void calcola_progressivi(); void calcola_progressivi_al(); void stampa_progressivi(); + int stampa_progressivi(int start_riga); void stampa_progre_riporto(); + int stampa_progre_riporto(int start_riga); void documenti_iva(); void ricerca_regiva(); void descrizione_causale(); void saldi_zero(); - void crea_intestazione(int riga); + int crea_intestazione(int riga); void crea_intestazione(); void fai_stampa132(); void fai_stampa198(); void stampa_totali132(); - void stampa_totali198(); + void stampa_totali198(); + void stampa_totali132_II(); + void stampa_totali198_II(); + void carica_array_totali132(); + void carica_array_totali198(); void stampa_totaliiva(); void ricerca_classe_IV(bool scelta); void data_fine_esercizio(int); @@ -123,12 +139,50 @@ public: void ricerca_dati_ditta(); void conto(int,int,bool); bool check_ordine(TMask_field& f, KEY k); - + + void setta_riga (int r, TString riga); + int righe_rimaste_da_stampare(); + TMastrini_application() {} }; HIDDEN TMastrini_application& app() { return (TMastrini_application&) main_app(); } +int TMastrini_application::righe_rimaste_da_stampare() +{ + int righe_rimaste = 0; + + if (_nummast == 2) + { + if (printer().rows_left() != 0) + { + if ( (_conta_mastrini % 2) != 0) + { + if ( (printer().formlen() % 2) != 0) + righe_rimaste = printer().rows_left() - (printer().formlen() / 2) + 1; //- 33; + else + righe_rimaste = printer().rows_left() - (printer().formlen() / 2); + } + else + righe_rimaste = printer().rows_left(); + } + else + { + if ( (_conta_mastrini % 2) != 0) + righe_rimaste = printer().formlen() / 2; //32; + else + { + if ( (printer().formlen() % 2) != 0) + righe_rimaste = (printer().formlen() / 2) + 1; //33; + else + righe_rimaste = printer().formlen / 2; + } + } + } + + return righe_rimaste; +} + void TMastrini_application::process_link(int id, const char* txt) { const char* const app = "cg2 -0"; @@ -146,12 +200,24 @@ void TMastrini_application::process_link(int id, const char* txt) bool sottoc_handler_ini(TMask_field& f, KEY key) { const short id = f.dlg(); - const int gruppo = f.mask().get_int(F_GRUPPOINI); - const int conto = f.mask().get_int(F_CONTOINI_CONTO); - const long sottoconto = f.mask().get_long(id); TString ds; TString80 rs; + bool warning; TLocalisamfile pconti (LF_PCON); + int conto; + + const int gruppo = f.mask().get_int(F_GRUPPOINI); + + if (id == F_SOTTOCINI_CONTO) + conto = f.mask().get_int(F_CONTOINI_CONTO); + else + if (id == F_SOTTOCINI_CLIENTE) + conto = f.mask().get_int(F_CONTOINI_CLIENTE); + else + if (id == F_SOTTOCINI_FORN) + conto = f.mask().get_int(F_CONTOINI_FORN); + + const long sottoconto = f.mask().get_long(id); if ( key == K_ENTER ) { @@ -162,7 +228,7 @@ bool sottoc_handler_ini(TMask_field& f, KEY key) return f.warning_box("Manca il GRUPPO"); } - if ( key == K_TAB ) + if ( key == K_TAB && f.mask().is_running()) { if (id == F_SOTTOCINI_CONTO) { @@ -173,63 +239,77 @@ bool sottoc_handler_ini(TMask_field& f, KEY key) pconti.setkey(1); pconti.read(_isequal, _nolock); if (pconti.good()) + { ds = pconti.get(PCN_DESCR); - else + warning = FALSE; + } + else + { ds = ""; + warning = TRUE; + } f.mask().set(F_DESCRINI_CONTO, ds); f.mask().set(F_DESCRINI_CLIENTE, ds); f.mask().set(F_DESCRINI_FORN, ds); + + if (warning) + return f.warning_box("Sottoconto inesistente"); } - if (id == F_SOTTOCINI_CLIENTE || id == F_SOTTOCINI_FORN) - { - char tipo = id == F_SOTTOCINI_CLIENTE ? 'C' : 'F'; - TLocalisamfile clifo (LF_CLIFO); - if (sottoconto != 0) + else + if (id == F_SOTTOCINI_CLIENTE || id == F_SOTTOCINI_FORN) { - clifo.zero(); - clifo.put(CLI_TIPOCF,tipo); - clifo.put(CLI_CODCF, sottoconto) ; - clifo.setkey(1); - if (clifo.read(_isequal, _nolock) == NOERR) - rs = clifo.get(CLI_RAGSOC); - else - rs = ""; - - f.mask().set(F_DESCRINI_CLIENTE, rs); - f.mask().set(F_DESCRINI_FORN, rs); - } - else - if (gruppo != 0 && conto != 0) + char tipo = id == F_SOTTOCINI_CLIENTE ? 'C' : 'F'; + TLocalisamfile clifo (LF_CLIFO); + if (sottoconto != 0) { - pconti.zero(); - pconti.put(PCN_GRUPPO, gruppo) ; - pconti.put(PCN_CONTO, conto); - pconti.setkey(1); - pconti.read(_isequal, _nolock); - if (pconti.good()) - ds = pconti.get(PCN_DESCR); + clifo.zero(); + clifo.put(CLI_TIPOCF,tipo); + clifo.put(CLI_CODCF, sottoconto) ; + clifo.setkey(1); + if (clifo.read(_isequal, _nolock) == NOERR) + { + rs = clifo.get(CLI_RAGSOC); + warning = FALSE; + } else - ds = ""; - - f.mask().set(F_DESCRINI_CLIENTE, ds); - f.mask().set(F_DESCRINI_FORN, ds); - f.mask().set(F_DESCRINI_CONTO, ds); + { + rs = ""; + warning = TRUE; + } + + f.mask().set(F_DESCRINI_CLIENTE, rs); + f.mask().set(F_DESCRINI_FORN, rs); + + if (warning) + return f.warning_box("Anagrafica inesistente"); } - } + } } return TRUE; } bool sottoc_handler_fine(TMask_field& f, KEY key) { - const short id = f.dlg(); - const int gruppo = f.mask().get_int(F_GRUPPOFINE); - const int conto = f.mask().get_int(F_CONTOFINE_CONTO); - const long sottoconto = f.mask().get_long(id); + const short id = f.dlg(); + int conto; TString ds; - TString80 rs; + TString80 rs; + bool warning; TLocalisamfile pconti (LF_PCON); + + const int gruppo = f.mask().get_int(F_GRUPPOFINE); + + if (id == F_SOTTOCFINE_CONTO) + conto = f.mask().get_int(F_CONTOFINE_CONTO); + else + if (id == F_SOTTOCFINE_CLIENTE) + conto = f.mask().get_int(F_CONTOFINE_CLIENTE); + else + if (id == F_SOTTOCFINE_FORN) + conto = f.mask().get_int(F_CONTOFINE_FORN); + + const long sottoconto = f.mask().get_long(id); if ( key == K_ENTER ) { @@ -243,7 +323,7 @@ bool sottoc_handler_fine(TMask_field& f, KEY key) return FALSE; } - if ( key == K_TAB ) + if ( key == K_TAB && f.mask().is_running()) { if (id == F_SOTTOCFINE_CONTO) { @@ -254,56 +334,58 @@ bool sottoc_handler_fine(TMask_field& f, KEY key) pconti.setkey(1); pconti.read(_isequal, _nolock); if (pconti.good()) + { ds = pconti.get(PCN_DESCR); + warning = FALSE; + } else + { ds = ""; + warning = TRUE; + } f.mask().set(F_DESCRFINE_CONTO, ds); f.mask().set(F_DESCRFINE_CLIENTE, ds); f.mask().set(F_DESCRFINE_FORN, ds); + + if (warning) + return f.warning_box("Sottoconto inesistente"); } - if (id == F_SOTTOCFINE_CLIENTE || id == F_SOTTOCFINE_FORN) - { - char tipo = id == F_SOTTOCFINE_CLIENTE ? 'C' : 'F'; - TLocalisamfile clifo (LF_CLIFO); - if (sottoconto != 0) + else + if (id == F_SOTTOCFINE_CLIENTE || id == F_SOTTOCFINE_FORN) { - clifo.zero(); - clifo.put(CLI_TIPOCF,tipo); - clifo.put(CLI_CODCF, sottoconto) ; - clifo.setkey(1); - if (clifo.read(_isequal, _nolock) == NOERR) - rs = clifo.get(CLI_RAGSOC); - else - rs = ""; - - f.mask().set(F_DESCRFINE_CLIENTE, rs); - f.mask().set(F_DESCRFINE_FORN, rs); - } - else - if (gruppo != 0 && conto != 0) + char tipo = id == F_SOTTOCFINE_CLIENTE ? 'C' : 'F'; + TLocalisamfile clifo (LF_CLIFO); + if (sottoconto != 0) { - pconti.zero(); - pconti.put(PCN_GRUPPO, gruppo) ; - pconti.put(PCN_CONTO, conto); - pconti.setkey(1); - pconti.read(_isequal, _nolock); - if (pconti.good()) - ds = pconti.get(PCN_DESCR); - else - ds = ""; - - f.mask().set(F_DESCRFINE_CLIENTE, ds); - f.mask().set(F_DESCRFINE_FORN, ds); - f.mask().set(F_DESCRFINE_CONTO, ds); + clifo.zero(); + clifo.put(CLI_TIPOCF,tipo); + clifo.put(CLI_CODCF, sottoconto) ; + clifo.setkey(1); + if (clifo.read(_isequal, _nolock) == NOERR) + { + rs = clifo.get(CLI_RAGSOC); + warning = FALSE; + } + else + { + rs = ""; + warning = TRUE; + } + + f.mask().set(F_DESCRFINE_CLIENTE, rs); + f.mask().set(F_DESCRFINE_FORN, rs); + + if (warning) + return f.warning_box("Anagrafica inesistente"); } - } + } } return TRUE; } bool TMastrini_application::gruppo_hnd (TMask_field& f, KEY k) -{ +{ if (k == K_ENTER) { int gruppof = f.mask().get_int(F_GRUPPOFINE); @@ -320,8 +402,69 @@ bool TMastrini_application::gruppo_hnd (TMask_field& f, KEY k) return TRUE; } -bool TMastrini_application::conto_hnd (TMask_field& f, KEY k) +bool TMastrini_application::contoi_hnd (TMask_field& f, KEY k) +{ + TLocalisamfile pconti (LF_PCON); + TString ds; + + const short id = f.dlg(); + + if ( (k == K_ENTER || k == K_TAB) && f.mask().is_running()) + { + int gruppo = f.mask().get_int(F_GRUPPOINI); + int conto = f.mask().get_int(id); + + if (gruppo != 0 && conto != 0) + { + bool warning; + + char tipomsk = f.mask().get(F_TIPOCF_INI)[0]; + + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto); + pconti.setkey(1); + pconti.read(_isequal, _nolock); + if (pconti.good()) + { + char tipo = pconti.get_char(PCN_TMCF); + if (tipomsk != tipo) + return f.warning_box("Conto inesistente"); + + ds = pconti.get(PCN_DESCR); + warning = FALSE; + } + else + { + ds = ""; + warning = TRUE; + } + + f.mask().set(F_DESCRINI_CLIENTE, ds); + f.mask().set(F_DESCRINI_FORN, ds); + f.mask().set(F_DESCRINI_CONTO, ds); + + if (warning) + return f.warning_box("Conto inesistente"); + } + else + { + ds = ""; + f.mask().set(F_DESCRINI_CLIENTE, ds); + f.mask().set(F_DESCRINI_FORN, ds); + f.mask().set(F_DESCRINI_CONTO, ds); + } + } + + return TRUE; +} + +bool TMastrini_application::contof_hnd (TMask_field& f, KEY k) { + TLocalisamfile pconti (LF_PCON); + TString ds; + const short id = f.dlg(); + if (k == K_ENTER) { int gruppof = f.mask().get_int(F_GRUPPOFINE); @@ -334,11 +477,70 @@ bool TMastrini_application::conto_hnd (TMask_field& f, KEY k) if (gruppoi < gruppof) return TRUE; - int contof = f.mask().get_int(F_CONTOFINE_CONTO); - int contoi = f.mask().get_int(F_CONTOINI_CONTO); + int contof = f.mask().get_int(id); + int contoi; + + char tipo = f.mask().get(F_TIPOCF_INI)[0]; + + if (tipo == '\0') + contoi = f.mask().get_int(F_CONTOINI_CONTO); + else + if (tipo == 'C') + contoi = f.mask().get_int(F_CONTOINI_CLIENTE); + else + if (tipo == 'F') + contoi = f.mask().get_int(F_CONTOINI_FORN); + if (contoi > contof) return f.error_box("Il conto di partenza deve essere inferiore o uguale al conto di arrivo"); + } + + if ( (k == K_ENTER || k == K_TAB) && f.mask().is_running()) + { + int gruppo = f.mask().get_int(F_GRUPPOFINE); + int conto = f.mask().get_int(id); + if (gruppo != 0 && conto != 0) + { + bool warning; + + char tipomsk = f.mask().get(F_TIPOCF_FINE)[0]; + + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto); + pconti.setkey(1); + pconti.read(_isequal, _nolock); + if (pconti.good()) + { + char tipo = pconti.get_char(PCN_TMCF); + if (tipomsk != tipo) + return f.warning_box("Conto inesistente"); + + ds = pconti.get(PCN_DESCR); + warning = FALSE; + } + else + { + ds = ""; + warning = TRUE; + } + + f.mask().set(F_DESCRFINE_CLIENTE, ds); + f.mask().set(F_DESCRFINE_FORN, ds); + f.mask().set(F_DESCRFINE_CONTO, ds); + + if (warning) + return f.warning_box("Conto inesistente"); + } + else + { + ds = ""; + f.mask().set(F_DESCRFINE_CLIENTE, ds); + f.mask().set(F_DESCRFINE_FORN, ds); + f.mask().set(F_DESCRFINE_CONTO, ds); + } + } return TRUE; @@ -346,32 +548,31 @@ bool TMastrini_application::conto_hnd (TMask_field& f, KEY k) bool TMastrini_application::check_ordine(TMask_field& f, KEY k) { -// if (k == K_ENTER) { - int gruppof = f.mask().get_int(F_GRUPPOFINE); + int gruppof = f.mask().get_int(F_GRUPPOFINE); - if (gruppof == 0) - return TRUE; + if (gruppof == 0) + return TRUE; - int gruppoi = f.mask().get_int(F_GRUPPOINI); + int gruppoi = f.mask().get_int(F_GRUPPOINI); - if (gruppoi < gruppof) - return TRUE; + if (gruppoi < gruppof) + return TRUE; - int contof = f.mask().get_int(F_CONTOFINE_CONTO); - int contoi = f.mask().get_int(F_CONTOINI_CONTO); + int contof = f.mask().get_int(F_CONTOFINE_CONTO); + int contoi = f.mask().get_int(F_CONTOINI_CONTO); - if (contoi < contof) - return TRUE; + if (contoi < contof) + return TRUE; - long sottocf = f.mask().get_long(F_SOTTOCFINE_CONTO); - long sottoci = f.mask().get_long(F_SOTTOCINI_CONTO); + long sottocf = f.mask().get_long(F_SOTTOCFINE_CONTO); + long sottoci = f.mask().get_long(F_SOTTOCINI_CONTO); - if (sottoci > sottocf) - return f.error_box("Il sottoconto di partenza deve essere inferiore o uguale al sottoconto di arrivo"); -// } + if (sottoci > sottocf) + return f.error_box("Il sottoconto di partenza deve essere inferiore o uguale al sottoconto di arrivo"); return TRUE; } + int date2esc(const TDate& d, int* prevesc) { if (prevesc) *prevesc = 0; @@ -584,55 +785,180 @@ void TMastrini_application::saldi_zero() } void TMastrini_application::fai_stampa132() -{ - set_row (1,"@0g#t", &_dataregs); +{ + if (_nummast == 1 || _nummast == 3) + _rw = 1; + else + if (_nummast == 2) + { + int riga; + + if ( (_conta_mastrini % 2) != 0 ) + riga = (printer().formlen() / 2); //-1 + else + riga = printer().formlen(); //-1; + + int app1 = printer().formlen(); + int app2 = printer().rows_left(); + int cur_row = (app1 - app2); + + if (cur_row == riga) + { + //_rw += 2; + _rw = crea_intestazione(_rw); + _rw = stampa_progre_riporto(_rw); + + for (int i = _indice_array; i < _item; i++) + { + TString& data = (TString&)_riga[i]; + + int g1 = data.find("g",1); + int c1 = data.find("@",g1); + int g2 = data.find("g",c1); + + TString fmt1 = ""; + TString fmt2 = ""; + TString str1,str2; + + if (g1 != -1) + { + fmt1 = data.sub(0,g1+1); + fmt1 << "%s"; + str1 = data.sub(g1+1,c1); + } + if (c1 != -1) + { + fmt2 = data.sub(c1,g2+1); + fmt2 << "%s"; + str2 = data.sub(g2+1); + } + + if (fmt1 != "") + set_row (_rw,fmt1,(const char*) str1); + if (fmt2 != "") + set_row (_rw,fmt2,(const char*) str2); + + _rw++; + } + } + else + _rw = 1; + + _riga.destroy(); + } + + set_row (_rw,"@0g#t", &_dataregs); if (_stampanum == 1) - set_row (1,"@11g$[r]#7d$[n]", &_numreg); + set_row (_rw,"@11g$[r]#7d$[n]", &_numreg); else if (_stampanum == 2) { - set_row (1,"@11g#7d", &_numgio); + set_row (_rw,"@11g#7d", &_numgio); } - set_row (1,"@19g#t", &_datadocs); - set_row (1,"@30g#7t", &_numdoc); - set_row (1,"@38g#3t", &_codcaus); + set_row (_rw,"@19g#t", &_datadocs); + set_row (_rw,"@30g#7t", &_numdoc); + set_row (_rw,"@38g#3t", &_codcaus); - set_row (1,"@117g#3t", &_g_contr); - set_row (1,"@120g#3t", &_c_contr); - set_row (1,"@123g#6t", &_s_contr); + set_row (_rw,"@117g#3t", &_g_contr); + set_row (_rw,"@120g#3t", &_c_contr); + set_row (_rw,"@123g#6t", &_s_contr); } void TMastrini_application::fai_stampa198() -{ - set_row (1,"@0g#t", &_dataregs); +{ + if (_nummast == 1 || _nummast == 3) + _rw = 1; + else + if (_nummast == 2) + { + int riga; + + if ( (_conta_mastrini % 2) != 0 ) + riga = (printer().formlen() / 2); //-1 + else + riga = printer().formlen(); //-1; + + int app1 = printer().formlen(); + int app2 = printer().rows_left(); + int cur_row = (app1 - app2); + + if (cur_row == riga) + { + //_rw += 2; + _rw = crea_intestazione(_rw); + _rw = stampa_progre_riporto(_rw); + + for (int i = _indice_array; i < _item; i++) + { + TString& data = (TString&)_riga[i]; + + int g1 = data.find("g",1); + int c1 = data.find("@",g1); + int g2 = data.find("g",c1); + + TString fmt1 = ""; + TString fmt2 = ""; + TString str1,str2; + + if (g1 != -1) + { + fmt1 = data.sub(0,g1+1); + fmt1 << "%s"; + str1 = data.sub(g1+1,c1); + } + if (c1 != -1) + { + fmt2 = data.sub(c1,g2+1); + fmt2 << "%s"; + str2 = data.sub(g2+1); + } + + if (fmt1 != "") + set_row (_rw,fmt1,(const char*) str1); + if (fmt2 != "") + set_row (_rw,fmt2,(const char*) str2); + + _rw++; + } + } + else + _rw = 1; + + _riga.destroy(); + } + + set_row (_rw,"@0g#t", &_dataregs); if (_stampanum == 1) { - set_row (1,"@11g$[r]#7d$[n]", &_numreg); - set_row (1,"@18g/#3d", &_numrig); + set_row (_rw,"@11g$[r]#7d$[n]", &_numreg); + set_row (_rw,"@18g/#3d", &_numrig); } else if (_stampanum == 2) - set_row (1,"@11g#7d", &_numgio); + set_row (_rw,"@11g#7d", &_numgio); - set_row (1,"@23g#t", &_datadocs); - set_row (1,"@34g#7t", &_numdoc); - set_row (1,"@42g#3t", &_codcaus); + set_row (_rw,"@23g#t", &_datadocs); + set_row (_rw,"@34g#7t", &_numdoc); + set_row (_rw,"@42g#3t", &_codcaus); // Stampa saldo movimenti - set_row (1,"@153g#t", &_saldo_movimenti_str); + set_row (_rw,"@153g#t", &_saldo_movimenti_str); - set_row (1,"@169g#3t", &_g_contr); - set_row (1,"@172g#3t", &_c_contr); - set_row (1,"@175g#6t", &_s_contr); + set_row (_rw,"@169g#3t", &_g_contr); + set_row (_rw,"@172g#3t", &_c_contr); + set_row (_rw,"@175g#6t", &_s_contr); } void TMastrini_application::stampa_totali132() { TString sep(132); + if (_nummast == 1 || _nummast == 3) + _rw = 2; + sep.fill('-'); //Stampa 132 - (sep(132)) - set_row(2,"@0g%s", (const char *) sep); + set_row(_rw++,"@0g%s", (const char *) sep); _totprogre_dare=_progredare+_totale_periodo_dare; _totprogre_avere=_progreavere+_totale_periodo_avere; @@ -640,85 +966,401 @@ void TMastrini_application::stampa_totali132() _saldo_progre = _totprogre_dare - _totprogre_avere; _saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al; TString string = _saldo_periodo.string("###.###.###.###"); - set_row (3,"@32gTOTALI PERIODO@69g%15s", (const char*)string); + set_row (_rw,"@32gTOTALI PERIODO@69g%15s", (const char*)string); string = _totale_periodo_dare.string("###.###.###.###"); - set_row (3,"@85g%15s", (const char*)string); + set_row (_rw,"@85g%15s", (const char*)string); string = _totale_periodo_avere.string("###.###.###.###"); - set_row (3,"@101g%15s", (const char*)string); + set_row (_rw++,"@101g%15s", (const char*)string); string = _saldo_progre.string("###.###.###.###"); - set_row (4,"@32gTOTALI PROGRESSIVI@69g%15s", (const char*)string); + set_row (_rw,"@32gTOTALI PROGRESSIVI@69g%15s", (const char*)string); string = _totprogre_dare.string("###.###.###.###"); - set_row (4,"@85g%15s", (const char*)string); + set_row (_rw,"@85g%15s", (const char*)string); string = _totprogre_avere.string("###.###.###.###"); - set_row (4,"@101g%15s", (const char*)string); + set_row (_rw++,"@101g%15s", (const char*)string); if (_stampaprogre) //Progressivi attuali { TString str = _saldo_progre_al.string("###.###.###.###"); - set_row (5,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); - set_row (5,"@69g%15s", (const char*)str); + set_row (_rw,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); + set_row (_rw,"@69g%15s", (const char*)str); str = _totprogre_dare_al.string("###.###.###.###"); - set_row (5,"@85g%15s", (const char*)str); + set_row (_rw,"@85g%15s", (const char*)str); str = _totprogre_avere_al.string("###.###.###.###"); - set_row (5,"@101g%15s", (const char*)str); + set_row (_rw,"@101g%15s", (const char*)str); } } +void TMastrini_application::carica_array_totali132() +{ + TString sep(132); + TToken_string r(255); + + if (_nummast == 2) + _rw = 1; + + _totprogre_dare=_progredare+_totale_periodo_dare; + _totprogre_avere=_progreavere+_totale_periodo_avere; + _saldo_periodo = _totale_periodo_dare - _totale_periodo_avere; + _saldo_progre = _totprogre_dare - _totprogre_avere; + _saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al; + + sep.fill(' '); + r.add("@0g%s"); + r.add(sep); + _lista.add(r); + r = ""; + + sep.fill('-'); //Stampa 132 - (sep(132)) + r.add("@0g%s"); + r.add(sep); + _lista.add(r); + r = ""; + + r.add("@32gTOTALI PERIODO@69g%15s@85g%15s@101g%15s"); + r.add(_saldo_periodo.string("###.###.###.###")); + r.add(_totale_periodo_dare.string("###.###.###.###")); + r.add(_totale_periodo_avere.string("###.###.###.###")); + _lista.add(r); + r = ""; + + r.add("@32gTOTALI PROGRESSIVI@69g%15s@85g%15s@101g%15s"); + r.add(_saldo_progre.string("###.###.###.###")); + r.add(_totprogre_dare.string("###.###.###.###")); + r.add(_totprogre_avere.string("###.###.###.###")); + _lista.add(r); + r = ""; + + if (_stampaprogre) //Progressivi attuali + { + r.add("@32gTOTALI PROGRESSIVI AL@55g%s@69g%15s@85g%15s@101g%15s"); + r.add(_ultima_data_reg.string()); + r.add(_saldo_progre_al.string("###.###.###.###")); + r.add(_totprogre_dare_al.string("###.###.###.###")); + r.add(_totprogre_avere_al.string("###.###.###.###")); + _lista.add(r); + r = ""; + } + + if (_stampatotiva) + { + real totale; + + sep.fill(' '); + r.add("@0g%s"); + r.add(sep); + _lista.add(r); + r = ""; + + TString fmt ("@0g%s"); + TString fmt1(format("@%dg", _ddociva_len)); + fmt << fmt1 << "%15s"; + + for (int j = 0; j < _b.items(); j++) + { + TDociva& riga = (TDociva&)_b[j]; + r.add(fmt); + r.add(riga._descrdoc); + totale = riga._totdociva; + r.add(totale.string("###.###.###.###")); + _lista.add(r); + r = ""; + } + + _b.destroy(); + } + + _indice_lista = 0; +} + +void TMastrini_application::stampa_totali132_II() +{ + int riga,cur_row,diff; + int lim = 0; + + _item_lista = _lista.items(); + + if ( (_conta_mastrini % 2) != 0 ) + { + riga = (printer().formlen() / 2); //- 1; + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + else + { + riga = printer().formlen(); //- 1; + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + + if (_indice_lista == 0 && diff != 0) + { + if (_item_lista > diff) + lim = diff; + else + lim = _item_lista; + } + else + { + lim = _item_lista; + _rw = 1; + _rw = crea_intestazione(_rw); + _rw = stampa_progre_riporto(_rw); + if ( (_conta_mastrini % 2) != 0 ) + { + riga = (printer().formlen() / 2); //- 1; + cur_row = _rw; + diff = riga - cur_row; + } + else + { + riga = printer().formlen(); //- 1; + cur_row = _rw + (printer().formlen() / 2); //32; + diff = riga - cur_row; + } + } + + for (int i = _indice_lista; i < lim; i++) + { + TToken_string& data = (TToken_string&)_lista[i]; + + TString fmt (data.get(0)); + TString arg1 (data.get(1)); + TString arg2 (data.get(2)); + TString arg3 (data.get(3)); + TString arg4 (data.get(4)); + + set_row(_rw++,fmt, (const char*) arg1, (const char*) arg2, (const char*) arg3, (const char*) arg4); + + _indice_lista++; + } + + if (_item_lista <= diff) + _lista.destroy(); +} + void TMastrini_application::stampa_totali198() { TString sep(198); + if (_nummast == 1 || _nummast == 3) + _rw = 1; + sep.fill('-'); //Stampa 132 - (sep(132)) - set_row(2,"@0g%s", (const char *) sep); + set_row(_rw++,"@0g%s", (const char *) sep); _totprogre_dare=_progredare+_totale_periodo_dare; _totprogre_avere=_progreavere+_totale_periodo_avere; TString string = _totale_periodo_dare.string("###.###.###.###"); - set_row (3,"@32gTOTALI PERIODO@102g%15s", (const char*)string); + set_row (_rw,"@32gTOTALI PERIODO@102g%15s", (const char*)string); string = _totale_periodo_avere.string("###.###.###.###"); - set_row (3,"@119g%15s", (const char*)string); + set_row (_rw,"@119g%15s", (const char*)string); string = _saldo_movimenti.string("###.###.###.###"); - set_row (3,"@153g%15s", (const char*)string); + set_row (_rw++,"@153g%15s", (const char*)string); string = _totprogre_dare.string("###.###.###.###"); - set_row (4,"@32gTOTALI PROGRESSIVI@102g%15s",(const char*)string); + set_row (_rw,"@32gTOTALI PROGRESSIVI@102g%15s",(const char*)string); string = _totprogre_avere.string("###.###.###.###"); - set_row (4,"@119g%15s", (const char*)string); + set_row (_rw,"@119g%15s", (const char*)string); string = _saldo_progressivi.string("###.###.###.###"); - set_row (4,"@136g%15s", (const char*)string); + set_row (_rw++,"@136g%15s", (const char*)string); if (_stampaprogre) //Progressivi attuali { - set_row(5,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); + set_row(_rw,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); TString str = _totprogre_dare_al.string("###.###.###.###"); - set_row (5,"@102g%15s", (const char*)str); + set_row (_rw,"@102g%15s", (const char*)str); str = _totprogre_avere_al.string("###.###.###.###"); - set_row (5,"@119g%15s", (const char*)str); + set_row (_rw,"@119g%15s", (const char*)str); str = _saldo_progressivi.string("###.###.###.###"); - set_row (5,"@136g%15s", (const char*)str); + set_row (_rw,"@136g%15s", (const char*)str); } } +void TMastrini_application::carica_array_totali198() +{ + TString sep(198); + TToken_string r(255); + + if (_nummast == 2) + _rw = 1; + + sep.fill(' '); //Stampa 132 - (sep(132)) + r.add("@0g%s"); + r.add(sep); + _lista.add(r); + r = ""; + + sep.fill('-'); //Stampa 132 - (sep(132)) + r.add("@0g%s"); + r.add(sep); + _lista.add(r); + r = ""; + + _totprogre_dare=_progredare+_totale_periodo_dare; + _totprogre_avere=_progreavere+_totale_periodo_avere; + + r.add("@32gTOTALI PERIODO@102g%15s@119g%15s@153g%15s"); + r.add(_totale_periodo_dare.string("###.###.###.###")); + r.add(_totale_periodo_avere.string("###.###.###.###")); + r.add(_saldo_movimenti.string("###.###.###.###")); + _lista.add(r); + r = ""; + + r.add("@32gTOTALI PROGRESSIVI@102g%15s@119g%15s@136g%15s"); + r.add(_totprogre_dare.string("###.###.###.###")); + r.add(_totprogre_avere.string("###.###.###.###")); + r.add(_saldo_progressivi.string("###.###.###.###")); + _lista.add(r); + r = ""; + + if (_stampaprogre) //Progressivi attuali + { + r.add("@32gTOTALI PROGRESSIVI AL@55g%s@102g%15s@119g%15s@136g%15s"); + r.add(_ultima_data_reg.string()); + r.add(_totprogre_dare_al.string("###.###.###.###")); + r.add(_totprogre_avere_al.string("###.###.###.###")); + r.add(_saldo_progressivi.string("###.###.###.###")); + _lista.add(r); + r = ""; + } + + if (_stampatotiva) + { + real totale; + + sep.fill(' '); + r.add("@0g%s"); + r.add(sep); + _lista.add(r); + r = ""; + + TString fmt ("@0g%s"); + TString fmt1(format("@%dg", _ddociva_len)); + fmt << fmt1 << "%15s"; + + for (int j = 0; j < _b.items(); j++) + { + TDociva& riga = (TDociva&)_b[j]; + r.add(fmt); + r.add(riga._descrdoc); + totale = riga._totdociva; + r.add(totale.string("###.###.###.###")); + _lista.add(r); + r = ""; + } + + _b.destroy(); + } + + _indice_lista = 0; +} + +void TMastrini_application::stampa_totali198_II() +{ + int riga,cur_row,diff; + int lim = 0; + + _item_lista = _lista.items(); + + if ( (_conta_mastrini % 2) != 0 ) + { + riga = (printer().formlen() / 2); //- 1; + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + else + { + riga = printer().formlen(); //- 1; + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + + if (_indice_lista == 0 && diff != 0) + { + if (_item_lista > diff) + lim = diff; + else + lim = _item_lista; + } + else + { + lim = _item_lista; + _rw = 1; + _rw = crea_intestazione(_rw); + _rw = stampa_progre_riporto(_rw); + if ( (_conta_mastrini % 2) != 0 ) + { + riga = (printer().formlen() / 2); //- 1; + cur_row = _rw; + diff = riga - cur_row; + } + else + { + riga = printer().formlen(); //- 1; + cur_row = _rw + (printer().formlen() / 2); //32; + diff = riga - cur_row; + } + } + + for (int i = _indice_lista; i < lim; i++) + { + TToken_string& data = (TToken_string&)_lista[i]; + + TString fmt (data.get(0)); + TString arg1 (data.get(1)); + TString arg2 (data.get(2)); + TString arg3 (data.get(3)); + TString arg4 (data.get(4)); + + set_row(_rw++,fmt, (const char*) arg1, (const char*) arg2, (const char*) arg3, (const char*) arg4); + + _indice_lista++; + } + + if (_item_lista <= diff) + _lista.destroy(); +} + +void TMastrini_application::setta_riga (int r, TString riga) +{ + TString *p = (TString*)_riga.objptr(r); + if (!p) + { + p = new TString; + _riga.add (p); + } + *p << riga; +} + bool TMastrini_application::preprocess_page(int file, int counter) { TLocalisamfile & rmov = current_cursor()->file(LF_RMOV); - long rec; - TDate datasucc; + long rec; + TDate datasucc; TString datasuccstring,dataregrmovstring; - int gruppof,contof; - long sottocf; - TString provvis = ""; - int annoes; + int gruppof,contof; + long sottocf; + TString provvis = ""; + int annoes; if (counter) return TRUE; - + switch (file) { case LF_SALDI: // Usati in crea_intestazione() - + + if (_nummast == 3 || _nummast == 2) + { + _rw = 0; + _rw++; + } + _gruppo = atoi(current_cursor()->curr(LF_SALDI).get(SLD_GRUPPO)); _conto = atoi(current_cursor()->curr(LF_SALDI).get(SLD_CONTO)); _sottoc = atol(current_cursor()->curr(LF_SALDI).get(SLD_SOTTOCONTO)); + + _cambia_mastrino = TRUE; + annoes = atoi(current_cursor()->curr(LF_SALDI).get(SLD_ANNOES)); conto(_gruppo,_conto,TRUE); @@ -752,15 +1394,20 @@ bool TMastrini_application::preprocess_page(int file, int counter) saldi_zero(); else _totale_saldo = 1; - + if ((_tipostampa == 1) || (_tipostampa == 2)) { if ((almeno_un_record()) && (_totale_saldo != 0)) - { + { _puoi_stampare = TRUE; - calcola_progressivi(); - _saldo_progressivi += _saldo_progre_prec; - stampa_progre_riporto(); + + if (_nummast == 3 || _nummast == 2) + { + _rw = crea_intestazione(_rw); + calcola_progressivi(); + _saldo_progressivi += _saldo_progre_prec; + _rw = stampa_progre_riporto(_rw); + } } else { @@ -770,27 +1417,35 @@ bool TMastrini_application::preprocess_page(int file, int counter) } else if (_tipostampa == 3) - { - calcola_progressivi(); + { + if (_nummast == 2 || _nummast == 3) + calcola_progressivi(); if (_progredare == ZERO && _progreavere == ZERO && !almeno_un_record()) { _puoi_stampare = FALSE; return FALSE; } else - { + { _puoi_stampare = TRUE; - _saldo_progressivi += _saldo_progre_prec; - stampa_progre_riporto(); + + if (_nummast == 3 || _nummast == 2) + { + _rw = crea_intestazione(_rw); + _saldo_progressivi += _saldo_progre_prec; + _rw = stampa_progre_riporto(_rw); + } } } break; case LF_RMOV: { - //int rw = 1; - + if (_nummast == 1 || _nummast == 3) + _rw = 1; + // Ricerca la contropartita di quel movimento + TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); _numreg = atol (current_cursor()->curr(LF_RMOV).get(RMV_NUMREG)); @@ -849,10 +1504,10 @@ bool TMastrini_application::preprocess_page(int file, int counter) int anno = date2esc(_datareg_stampa); if (anno != _annoes) if (_numcarat == 1) - set_row (1, "@131g*"); + set_row (_rw, "@131g*"); else if (_numcarat == 2) - set_row (1, "@197g*"); + set_row (_rw, "@197g*"); _codcaus = _mov->curr().get(MOV_CODCAUS); _tipodoc = _mov->curr().get(MOV_TIPODOC); @@ -862,6 +1517,8 @@ bool TMastrini_application::preprocess_page(int file, int counter) { documenti_iva(); _b.add_riga(_descrdociva,_importo, _natdoc); + if (_descrdociva.len() > _ddociva_len) + _ddociva_len = _descrdociva.len(); } } _datadoc = (_mov->curr().get(MOV_DATADOC)); @@ -873,99 +1530,267 @@ bool TMastrini_application::preprocess_page(int file, int counter) _descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR); - if (_numcarat == 1) // Stampa 132 caratteri + if (_nummast == 1 || _nummast == 3) { - if (_descrizione != "") - { - *_d23 = (const char*) _descrizione; - if (_descrizionemov != "") - { - *_d18 = (const char*) _descrizionemov; - set_row(1, "@42g#a", _d18); - set_row(1, "@61g#a", _d23); - } - else if (_descrizionemov == "") - { - *_d18 = (const char*) _descrcaus; - set_row(1, "@42g#a", _d18); - set_row(1, "@61g#a", _d23); - } - } - else if (_descrizione == "") - if (_descrizionemov != "") - { - *_d23 = (const char*) _descrizionemov; - *_d18 = (const char*) _descrcaus; - set_row (1,"@42g#a", _d18); - set_row (1,"@61g#a", _d23); - } - else - if (_descrizionemov == "") - { - conto(_gruppocontr,_contocontr,FALSE); - TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); - TString80 descr_contr = tc.descrizione(); - //set_row (1,"@42g%.18s", (const char*) _descrcaus); - //if (descr_contr != "Sconosciuto") - // set_row (1,"@61g%.23s", (const char*) descr_contr); - *_d18 = (const char*) _descrcaus; - set_row (1,"@42g#a", _d18); - if (descr_contr != "Sconosciuto") - { - *_d23 = (const char*) descr_contr; - set_row (1,"@61g#a", _d23); - } - } - } - else - if (_numcarat == 2) // Stampa 198 caratteri + if (_numcarat == 1) // Stampa 132 caratteri { if (_descrizione != "") { - *_d30 = (const char*) _descrizione; + *_d23 = (const char*) _descrizione; if (_descrizionemov != "") { - *_d23 = (const char*) _descrizionemov; - set_row (1,"@46g#a", _d23); - set_row (1,"@70g#a", _d30); + *_d18 = (const char*) _descrizionemov; + set_row(_rw, "@42g#a", _d18); + set_row(_rw, "@61g#a", _d23); } else if (_descrizionemov == "") { - //set_row (1,"@46g%.23s", (const char*) _descrcaus); - //set_row (1,"@70g%.30s", (const char*) _descrizione); - *_d23 = (const char*) _descrcaus; - set_row(1, "@46g#a", _d23); - set_row(1, "@70g#a", _d30); + *_d18 = (const char*) _descrcaus; + set_row(_rw, "@42g#a", _d18); + set_row(_rw, "@61g#a", _d23); } } - else if (_descrizione == "") + else if (_descrizione == "") if (_descrizionemov != "") { - //set_row (1,"@46g%.23s", (const char*) _descrcaus); - //set_row (1,"@70g%.30s", (const char*) _descrizionemov); - *_d30 = (const char*) _descrizionemov; - *_d23 = (const char*) _descrcaus; - set_row (1,"@46g#a", _d23); - set_row (1,"@70g#a", _d30); + *_d23 = (const char*) _descrizionemov; + *_d18 = (const char*) _descrcaus; + set_row (_rw,"@42g#a", _d18); + set_row (_rw,"@61g#a", _d23); } else if (_descrizionemov == "") { conto(_gruppocontr,_contocontr,FALSE); TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); - TString descr_contr = tc.descrizione(); - //set_row (1,"@46g%.23s", (const char*) _descrcaus); + TString80 descr_contr = tc.descrizione(); + //set_row (1,"@42g%.18s", (const char*) _descrcaus); //if (descr_contr != "Sconosciuto") - // set_row (1,"@70g%.30s", (const char*) descr_contr); - *_d23 = (const char*) _descrcaus; - set_row (1,"@46g#a", _d23); + // set_row (1,"@61g%.23s", (const char*) descr_contr); + *_d18 = (const char*) _descrcaus; + set_row (_rw,"@42g#a", _d18); if (descr_contr != "Sconosciuto") { - *_d30 = (const char*) descr_contr; - set_row (1,"@70g#a", _d30); + *_d23 = (const char*) descr_contr; + set_row (_rw,"@61g#a", _d23); } - } + } } + else + if (_numcarat == 2) // Stampa 198 caratteri + { + if (_descrizione != "") + { + *_d30 = (const char*) _descrizione; + if (_descrizionemov != "") + { + *_d23 = (const char*) _descrizionemov; + set_row (_rw,"@46g#a", _d23); + set_row (_rw,"@70g#a", _d30); + } + else if (_descrizionemov == "") + { + //set_row (1,"@46g%.23s", (const char*) _descrcaus); + //set_row (1,"@70g%.30s", (const char*) _descrizione); + *_d23 = (const char*) _descrcaus; + set_row(_rw, "@46g#a", _d23); + set_row(_rw, "@70g#a", _d30); + } + } + else if (_descrizione == "") + if (_descrizionemov != "") + { + //set_row (1,"@46g%.23s", (const char*) _descrcaus); + //set_row (1,"@70g%.30s", (const char*) _descrizionemov); + *_d30 = (const char*) _descrizionemov; + *_d23 = (const char*) _descrcaus; + set_row (_rw,"@46g#a", _d23); + set_row (_rw,"@70g#a", _d30); + } + else + if (_descrizionemov == "") + { + conto(_gruppocontr,_contocontr,FALSE); + TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); + TString descr_contr = tc.descrizione(); + //set_row (1,"@46g%.23s", (const char*) _descrcaus); + //if (descr_contr != "Sconosciuto") + // set_row (1,"@70g%.30s", (const char*) descr_contr); + *_d23 = (const char*) _descrcaus; + set_row (_rw,"@46g#a", _d23); + if (descr_contr != "Sconosciuto") + { + *_d30 = (const char*) descr_contr; + set_row (_rw,"@70g#a", _d30); + } + } + } + } //if (_nummast == 1 || _nummast == 3) + + if (_nummast == 2) + { + TString d18,d23,d30; + + if (_numcarat == 1) // Stampa 132 caratteri + { + if (_descrizione != "") + { + d23 = _descrizione; + if (_descrizionemov != "") + d18 = _descrizionemov; + else if (_descrizionemov == "") + d18 = _descrcaus; + } + else if (_descrizione == "") + if (_descrizionemov != "") + { + d23 = _descrizionemov; + d18 = _descrcaus; + } + else + if (_descrizionemov == "") + { + conto(_gruppocontr,_contocontr,FALSE); + TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); + TString80 descr_contr = tc.descrizione(); + d18 = _descrcaus; + if (descr_contr != "Sconosciuto") + d23 = descr_contr; + } + + TParagraph_string d_18 (d18,18); + int i = 0; + const char* str; + while ( (str = d_18.get()) != NULL) + { + TString stringa = ""; + stringa << "@42g" << str; + setta_riga(i,stringa); + i++; + } + + TParagraph_string d_23 (d23,23); + i = 0; + while ( (str = d_23.get()) != NULL) + { + TString stringa = ""; + stringa << "@61g" << str; + setta_riga(i,stringa); + i++; + } + } + else + if (_numcarat == 2) // Stampa 198 caratteri + { + if (_descrizione != "") + { + d30 = _descrizione; + if (_descrizionemov != "") + d23 = _descrizionemov; + else if (_descrizionemov == "") + d23 = _descrcaus; + } + else if (_descrizione == "") + if (_descrizionemov != "") + { + d30 = _descrizionemov; + d23 = _descrcaus; + } + else + if (_descrizionemov == "") + { + conto(_gruppocontr,_contocontr,FALSE); + TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); + TString descr_contr = tc.descrizione(); + d23 = _descrcaus; + if (descr_contr != "Sconosciuto") + d30 = descr_contr; + } + + TParagraph_string d_23 (d23,23); + int i = 0; + const char* str; + while ( (str = d_23.get()) != NULL) + { + TString stringa = ""; + stringa << "@46g" << str; + setta_riga(i,stringa); + i++; + } + + TParagraph_string d_30 (d30,30); + i = 0; + while ( (str = d_30.get()) != NULL) + { + TString stringa = ""; + stringa << "@70g" << str; + setta_riga(i,stringa); + i++; + } + } + + _item = _riga.items(); + int riga,cur_row,diff; + + if ( (_conta_mastrini % 2) != 0 ) + { + riga = (printer().formlen() / 2); //- 1; + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + else + { + riga = printer().formlen(); //- 1; + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + + int lim = 0; + if (_item > diff) + lim = diff; + else + lim = _item; + + _indice_array = 0; + + int k = _rw; + + for (int i = 0; i < lim; i++) + { + TString& data = (TString&)_riga[i]; + + int g1 = data.find("g",1); + int c1 = data.find("@",g1); + int g2 = data.find("g",c1); + + TString fmt1 = ""; + TString fmt2 = ""; + TString str1,str2; + + if (g1 != -1) + { + fmt1 = data.sub(0,g1+1); + fmt1 << "%s"; + str1 = data.sub(g1+1,c1); + } + if (c1 != -1) + { + fmt2 = data.sub(c1,g2+1); + fmt2 << "%s"; + str2 = data.sub(g2+1); + } + + if (fmt1 != "") + set_row (k,fmt1,(const char*) str1); + if (fmt2 != "") + set_row (k,fmt2,(const char*) str2); + + k++; + _indice_array++; + } + + //_riga.destroy(); + } //if (_nummast == 2) if (_sezione == "D") { @@ -973,13 +1798,13 @@ bool TMastrini_application::preprocess_page(int file, int counter) _riporto_parziale_dare += _importo; if (_numcarat == 1) // Stampa 132 caratteri - set_row (1,"@85g%s", (const char*) _importo_str); + set_row (_rw,"@85g%s", (const char*) _importo_str); else if (_numcarat == 2) // Stampa 198 caratteri { _saldo_progressivi += _importo; _saldo_movimenti += _importo; - set_row (1,"@102g%s", (const char*) _importo_str); + set_row (_rw,"@102g%s", (const char*) _importo_str); } } else if (_sezione == "A") @@ -988,13 +1813,13 @@ bool TMastrini_application::preprocess_page(int file, int counter) _riporto_parziale_avere += _importo; if (_numcarat == 1) // Stampa 132 caratteri - set_row (1,"@101g%s", (const char*) _importo_str); + set_row (_rw,"@101g%s", (const char*) _importo_str); else if (_numcarat == 2) // Stampa 198 caratteri { _saldo_progressivi -= _importo; _saldo_movimenti -= _importo; - set_row (1,"@119g%s", (const char*) _importo_str); + set_row (_rw,"@119g%s", (const char*) _importo_str); } } @@ -1005,10 +1830,10 @@ bool TMastrini_application::preprocess_page(int file, int counter) ricerca_regiva(); _protiva = atol(_mov->curr().get(MOV_PROTIVA)); if (_protiva != 0) - set_row (1,"@191g%5d", _protiva); + set_row (_rw,"@191g%5d", _protiva); if (_tipo < 3) - set_row (1,"@182g#t" , &_regiva); + set_row (_rw,"@182g#t" , &_regiva); _dataregrmov = current_cursor()->curr(LF_RMOV).get_date(RMV_DATAREG); dataregrmovstring=_dataregrmov.string(); @@ -1024,9 +1849,10 @@ bool TMastrini_application::preprocess_page(int file, int counter) if (((gruppof!=_gruppo)||(contof!=_conto)||(sottocf!=_sottoc))||(rmov.eof())) datasucc = (""); if (datasucc != _dataregrmov) - set_row (1,"@136g#t", &_saldo_progressivi_str); + set_row (_rw,"@136g#t", &_saldo_progressivi_str); rmov.readat(rec); } + _rw = 1; return TRUE; } @@ -1065,54 +1891,147 @@ void TMastrini_application::set_page(int file, int counter) } print_action TMastrini_application::postprocess_page(int file, int counter) -{ - if (counter) +{ + if (_nummast == 1 || _nummast == 3) { - printer().formfeed(); - reset_print(); // per evitare che stampi di nuovo il totale prec. - _stampa_progressivi_si = TRUE; - return NEXT_PAGE; + if (counter) + { + if (_nummast == 1) //Il salto pagina a rottura di mastrino viene + printer().formfeed(); //fatto solo quando seleziono un mastrino per pagina + + reset_print(); // per evitare che stampi di nuovo il totale prec. + _stampa_progressivi_si = TRUE; + _riporto_dare = ZERO; + _riporto_avere = ZERO; + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + _ddociva_len = 0; + + return NEXT_PAGE; + } } + else + if (_nummast == 2) + { + int item_lista = _lista.items(); + + if (counter && item_lista == 0) + { + reset_print(); // per evitare che stampi di nuovo il totale prec. + _stampa_progressivi_si = TRUE; + _riporto_dare = ZERO; + _riporto_avere = ZERO; + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + _ddociva_len = 0; + + return NEXT_PAGE; + } + } switch (file) { case LF_SALDI: - if (_tipostampa == 3) + { + if (_nummast == 1 || _nummast == 3) { - reset_print(); - if (_numcarat == 1) - stampa_totali132(); - else if (_numcarat == 2) - stampa_totali198(); + if (_tipostampa == 3) + { + reset_print(); + if (_numcarat == 1) + stampa_totali132(); + else if (_numcarat == 2) + stampa_totali198(); - if (_stampatotiva) - stampa_totaliiva(); + if (_stampatotiva) + stampa_totaliiva(); + } + else if (_tipostampa == 2) + { + reset_print(); + if ((_totale_saldo != 0) && (_puoi_stampare)) + if (_numcarat == 1) + stampa_totali132(); + else if (_numcarat == 2) + stampa_totali198(); + if (_stampatotiva) + stampa_totaliiva(); + } + else if (_tipostampa == 1) + { + reset_print(); + if (_puoi_stampare) + if (_numcarat == 1) + stampa_totali132(); + else if (_numcarat == 2) + stampa_totali198(); + if (_stampatotiva) + stampa_totaliiva(); + } } - else if (_tipostampa == 2) - { - reset_print(); - if ((_totale_saldo != 0) && (_puoi_stampare)) - if (_numcarat == 1) - stampa_totali132(); - else if (_numcarat == 2) - stampa_totali198(); - if (_stampatotiva) - stampa_totaliiva(); - } + else + if (_nummast == 2) + { + if (!counter) + { + if (_numcarat == 1) + carica_array_totali132(); + else + if (_numcarat == 2) + carica_array_totali198(); + } + + if (_tipostampa == 3) + { + reset_print(); + if (_numcarat == 1) + stampa_totali132_II(); + else if (_numcarat == 2) + stampa_totali198_II(); + } + else if (_tipostampa == 2) + { + reset_print(); + if ((_totale_saldo != 0) && (_puoi_stampare)) + if (_numcarat == 1) + stampa_totali132_II(); + else if (_numcarat == 2) + stampa_totali198_II(); + } else if (_tipostampa == 1) { reset_print(); - if (_puoi_stampare) - if (_numcarat == 1) - stampa_totali132(); - else if (_numcarat == 2) - stampa_totali198(); - if (_stampatotiva) - stampa_totaliiva(); + if (_puoi_stampare) + if (_numcarat == 1) + stampa_totali132_II(); + else if (_numcarat == 2) + stampa_totali198_II(); + } + + int item_lista = _lista.items(); + + if (item_lista == 0) + { + int righe_rimaste = righe_rimaste_da_stampare(); + + righe_rimaste = righe_rimaste - _rw; //_rw sono le righe dei totali gia' settate, mentre + //righe rimaste conteneva le righe senza quelle dei totali gia' settate + if (righe_rimaste > 0) + { + _rw++; //incremento la riga altrimenti copro l'ultimo totale settato con una riga bianca + + TString sep = " "; + + for (int i = 0; i < righe_rimaste; i++) + set_row(_rw++,"@0g%s", (const char*) sep); } - _stampa_progressivi_si = TRUE; + } + } + +// _stampa_progressivi_si = TRUE; _prima_volta = TRUE; return REPEAT_PAGE; + } case LF_RMOV: force_setpage(); break; @@ -1153,17 +2072,26 @@ print_action TMastrini_application::postprocess_print(int file, int counter) void TMastrini_application::stampa_totaliiva() { real totale; - - if (_stampatotiva) - for (int j = 0; j < _b.items(); j++) - { - TDociva& riga = (TDociva&)_b[j]; - set_row(7+j, "@0g%s",(const char*) riga._descrdoc); - totale = riga._totdociva; - TString string = totale.string("###.###.###.###"); - set_row(7+j, " %15s", (const char*)string); - } - _b.destroy(); + + if (_nummast == 1 || _nummast == 3) + { + _rw = 7; + _ddociva_len++; + TString fmt (format("@%dg", _ddociva_len)); + fmt << "%15s"; + + if (_stampatotiva) + for (int j = 0; j < _b.items(); j++) + { + TDociva& riga = (TDociva&)_b[j]; + set_row(_rw+j, "@0g%s",(const char*) riga._descrdoc); + totale = riga._totdociva; + TString string = totale.string("###.###.###.###"); + set_row(_rw+j, fmt, (const char*)string); + } + + _b.destroy(); + } } // Ricerca della descrizione relativa al codice causale di MOV.dta @@ -1231,6 +2159,8 @@ bool TMastrini_application::preprocess_print(int file, int counter) _saldo_movimenti = ZERO; _saldo_progressivi = ZERO; _saldo_progre_prec = ZERO; + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; _protiva = 0; _prima_volta = TRUE; @@ -1244,7 +2174,6 @@ bool TMastrini_application::preprocess_print(int file, int counter) bool TMastrini_application::set_print(int) { KEY tasto; - int crt; TLocalisamfile* fl; TString data1,data2; @@ -1272,7 +2201,7 @@ bool TMastrini_application::set_print(int) _tipostampa = atoi(_msk->get(F_TIPOSTAMPA)); _numcarat = atoi(_msk->get(F_NUMCARAT)); int formato = atoi(_msk->get(F_FORMATO)); - int nummast = atoi(_msk->get(F_NUMMAST)); + _nummast = atoi(_msk->get(F_NUMMAST)); _codice_ditta = get_firm(); ricerca_dati_ditta(); @@ -1287,12 +2216,12 @@ bool TMastrini_application::set_print(int) // Scelta del formato e del numero di mastrini per pagina 1 o 2 - if (nummast == 1) - crt = formato; - else - crt = (formato / 2); + //if (nummast == 1) + // crt = formato; + //else + // crt = (formato / 2); - printer().formlen(crt); + //printer().formlen(crt); //Crea il cursore su gruppo, conto e sottoconto del file RMOV @@ -1321,6 +2250,18 @@ bool TMastrini_application::set_print(int) if (_stampatotiva) _b.destroy(); + _inizio_stampa = TRUE; + _numero_pag = 1; + _pagina = 1; + _cambia_mastrino = FALSE; + _rw = 0; + _conta_mastrini = 0; + _indice_lista = 0; + _ddociva_len = 0; + + _riga.destroy(); + _lista.destroy(); + switch (_tipostampa) { case 1: _totale_saldo = 1; @@ -1355,18 +2296,21 @@ void TMastrini_application::data_fine_esercizio(int anno) } void TMastrini_application::preprocess_header() -{ - if (_tipostampa == 3) - crea_intestazione(); - else - if (_tipostampa == 2) - { - if ((_totale_saldo != 0) && (_puoi_stampare)) - crea_intestazione(); - } - else if (_tipostampa == 1) - if (_puoi_stampare) - crea_intestazione(); +{ + if (_nummast == 1) + { + if (_tipostampa == 3) + crea_intestazione(); + else + if (_tipostampa == 2) + { + if ((_totale_saldo != 0) && (_puoi_stampare)) + crea_intestazione(); + } + else if (_tipostampa == 1) + if (_puoi_stampare) + crea_intestazione(); + } } void TMastrini_application::conto(int gruppo, int conto, bool no_contropartita) @@ -1434,10 +2378,16 @@ void TMastrini_application::crea_intestazione() TString sep(132),sep1(198); reset_header(); - + + if (_cambia_mastrino) + { + _pagina = 1; + _cambia_mastrino = FALSE; + } + if (_numcarat == 1) { - sep << "Pag. @#"; + sep << "Pag. " << _pagina; sep.right_just(132); set_header(1,(const char*) sep); sep =""; @@ -1446,14 +2396,16 @@ void TMastrini_application::crea_intestazione() } else if (_numcarat == 2) { - sep1 << "Pagina @#"; + sep1 << "Pagina " << _pagina; sep1.right_just(198); set_header(1,(const char*) sep1); sep1 =""; set_header(2,"@1g%s",(const char*) sep1); //set_header(1,"@190gPagina %2d", _numero_pag++); } - + + _pagina++; + set_header (1, "@0gDITTA@6g%5ld", _codice_ditta); set_header (1, "@12g%-.45s", (const char*) _ragsoc); set_header (1, "@59g%-.25s", (const char*) _indulc); @@ -1506,22 +2458,90 @@ void TMastrini_application::crea_intestazione() set_header (8,"@23gDocumento@42gCod.Causale@70gDescrizione@113gDare@129gAvere@136gSaldo progress.@156gSaldo movim.@172gPartita@182gIva@186gProtocollo@197gC"); sep1.fill('-'); set_header (9,"@1g%s", (const char *) sep1); - } + } + + calcola_progressivi(); + _saldo_progressivi += _saldo_progre_prec; + + if (_stampa_progressivi_si) + { + if (_numcarat == 1) + { + TString string = _saldo_progre_prec.string("###.###.###.###"); + set_header (10,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); + string = _progredare.string("###.###.###.###"); + set_header (10,"@85g%15s",(const char*) string); + string = _progreavere.string("###.###.###.###"); + set_header (10,"@101g%15s",(const char*) string); + } + if (_numcarat == 2) + { + TString string = _progredare.string("###.###.###.###"); + set_header (10,"@70gPROGRESSIVI PRECEDENTI@102g%15s",(const char*)string); + string = _progreavere.string("###.###.###.###"); + set_header (10,"@119g%15s",(const char*) string); + string = _saldo_progre_prec.string("###.###.###.###"); + set_header (10,"@136g%15s",(const char*) string); + } + _riporto_dare = _progredare; + _riporto_avere = _progreavere; + _stampa_progressivi_si = FALSE; + } + else + { + _riporto_dare += _riporto_parziale_dare; + _riporto_avere += _riporto_parziale_avere; + if (_numcarat == 1) + { + TString string = _riporto_dare.string("###.###.###.###"); + set_header (10,"@32gA RIPORTO@85g%15s",(const char*) string); + string = _riporto_avere.string("###.###.###.###"); + set_header (10,"@101g%15s",(const char*) string); + } + if (_numcarat == 2) + { + TString string = _riporto_dare.string("###.###.###.###"); + set_header (10,"@32gA RIPORTO@102g%15s",(const char*) string); + string = _riporto_avere.string("###.###.###.###"); + set_header (10,"@119g%15s",(const char*) string); + } + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + } + if (_numcarat == 1) + { + sep =""; + set_header(11,"@1g%s",(const char*) sep); + } + else if (_numcarat == 2) + { + sep1 =""; + set_header(11,"@1g%s",(const char*) sep1); + } } -void TMastrini_application::crea_intestazione(int start_riga) +int TMastrini_application::crea_intestazione(int start_riga) { TString sep(132),sep1(198); - int r = start_riga; + int r = start_riga + 2; reset_header(); - + + _conta_mastrini++; + + if (_nummast == 2) + if (_cambia_mastrino) + { + _numero_pag = 1; + _cambia_mastrino = FALSE; + } + if (_numcarat == 1) - set_header(1,"@126gPag. %2d", _numero_pag++); + set_row(r,"@126gPag. %2d", _numero_pag++); else if (_numcarat == 2) - set_header(1,"@190gPagina %2d", _numero_pag++); + set_row(r,"@190gPagina %2d", _numero_pag++); - set_header (r, "@0gDITTA@6g%5ld", _codice_ditta); + set_row (r, "@0gDITTA@6g%5ld", _codice_ditta); set_row (r, "@12g%-45s", (const char*) _ragsoc); set_row (r, "@59g%-25s", (const char*) _indulc); set_row (r, "@86g%-9s", (const char*) _civulc); @@ -1541,45 +2561,53 @@ void TMastrini_application::crea_intestazione(int start_riga) _tipo_mask = 3; switch (_tipo_mask) { - case 1: ricerca_clifo(r); + case 1: r = ricerca_clifo(r); break; - case 2: ricerca_clifo(r); + case 2: r = ricerca_clifo(r); break; - case 3: ricerca_gruppo(r); + case 3: r = ricerca_gruppo(r); break; default: break; } - + + r++; + if (_numcarat == 1) { sep.fill('-'); //Stampa 132 - (sep(132)) - set_row (6, (const char *) sep); - set_row (7,"Operazione@19gDocumento@117gContro@131gA"); - set_row (8,"Data"); - if (_stampanum < 3) - set_row (8,"@11gnumero"); - set_row (8,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@96gDare@111gAvere@117gPartita@131gC"); + set_row (r++,"@1g%s", (const char *) sep); + set_row (r++,"Operazione@19gDocumento@117gContro@131gA"); + set_row (r,"Data"); + if (_stampanum < 3) + set_row (r,"@11gnumero"); + set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@96gDare@111gAvere@117gPartita@131gC"); sep.fill('-'); - set_row (9, (const char *) sep); + set_row (r++,"@1g%s", (const char *) sep); } else if (_numcarat == 2) { sep1.fill('-'); //Stampa 198 - (sep1(198)) - set_row (6,"@1g%s", (const char *) sep1); - set_row (7,"Operazione@23gData@34gNumero@172gContro@182gReg@190gNumero@197gA"); - set_row (8,"Data"); - if (_stampanum < 3) - set_row (8,"@11gnumero"); - set_row (8,"@23gDocumento@42gCod.Causale@70gDescrizione@113gDare@129gAvere@136gSaldo progress.@156gSaldo movim.@172gPartita@182gIva@186gProtocollo@197gC"); + set_row (r++,"@1g%s", (const char *) sep1); + set_row (r++,"Operazione@23gData@34gNumero@172gContro@182gReg@190gNumero@197gA"); + set_row (r,"Data"); + if (_stampanum < 3) + set_row (r,"@11gnumero"); + set_row (r,"@23gDocumento@42gCod.Causale@70gDescrizione@113gDare@129gAvere"); + set_row (r++,"@136gSaldo progress.@156gSaldo movim.@172gPartita@182gIva@186gProtocollo@197gC"); sep1.fill('-'); - set_row (9,"@1g%s", (const char *) sep1); - } + set_row (r++,"@1g%s", (const char *) sep1); + } + + return r; } void TMastrini_application::stampa_progre_riporto() { TString sep(132),sep1(198); - + + if (_nummast == 1 || _nummast == 3) + _rw = 1; + if (_stampa_progressivi_si) { stampa_progressivi(); @@ -1594,31 +2622,77 @@ void TMastrini_application::stampa_progre_riporto() if (_numcarat == 1) { TString string = _riporto_dare.string("###.###.###.###"); - set_row (1,"@32gA RIPORTO@85g%15s",(const char*) string); + set_row (_rw,"@32gA RIPORTO@85g%15s",(const char*) string); string = _riporto_avere.string("###.###.###.###"); - set_row (1,"@101g%15s",(const char*) string); + set_row (_rw++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { TString string = _riporto_dare.string("###.###.###.###"); - set_row (1,"@32gA RIPORTO@102g%15s",(const char*) string); + set_row (_rw,"@32gA RIPORTO@102g%15s",(const char*) string); string = _riporto_avere.string("###.###.###.###"); - set_row (1,"@119g%15s",(const char*) string); + set_row (_rw++,"@119g%15s",(const char*) string); } - _riporto_parziale_dare = 0; - _riporto_parziale_avere = 0; + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; } if (_numcarat == 1) { sep =""; - set_row(2,"@1g%s",(const char*) sep); + set_row(_rw,"@1g%s",(const char*) sep); } else if (_numcarat == 2) { sep1 =""; - set_row(2,"@1g%s",(const char*) sep1); + set_row(_rw,"@1g%s",(const char*) sep1); } } + +int TMastrini_application::stampa_progre_riporto(int start_riga) +{ + TString sep(132),sep1(198); + int r = start_riga; + + if (_stampa_progressivi_si) + { + r = stampa_progressivi(r); + _riporto_dare = _progredare; + _riporto_avere = _progreavere; + _stampa_progressivi_si = FALSE; + } + else + { + _riporto_dare += _riporto_parziale_dare; + _riporto_avere += _riporto_parziale_avere; + if (_numcarat == 1) + { + TString string = _riporto_dare.string("###.###.###.###"); + set_row (r,"@32gA RIPORTO@85g%15s",(const char*) string); + string = _riporto_avere.string("###.###.###.###"); + set_row (r++,"@101g%15s",(const char*) string); + } + if (_numcarat == 2) + { + TString string = _riporto_dare.string("###.###.###.###"); + set_row (r,"@32gA RIPORTO@102g%15s",(const char*) string); + string = _riporto_avere.string("###.###.###.###"); + set_row (r++,"@119g%15s",(const char*) string); + } + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + } + if (_numcarat == 1) + { + sep =""; + set_row(r++,"@1g%s",(const char*) sep); + } + else if (_numcarat == 2) + { + sep1 =""; + set_row(r++,"@1g%s",(const char*) sep1); + } + return r; +} void TMastrini_application::calcola_progressivi_al() { @@ -1822,28 +2896,58 @@ void TMastrini_application::calcola_progressivi() } void TMastrini_application::stampa_progressivi() -{ +{ + if (_nummast == 1 || _nummast == 3) + _rw = 1; + if (_numcarat == 1) { TString string = _saldo_progre_prec.string("###.###.###.###"); - set_row (1,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); + set_row (_rw,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); string = _progredare.string("###.###.###.###"); - set_row (1,"@85g%15s",(const char*) string); + set_row (_rw,"@85g%15s",(const char*) string); string = _progreavere.string("###.###.###.###"); - set_row (1,"@101g%15s",(const char*) string); + set_row (_rw++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { TString string = _progredare.string("###.###.###.###"); - set_row (1,"@70gPROGRESSIVI PRECEDENTI@102g%15s",(const char*)string); + set_row (_rw,"@70gPROGRESSIVI PRECEDENTI@102g%15s",(const char*)string); string = _progreavere.string("###.###.###.###"); - set_row (1,"@119g%15s",(const char*) string); + set_row (_rw,"@119g%15s",(const char*) string); string = _saldo_progre_prec.string("###.###.###.###"); - set_row (1,"@136g%15s",(const char*) string); + set_row (_rw++,"@136g%15s",(const char*) string); } } +int TMastrini_application::stampa_progressivi(int start_riga) +{ + int r = start_riga; + + if (_numcarat == 1) + { + TString string = _saldo_progre_prec.string("###.###.###.###"); + set_row (r,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); + string = _progredare.string("###.###.###.###"); + set_row (r,"@85g%15s",(const char*) string); + string = _progreavere.string("###.###.###.###"); + set_row (r++,"@101g%15s",(const char*) string); + } + + if (_numcarat == 2) + { + TString string = _progredare.string("###.###.###.###"); + set_row (r,"@70gPROGRESSIVI PRECEDENTI@102g%15s",(const char*)string); + string = _progreavere.string("###.###.###.###"); + set_row (r,"@119g%15s",(const char*) string); + string = _saldo_progre_prec.string("###.###.###.###"); + set_row (r++,"@136g%15s",(const char*) string); + } + + return r; +} + // Se la ricerca selezionata nella maschera e' per clienti, oppure fornitori, // allora ricerco su CLIFO i relativi dati, e su PCON il relativo gruppo,conto,// sottoconto e IV direttiva CEE void TMastrini_application::ricerca_clifo() @@ -2181,34 +3285,34 @@ int TMastrini_application::ricerca_gruppo(int start) else descriz2 = ""; - set_row(3,"@27g%-.30s",(const char*) descrizione_gruppo()); - set_row(3,"@59g%-.30s",(const char*) descrizione_conto()); + set_row(r,"@27g%-.30s",(const char*) descrizione_gruppo()); + set_row(r,"@59g%-.30s",(const char*) descrizione_conto()); - set_row(3,"@91g%-.41s",(const char*) _descr); - set_row(4, "@0gClasse@12g%c", _lettivd); - set_row(4, "@14g%-8s",(const char*) _numrivd); + set_row(r++,"@91g%-.41s",(const char*) _descr); + set_row(r, "@0gClasse@12g%c", _lettivd); + set_row(r, "@14g%-8s",(const char*) _numrivd); if (_numivd != 0) - set_row(4, "@23g%d", _numivd); + set_row(r, "@23g%d", _numivd); if (descriz2 != "") { - set_row(4,"@27g%-50s",(const char*) descriz2); - set_row(4,"@80g%-50s",(const char*) descriz); + set_row(r,"@27g%-50s",(const char*) descriz2); + set_row(r++,"@80g%-50s",(const char*) descriz); } else - set_row(4,"@27g%-50s",(const char*) descriz); + set_row(r++,"@27g%-50s",(const char*) descriz); dataini = _data_ini.string(); datafine = _data_fine.string(); if (_annomsk == 0) { - set_row (5, "Periodo@12g%s", (const char*) dataini); - set_row (5, "@24g%s", (const char*) datafine); + set_row (r, "Periodo@12g%s", (const char*) dataini); + set_row (r, "@24g%s", (const char*) datafine); } else { - set_row (5, "Periodo di competenza@23g%s", (const char*) dataini); - set_row (5, "@35g%s", (const char*) datafine); + set_row (r, "Periodo di competenza@23g%s", (const char*) dataini); + set_row (r, "@35g%s", (const char*) datafine); } return r; } @@ -2302,7 +3406,6 @@ bool TMastrini_application::user_create() _d18 = new TParagraph_string ("",18); _d23 = new TParagraph_string ("",23); _d30 = new TParagraph_string ("",30); - _msk = new TMask("cg3200a"); _msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); @@ -2313,17 +3416,17 @@ bool TMastrini_application::user_create() _msk->set_handler(F_SOTTOCFINE_FORN, sottoc_handler_fine); _msk->set_handler (F_GRUPPOFINE ,gruppo_hnd); - _msk->set_handler (F_CONTOFINE_CONTO ,conto_hnd); - _msk->set_handler (F_CONTOFINE_CLIENTE ,conto_hnd); - _msk->set_handler (F_CONTOFINE_FORN ,conto_hnd); + _msk->set_handler (F_CONTOINI_CONTO ,contoi_hnd); + _msk->set_handler (F_CONTOINI_CLIENTE ,contoi_hnd); + _msk->set_handler (F_CONTOINI_FORN ,contoi_hnd); + _msk->set_handler (F_CONTOFINE_CONTO ,contof_hnd); + _msk->set_handler (F_CONTOFINE_CLIENTE ,contof_hnd); + _msk->set_handler (F_CONTOFINE_FORN ,contof_hnd); // _msk->set_handler (F_SOTTOCFINE_CONTO ,sottoc_hnd); // _msk->set_handler (F_SOTTOCFINE_CLIENTE ,sottoc_hnd); // _msk->set_handler (F_SOTTOCFINE_FORN ,sottoc_hnd); - _inizio_stampa = TRUE; - _numero_pag = 1; - return TRUE; } diff --git a/cg/cg3200a.uml b/cg/cg3200a.uml index 05b04f993..a289a3118 100755 --- a/cg/cg3200a.uml +++ b/cg/cg3200a.uml @@ -498,9 +498,10 @@ BEGIN HELP "Indicare se riproporre le scelte effettuate" END -BUTTON DLG_OK 9 2 +BUTTON DLG_PRINT 9 2 BEGIN - PROMPT -12 -1 "" + PROMPT -12 -1 "~Stampa" + MESSAGE EXIT,K_ENTER END BUTTON DLG_QUIT 9 2