From c31c8952d449055f6e35666517f457873f405faf Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 9 Jan 1997 11:49:36 +0000 Subject: [PATCH] cg21cg.uml Aggiunta tabella centro di costo allo sheet contabile cg3200.cpp Aggiunta funzione di memorizzazione scelte di stampa cg3200.h Cambuiati gli identificatori di tutti i campi cg3200a.uml Aggiunto spreadsheet delle scelte di stampa git-svn-id: svn://10.65.10.50/trunk@4044 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg21cg.uml | 6 + cg/cg3200.cpp | 8024 ++++++++++++++++++++++++------------------------ cg/cg3200.h | 73 +- cg/cg3200a.uml | 1475 +++++---- 4 files changed, 5023 insertions(+), 4555 deletions(-) diff --git a/cg/cg21cg.uml b/cg/cg21cg.uml index af4c8cd16..7124632e3 100755 --- a/cg/cg21cg.uml +++ b/cg/cg21cg.uml @@ -340,6 +340,12 @@ END NUMBER 115 7 BEGIN PROMPT 2 13 "******* " + USE CDC + INPUT CODTAB 115 + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT 115 CODTAB + CHECKTYPE NORMAL END LIST CG_ROWTYPE 24 diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index 8333f1b7d..3a8c9768b 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -1,3988 +1,4036 @@ -//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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cg3.h" -#include "cg3200.h" -#include "cglib.h" -#include "cglib04.h" -#include "cglib03.h" - -bool sottoc_handler_ini (TMask_field& f, KEY k); -bool sottoc_handler_fine (TMask_field& f, KEY k); - -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 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); - - TDociva_array _b; - TRelation* _rel; - TMask* _msk; - TTable* _tabivd, * _tabtpd, * _tabreg, * _tabesc; - TLocalisamfile* _mov; - TLocalisamfile* _nditte; - TLocalisamfile* _unloc; - TLocalisamfile* _comuni; - TLocalisamfile* _clifo; - 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; - int _cur1,_gruppo,_conto,_numcarat,_stampanum,_numivd,_annoiva; - int _numrig,_natdoc,_tipo,_tipostampa,_g_prec,_c_prec,_numrivd_int; - real _progredare,_progreavere,_totprogre_dare_al,_totprogre_avere_al; - real _totprogre_dare,_totprogre_avere,_importo; - real _riporto_dare,_riporto_avere,_riporto_parziale_dare,_riporto_parziale_avere; - real _totale_periodo_dare,_totale_periodo_avere,_totale_prima_dare,_totale_prima_avere; - real _saldo_periodo,_saldo_progre,_saldo_progre_al,_saldo_progre_prec; - real _saldo_movimenti,_saldo_progressivi,_totale_saldo,_riporto_footer_dare,_riporto_footer_avere; - TString _ragsoc,_indulc,_civulc,_capulc,_com,_prov,_comulc; - long _codice_ditta,_s_prec; - TString _tipodoc,_codcaus,_descrcaus,_descrdociva,_regiva,_g_contr,_c_contr,_s_contr; - char _sezivd,_lettivd; - TString _descrizione,_sezione,_numdoc,_descrizionemov,_numrivd,_descr; - TString _dataregs, _datadocs; - int _gruppocontr,_contocontr,_nummast,_pagina; - long _sottocontocontr; - - bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov; - bool _stampato,_devi_stampare_footer; - - 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,_stampa_footer_si; - bool _cambia_mastrino,_gia_stampata_intestazione; - char _tmcf,_tipo_contr; - - TDate _dataregrmov; - 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(); - virtual bool set_print(int m); - - virtual bool preprocess_print(int file, int counter); - virtual bool preprocess_page (int,int); - virtual print_action postprocess_page (int,int); - virtual print_action postprocess_print(int,int); - virtual void preprocess_header(); - virtual void preprocess_footer(); - virtual void set_page(int,int); - virtual void process_link(int id, const char* txt); - -public: - TDate _inizioEs,_fineEs; - - int date2esc(const TDate& d, int* prevesc = NULL); - void ricerca_clifo(); - void ricerca_gruppo(); - int ricerca_clifo(int riga); - int ricerca_gruppo(int riga); - - 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(); - int crea_intestazione(int riga); - void crea_intestazione(); - void fai_stampa132(); - void fai_stampa198(); - void stampa_totali132(); - 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); - const char* descrizione_gruppo(); - const char* descrizione_conto(); - const char* descrizione_sottoconto(); - const char* descrizione_classe(char,char,int,int); - bool almeno_un_record(); - 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"; - TToken_string ss(10); - ss.add("1"); - ss.add(txt); - - TMessage fs(cmd2name(app), MSG_LN, ss); - fs.send(); - - TExternal_app pn(app); - pn.run(); -} - -bool sottoc_handler_ini(TMask_field& f, KEY key) -{ - const short id = f.dlg(); - 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 ) - { - if (sottoconto != 0 && conto == 0) - return f.warning_box("Manca il CONTO"); - - if (conto != 0 && gruppo == 0) - return f.warning_box("Manca il GRUPPO"); - } - - if ( key == K_TAB && f.mask().is_running()) - { - if (id == F_SOTTOCINI_CONTO) - { - pconti.zero(); - pconti.put(PCN_GRUPPO, gruppo) ; - pconti.put(PCN_CONTO, conto); - pconti.put(PCN_SOTTOCONTO, sottoconto); - 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_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"); - } - else - if (id == F_SOTTOCINI_CLIENTE || id == F_SOTTOCINI_FORN) - { - char tipo = id == F_SOTTOCINI_CLIENTE ? 'C' : 'F'; - TLocalisamfile clifo (LF_CLIFO); - if (sottoconto != 0) - { - 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_DESCRINI_CLIENTE, rs); - f.mask().set(F_DESCRINI_FORN, rs); - - if (warning) - return f.warning_box("Anagrafica inesistente"); - } - } - } - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// Inizio modifica del 02-05-95 riguardo controlli di validita' su gruppo, // -// conto e sottoconto iniziale e finale. // -///////////////////////////////////////////////////////////////////////////// - -bool sottoc_handler_fine(TMask_field& f, KEY key) -{ - const short id = f.dlg(); - int conto; - TString ds; - 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 ) - { - if (sottoconto != 0 && conto == 0) - return f.warning_box("Manca il CONTO"); - - if (conto != 0 && gruppo == 0) - return f.warning_box("Manca il GRUPPO"); - - if (!app().check_ordine(f,key)) - return FALSE; - } - - if ( key == K_TAB && f.mask().is_running()) - { - if (id == F_SOTTOCFINE_CONTO) - { - pconti.zero(); - pconti.put(PCN_GRUPPO, gruppo) ; - pconti.put(PCN_CONTO, conto); - pconti.put(PCN_SOTTOCONTO, sottoconto); - 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"); - } - else - if (id == F_SOTTOCFINE_CLIENTE || id == F_SOTTOCFINE_FORN) - { - char tipo = id == F_SOTTOCFINE_CLIENTE ? 'C' : 'F'; - TLocalisamfile clifo (LF_CLIFO); - if (sottoconto != 0) - { - 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); - - if (gruppof == 0) - return TRUE; - - int gruppoi = f.mask().get_int(F_GRUPPOINI); - - if (gruppoi > gruppof) - return f.error_box("Il gruppo di partenza deve essere inferiore o uguale al gruppo di arrivo"); - } - - return TRUE; -} - -bool TMastrini_application::contoi_hnd (TMask_field& f, KEY k) -{ - TLocalisamfile pconti (LF_PCON); - TString ds; - - const short id = f.dlg(); - - if (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); - - if (gruppof == 0) - return TRUE; - - int gruppoi = f.mask().get_int(F_GRUPPOINI); - - if (gruppoi < gruppof) - return TRUE; - - 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_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; -} - -///////////////////////////////////////////////////////////////////////////// -// FINE MODIFICA DEL 02-05-95 // -///////////////////////////////////////////////////////////////////////////// - -bool TMastrini_application::check_ordine(TMask_field& f, KEY k) -{ - int gruppof = f.mask().get_int(F_GRUPPOFINE); - - if (gruppof == 0) - return TRUE; - - int gruppoi = f.mask().get_int(F_GRUPPOINI); - - if (gruppoi < gruppof) - return TRUE; - - int contof = f.mask().get_int(F_CONTOFINE_CONTO); - int contoi = f.mask().get_int(F_CONTOINI_CONTO); - - if (contoi < contof) - return TRUE; - - 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"); - - return TRUE; -} - -int TMastrini_application::date2esc(const TDate& d, int* prevesc) -{ - if (prevesc) *prevesc = 0; - TTable esc("ESC"); - for (int err = esc.first(); err == NOERR; err = esc.next()) - { - const TDate ia(esc.get("D0")); // Data inizio esercizio - const TDate fa(esc.get("D1")); // Data fine esercizio - app()._inizioEs = ia; - app()._fineEs = fa; - const anno = esc.get_int("CODTAB"); - if (d >= ia && d <= fa) - return anno; - if (prevesc) *prevesc = anno; - } - return 0; -} - -//Questa funzione restituisce vero se il record su piano dei conti ha almeno un -//record figlio (e che soddisfa la condizione riguardante la data di registr.). -//Viene successivamente utilizzata per stampare l'intestazione (e i totali) -//oppure no - -bool TMastrini_application::almeno_un_record() -{ - bool trovato=FALSE; - long record,sottoc; - int gruppo,conto; - TDate datareg, datacomp; - TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); - - if (current_cursor()->is_first_match(LF_RMOV)) - { - record = rmov.recno(); - rmov.zero(); - rmov.put(RMV_GRUPPO, _gruppo); - rmov.put(RMV_CONTO, _conto); - rmov.put(RMV_SOTTOCONTO, _sottoc); - for (rmov.read(); !rmov.eof() ;rmov.next()) - { - int annoes = rmov.get_int (RMV_ANNOES); - long numreg = rmov.get_long(RMV_NUMREG); - - _mov->setkey(1); - _mov->curr().zero(); - _mov->curr().put(MOV_NUMREG,numreg); - _mov->read(); - if (_mov->bad()) - _mov->zero(); - datacomp = (_mov->curr().get(MOV_DATACOMP)); - TString provvis (_mov->curr().get(MOV_PROVVIS)); - - if (_annomsk == 0) - datareg = rmov.get_date(RMV_DATAREG); - else - if (_annomsk != 0) - datareg = datacomp; - - gruppo = rmov.get_int(RMV_GRUPPO); - conto = rmov.get_int(RMV_CONTO); - sottoc = rmov.get_long(RMV_SOTTOCONTO); - if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) - break; - else - if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.trim().empty())) - { - trovato = TRUE; - break; - } - } - rmov.readat(record); - } - return trovato; -} - -bool TMastrini_application::data_inizio(TMask_field& f, KEY k) -{ - int anno; - TDate data; - - anno = f.mask().get_int(F_ANNO); - data = f.mask().get (F_DATAINI); - app()._annomsk = anno; - - if (k == K_ENTER) - { - if (anno != 0) - { - app().data_fine_esercizio(anno); - - if (data == botime) - app()._data_ini = app()._data_inizioese; - else - if (data < app()._data_inizioese || data > app()._data_finese) - { - f.error_box("La data non appartiene all'esercizio indicato"); - return FALSE; - } - else - app()._data_ini = data; - } - else - if (anno == 0) - { - if (data == botime) - { - f.error_box("La data deve essere obbligatoriamente indicata"); - return FALSE; - } - else - app()._data_ini = data; - } - } - return TRUE; -} - -bool TMastrini_application::data_fine(TMask_field& f, KEY k) -{ - int annoes; - TDate data, data_ini; - - annoes = f.mask().get_int(F_ANNO); - data = f.mask().get (F_DATAFINE); - data_ini = f.mask().get (F_DATAINI); - app()._annomsk = annoes; - - if (k == K_ENTER) - { - if (annoes != 0) - { - app().data_fine_esercizio(annoes); - - if (data == botime) - app()._data_fine = app()._data_finese; - else - if (data < app()._data_inizioese || data > app()._data_finese) - { - f.error_box("La data non appartiene all'esercizio indicato"); - return FALSE; - } - else - app()._data_fine = data; - } - else - if (annoes == 0) - { - if (data == botime) - { - f.error_box("La data deve essere obbligatoriamente indicata"); - return FALSE; - } - - app()._anno_ghost = app().date2esc(data_ini); - - app()._inizioes = app()._inizioEs; - - if (data < app()._inizioEs || data > app()._fineEs) - { - f.error_box("La data non appartiene all'esercizio indicato"); - return FALSE; - } - else - app()._data_fine = data; - } - - if (data < data_ini) - { - f.error_box("La data finale non puo' essere inferiore alla data di partenza"); - return FALSE; - } - - - } - return TRUE; -} - -void TMastrini_application::saldi_zero() -{ - TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); - real saldo_dare, saldo_avere; - long record; - - saldo_dare = saldo_avere = 0; - - if (current_cursor()->is_first_match(LF_RMOV)) - { - record = rmov.recno(); - - while (!rmov.eof()) - { - long numreg = rmov.get_long(RMV_NUMREG); - _mov->setkey(1); - _mov->curr().zero(); - _mov->curr().put(MOV_NUMREG,numreg); - _mov->read(); - if (_mov->bad()) - _mov->zero(); - TString provvis (_mov->curr().get(MOV_PROVVIS)); - int gruppo = atoi(rmov.get(RMV_GRUPPO)); - int conto = atoi(rmov.get(RMV_CONTO)); - long sottoc = atol(rmov.get(RMV_SOTTOCONTO)); - - if ((gruppo == _gruppo)&&(conto == _conto)&&(sottoc == _sottoc)) - { - if (_stampa_mov_prov || provvis.trim().empty()) - { - char sezione = rmov.curr().get(RMV_SEZIONE)[0]; - real importo = rmov.curr().get_real(RMV_IMPORTO); - if (sezione == 'D') - saldo_dare += importo; - else if (sezione == 'A') - saldo_avere += importo; - } - } - else break; - rmov.next(); - } - rmov.readat(record); - } - _totale_saldo = saldo_dare - saldo_avere; -} - -void TMastrini_application::fai_stampa132() -{ - 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); - - if (_item != 0) - { - 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; - - if (_item != 0) - _riga.destroy(); - } - - set_row (_rw,"@0g#t", &_dataregs); - if (_stampanum == 1) - set_row (_rw,"@11g$[r]#7d$[n]", &_numreg); - else - if (_stampanum == 2) - { - set_row (_rw,"@11g#7d", &_numgio); - } - - set_row (_rw,"@19g#t", &_datadocs); - set_row (_rw,"@30g#7t", &_numdoc); - set_row (_rw,"@38g#3t", &_codcaus); - - 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() -{ - 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); - - if (_item != 0) - { - 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; - - if (_item != 0) - _riga.destroy(); - } - - set_row (_rw,"@0g#t", &_dataregs); - if (_stampanum == 1) - { - set_row (_rw,"@11g$[r]#7d$[n]", &_numreg); - set_row (_rw,"@18g/#3d", &_numrig); - } - else if (_stampanum == 2) - set_row (_rw,"@11g#7d", &_numgio); - - set_row (_rw,"@23g#t", &_datadocs); - set_row (_rw,"@34g#7t", &_numdoc); - set_row (_rw,"@42g#3t", &_codcaus); - -// Stampa saldo movimenti - - set_row (_rw,"@149g#t", &_saldo_movimenti_str); - - set_row (_rw,"@165g#3t", &_g_contr); - set_row (_rw,"@169g#3t", &_c_contr); - set_row (_rw,"@173g#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(_rw++,"@0g%s", (const char *) sep); - - _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; - TString string = _saldo_periodo.string("###.###.###.###"); - set_row (_rw,"@32gTOTALI PERIODO@69g%15s", (const char*)string); - string = _totale_periodo_dare.string("###.###.###.###"); - set_row (_rw,"@85g%15s", (const char*)string); - string = _totale_periodo_avere.string("###.###.###.###"); - set_row (_rw++,"@101g%15s", (const char*)string); - string = _saldo_progre.string("###.###.###.###"); - set_row (_rw,"@32gTOTALI PROGRESSIVI@69g%15s", (const char*)string); - string = _totprogre_dare.string("###.###.###.###"); - set_row (_rw,"@85g%15s", (const char*)string); - string = _totprogre_avere.string("###.###.###.###"); - set_row (_rw++,"@101g%15s", (const char*)string); - if (_stampaprogre) //Progressivi attuali - { - TString str = _saldo_progre_al.string("###.###.###.###"); - 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 (_rw,"@85g%15s", (const char*)str); - str = _totprogre_avere_al.string("###.###.###.###"); - set_row (_rw,"@101g%15s", (const char*)str); - } - _devi_stampare_footer = FALSE; -} - -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(); - - _devi_stampare_footer = FALSE; -} - -void TMastrini_application::stampa_totali198() -{ - TString sep(198); - - if (_nummast == 1 || _nummast == 3) - _rw = 1; - - sep.fill('-'); //Stampa 198 - (sep(198)) - 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 (_rw,"@32gTOTALI PERIODO@101g%15s", (const char*)string); - string = _totale_periodo_avere.string("###.###.###.###"); - set_row (_rw,"@117g%15s", (const char*)string); - string = _saldo_movimenti.string("###.###.###.###"); - set_row (_rw++,"@149g%15s", (const char*)string); - string = _totprogre_dare.string("###.###.###.###"); - set_row (_rw,"@32gTOTALI PROGRESSIVI@101g%15s",(const char*)string); - string = _totprogre_avere.string("###.###.###.###"); - set_row (_rw,"@117g%15s", (const char*)string); - string = _saldo_progressivi.string("###.###.###.###"); - set_row (_rw++,"@133g%15s", (const char*)string); - if (_stampaprogre) //Progressivi attuali - { - set_row(_rw,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); - TString str = _totprogre_dare_al.string("###.###.###.###"); - set_row (_rw,"@101g%15s", (const char*)str); - str = _totprogre_avere_al.string("###.###.###.###"); - set_row (_rw,"@117g%15s", (const char*)str); - str = _saldo_progressivi.string("###.###.###.###"); - set_row (_rw,"@133g%15s", (const char*)str); - } - _devi_stampare_footer = FALSE; -} - -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@101g%15s@117g%15s@149g%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@101g%15s@117g%15s@133g%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@101g%15s@117g%15s@133g%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(); - - _devi_stampare_footer = FALSE; -} - -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; - TString datasuccstring,dataregrmovstring; - int gruppof,contof; - long sottocf; - TString provvis = ""; - int annoes; - - if (counter) - return TRUE; - - switch (file) - { - case LF_SALDI: - -// Usati in crea_intestazione() - - _devi_stampare_footer = TRUE; - - 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); - - if (annoes != _anno_corrente && annoes != _anno_precedente) - return FALSE; - - if (_g_prec == _gruppo && _c_prec == _conto && _s_prec == _sottoc) - return FALSE; - - _g_prec = _gruppo; - _c_prec = _conto; - _s_prec = _sottoc; - - _saldo_periodo = ZERO; - _totale_periodo_dare = ZERO; - _totale_periodo_avere = ZERO; - _saldo_progre = ZERO; - _totprogre_dare = ZERO; - _totprogre_avere = ZERO; - _saldo_progre_al = ZERO; - _totprogre_dare_al = ZERO; - _totprogre_avere_al = ZERO; - _progredare = ZERO; - _progreavere = ZERO; - _totale_prima_dare = ZERO; - _totale_prima_avere = ZERO; - _saldo_movimenti = ZERO; - _saldo_progressivi = ZERO; - _saldo_progre_prec = ZERO; - if (_tipostampa == 2) - saldi_zero(); - else - _totale_saldo = 1; - - if ((_tipostampa == 1) || (_tipostampa == 2)) - { - if ((almeno_un_record()) && (_totale_saldo != 0)) - { - _puoi_stampare = TRUE; - - if (_nummast == 3 || _nummast == 2) - { - int cur_row = printer().formlen() - printer().rows_left(); - int diff = printer().formlen() - cur_row; - if (diff <= 13 && diff != 0) - printer().formfeed(); - - _rw = crea_intestazione(_rw); - calcola_progressivi(); - _saldo_progressivi += _saldo_progre_prec; - _rw = stampa_progre_riporto(_rw); - } - } - else - { - _puoi_stampare = FALSE; - return FALSE; - } - } - else - if (_tipostampa == 3) - { - if (_nummast == 2 || _nummast == 3) - calcola_progressivi(); - if (_progredare == ZERO && _progreavere == ZERO && !almeno_un_record()) - { - _puoi_stampare = FALSE; - return FALSE; - } - else - { - _puoi_stampare = TRUE; - - if (_nummast == 3 || _nummast == 2) - { - int cur_row = printer().formlen() - printer().rows_left(); - int diff = printer().formlen() - cur_row; - if (diff <= 13 && diff != 0) - printer().formfeed(); - - _rw = crea_intestazione(_rw); - _saldo_progressivi += _saldo_progre_prec; - _rw = stampa_progre_riporto(_rw); - } - } - } - break; - - case LF_RMOV: - { - //Il flag _gia_stampata_intestazione serve nella stampa in continuo, xche' - //sono costretto a richiamare l'intestazione sia nella preprocess_page (per - //i mastrini con intestazione a meta' pagina), sia nella preprocess_header - //per i mastrini che si trovano a cavallo fra una pagina e quella successiva. - //In quest'ultimo caso infatti quando vado a pagina nuova devo stampare l'intestazione - //ma senza il flag rischio di stamparla due volte. - if (_nummast == 3) - _gia_stampata_intestazione = FALSE; - - 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)); - _numrig = atoi (current_cursor()->curr(LF_RMOV).get(RMV_NUMRIG)); - - _gruppocontr = rmov.get_int (RMV_GRUPPOC); - _contocontr = rmov.get_int (RMV_CONTOC); - _sottocontocontr = rmov.get_long(RMV_SOTTOCONTOC); - _g_contr = rmov.get(RMV_GRUPPOC); - _c_contr = rmov.get(RMV_CONTOC); - _s_contr = rmov.get(RMV_SOTTOCONTOC); - - // Stampa solo quelli che hanno anno esercizio uguale a quello specificato - // nella maschera. Se non viene specificato li stampa tutti - - _importo = current_cursor()->curr(LF_RMOV).get_real(RMV_IMPORTO); - _importo_str = _importo.string("###.###.###.###"); - _mov->setkey(1); - _mov->curr().zero(); - _mov->curr().put(MOV_NUMREG,_numreg); - _mov->read(); - if (_mov->bad()) - _mov->zero(); - _annoes = _mov->get_int(MOV_ANNOES); - _regiva = _mov->curr().get(MOV_REG); - _annoiva = _mov->curr().get_int(MOV_ANNOIVA); - - // Controlla se saldo e' diverso da 0 - - if (((_annoes == _annomsk) || (_annomsk == 0)) && (_totale_saldo != 0)) - { - _sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE); - - if (_annomsk == 0) - { - _datareg = (_mov->curr().get(MOV_DATAREG)); - _datareg_stampa = _datareg; - } - else - if (_annomsk != 0) - { - _datareg = _mov->curr().get(MOV_DATACOMP); - _datareg_stampa = _mov->curr().get(MOV_DATAREG); - } - - provvis = _mov->curr().get(MOV_PROVVIS); - - _dataregs = _datareg_stampa.string(); - - if ((_stampa_mov_prov)||((!_stampa_mov_prov)&&(provvis.trim().empty()))) - { - if ((_datareg >= _data_ini) && (_datareg <= _data_fine)) - { - // Determino l' anno di competenza dell' operazione in esame - int anno = date2esc(_datareg_stampa); - if (anno != _annoes) - if (_numcarat == 1) - set_row (_rw, "@131g*"); - else - if (_numcarat == 2) - set_row (_rw, "@197g*"); - - if (_stampa_mov_prov && provvis.trim().not_empty()) - if (_numcarat == 1) - set_row(_rw, "@129gP"); - else - if (_numcarat == 2) - set_row(_rw, "@195gP"); - - _codcaus = _mov->curr().get(MOV_CODCAUS); - _tipodoc = _mov->curr().get(MOV_TIPODOC); - if (_stampatotiva && (_tmcf == 'C' || _tmcf == 'F')) - { - if (_tipodoc != "") - { - documenti_iva(); - _b.add_riga(_descrdociva,_importo, _natdoc); - if (_descrdociva.len() > _ddociva_len) - _ddociva_len = _descrdociva.len(); - } - } - _datadoc = (_mov->curr().get(MOV_DATADOC)); - _datadocs = _datadoc.string(); - _numdoc = _mov->curr().get(MOV_NUMDOC); - descrizione_causale(); - _descrizionemov = _mov->curr().get(MOV_DESCR); - _numgio = atol(_mov->curr().get(MOV_NUMGIO)); - - _descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR); - - if (_nummast == 1 || _nummast == 3) - { - if (_numcarat == 1) // Stampa 132 caratteri - { - if (_descrizione != "") - { - *_d23 = (const char*) _descrizione; - if (_descrizionemov != "") - { - *_d18 = (const char*) _descrizionemov; - set_row(_rw, "@42g#a", _d18); - set_row(_rw, "@61g#a", _d23); - } - else if (_descrizionemov == "") - { - *_d18 = (const char*) _descrcaus; - set_row(_rw, "@42g#a", _d18); - set_row(_rw, "@61g#a", _d23); - } - } - else if (_descrizione == "") - if (_descrizionemov != "") - { - *_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); - 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 (_rw,"@42g#a", _d18); - if (descr_contr != "Sconosciuto") - { - *_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 ) - { - int app = 0; - riga = (printer().formlen() / 2); - if (printer().rows_left() == 0) - app = printer().formlen() - _rw; - else - app = printer().rows_left(); - cur_row = printer().formlen() - app; - diff = riga - cur_row; - } - else - { - riga = printer().formlen(); - cur_row = printer().formlen() - printer().rows_left(); - diff = riga - cur_row; - } - - bool stampa_riporti; - - int lim = 0; - if (_item >= diff) - { - lim = diff - 1; - stampa_riporti = TRUE; - } - else - { - lim = _item; - stampa_riporti = FALSE; - } - - _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++; - } - if (stampa_riporti) - { - _rw = k; - if (lim == 0) - { - if (_numcarat == 1) - { - TString app (132); - app.spaces(); - set_row (_rw, "@0g%s", (const char*) app); - } - else - { - TString app (198); - app.spaces(); - set_row (_rw, "@0g%s", (const char*) app); - } - } - real dep_dare,dep_avere; - if (_stampa_footer_si) - { - _riporto_footer_dare = _progredare + _riporto_parziale_dare; - _riporto_footer_avere = _progreavere + _riporto_parziale_avere; - - real imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - if (lim != 0) - { - _riporto_footer_dare += imp_d; - _riporto_footer_avere += imp_a; - } - dep_dare = _riporto_footer_dare; - dep_avere = _riporto_footer_avere; - - _stampa_footer_si = FALSE; - } - else - { - _riporto_footer_dare += _riporto_parziale_dare; - _riporto_footer_avere += _riporto_parziale_avere; - - real imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - if (lim != 0) - { - _riporto_footer_dare += imp_d; - _riporto_footer_avere += imp_a; - } - dep_dare = _riporto_footer_dare; - dep_avere = _riporto_footer_avere; - } - - if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) - { - TString dare (dep_dare.string("###.###.###.###")); - TString avere (dep_avere.string("###.###.###.###")); - if (_numcarat == 1) - { - set_row (_rw,"@32gA RIPORTO@85g%s", (const char*) dare); - set_row (_rw,"@101g%s", (const char*) avere); - } - else - if (_numcarat == 2) - { - set_row (_rw,"@32gA RIPORTO@101g%s", (const char*) dare); - set_row (_rw,"@117g%s", (const char*) avere); - } - } - if (lim == 0) - { - rmov.prev(); - _riga.destroy(); - _item = 0; - return TRUE; - } - _rw--; -// return TRUE; - } - //_riga.destroy(); - } //if (_nummast == 2) - - if (_sezione == "D") - { - _totale_periodo_dare += _importo; - _riporto_parziale_dare += _importo; - - if (_numcarat == 1) // Stampa 132 caratteri - set_row (_rw,"@85g%s", (const char*) _importo_str); - else - if (_numcarat == 2) // Stampa 198 caratteri - { - _saldo_progressivi += _importo; - _saldo_movimenti += _importo; - set_row (_rw,"@101g%s", (const char*) _importo_str); - } - } - else if (_sezione == "A") - { - _totale_periodo_avere += _importo; - _riporto_parziale_avere += _importo; - - if (_numcarat == 1) // Stampa 132 caratteri - set_row (_rw,"@101g%s", (const char*) _importo_str); - else - if (_numcarat == 2) // Stampa 198 caratteri - { - _saldo_progressivi -= _importo; - _saldo_movimenti -= _importo; - set_row (_rw,"@117g%s", (const char*) _importo_str); - } - } - - const int righe_rimaste = printer().rows_left(); - _stampato = righe_rimaste >= 1; - - _saldo_progressivi_str=_saldo_progressivi.string("###.###.###.###"); - _saldo_movimenti_str=_saldo_movimenti.string("###.###.###.###"); - if (_numcarat == 2) - { - ricerca_regiva(); - _protiva = atol(_mov->curr().get(MOV_PROTIVA)); - if (_protiva != 0) - set_row (_rw,"@189g%5d", _protiva); - - if (_tipo < 3) - set_row (_rw,"@180g#t" , &_regiva); - _dataregrmov = current_cursor()->curr(LF_RMOV).get_date(RMV_DATAREG); - dataregrmovstring=_dataregrmov.string(); - -//Gestire la stampa di saldo_progressivi nella postprocess_page di RMOV - - rec = rmov.recno(); - rmov.next(); - gruppof = rmov.get_int(RMV_GRUPPO); - contof = rmov.get_int(RMV_CONTO); - sottocf = rmov.get_int(RMV_SOTTOCONTO); - datasucc = rmov.get_date(RMV_DATAREG); - datasuccstring=datasucc.string(); - if (((gruppof!=_gruppo)||(contof!=_conto)||(sottocf!=_sottoc))||(rmov.eof())) - datasucc = (""); - if (datasucc != _dataregrmov) - set_row (_rw,"@133g#t", &_saldo_progressivi_str); - rmov.readat(rec); - } - _rw = 1; - - return TRUE; - } - else - return FALSE; - } - else - return FALSE; - } - else - return FALSE; - break; - } - default: - break; - } - return TRUE; -} - -void TMastrini_application::set_page(int file, int counter) -{ - switch (file) - { - case LF_SALDI: - reset_print(); - break; - - case LF_RMOV: - reset_print(); - if (_numcarat == 1) - fai_stampa132(); - else if (_numcarat == 2) - fai_stampa198(); - break; - default: - break; - } -} - -print_action TMastrini_application::postprocess_page(int file, int counter) -{ - if (_nummast == 1 || _nummast == 3) - { - 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; - _stampa_footer_si = TRUE; - _riporto_dare = ZERO; - _riporto_avere = ZERO; - _riporto_footer_dare = ZERO; - _riporto_footer_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; - _stampa_footer_si = TRUE; - _riporto_dare = ZERO; - _riporto_avere = ZERO; - _riporto_footer_dare = ZERO; - _riporto_footer_avere = ZERO; - _riporto_parziale_dare = ZERO; - _riporto_parziale_avere = ZERO; - _ddociva_len = 0; - - return NEXT_PAGE; - } - } - - switch (file) - { - case LF_SALDI: - { - if (_nummast == 1 || _nummast == 3) - { - if (_tipostampa == 3) - { - reset_print(); - 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 (_tipostampa == 1) - { - reset_print(); - if (_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_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; - _prima_volta = TRUE; - return REPEAT_PAGE; - } - case LF_RMOV: - force_setpage(); - break; - default: - break; - } - return NEXT_PAGE; -} - -print_action TMastrini_application::postprocess_print(int file, int counter) -{ - if (file == LF_SALDI) - { - _msk->reset(F_TIPOCF_INI); - - _msk->reset(F_GRUPPOINI); - - _msk->reset(F_CONTOINI_CONTO); - _msk->reset(F_CONTOINI_CLIENTE); - _msk->reset(F_CONTOINI_FORN); - - _msk->reset(F_SOTTOCINI_CONTO); - _msk->reset(F_SOTTOCINI_CLIENTE); - _msk->reset(F_SOTTOCINI_FORN); - - _msk->reset(F_DESCRINI_CONTO); - _msk->reset(F_DESCRINI_CLIENTE); - _msk->reset(F_DESCRINI_FORN); - - _msk->reset(F_TIPOCF_FINE); - - _msk->reset(F_GRUPPOFINE); - - _msk->reset(F_CONTOFINE_CONTO); - _msk->reset(F_CONTOFINE_CLIENTE); - _msk->reset(F_CONTOFINE_FORN); - - _msk->reset(F_SOTTOCFINE_CONTO); - _msk->reset(F_SOTTOCFINE_CLIENTE); - _msk->reset(F_SOTTOCFINE_FORN); - - _msk->reset(F_DESCRFINE_CONTO); - _msk->reset(F_DESCRFINE_CLIENTE); - _msk->reset(F_DESCRFINE_FORN); - } - return NEXT_PAGE; -} -// Stampa dei totali documenti iva se richiesta - -void TMastrini_application::stampa_totaliiva() -{ - real totale; - - 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 -// sull'archivio CAUS.dta - -void TMastrini_application::descrizione_causale() -{ - _caus->setkey(1); - _caus->curr().zero(); - _caus->curr().put(CAU_CODCAUS, _codcaus); - _caus->read(); - if (_caus->bad()) - _caus->zero(); - _descrcaus = _caus->curr().get(CAU_DESCR); -} - -// Ricerca sulla tabella dei tipi documento, la descrizione e la natura del -// documento, accedendovi tramite il tipo documento trovato su MOV.dta - -void TMastrini_application::documenti_iva() -{ - TString dep; - - _tabtpd->curr().zero(); - dep << format ("%2s",(const char*) _tipodoc); - _tabtpd->curr().put("CODTAB", (const char*) dep); - _tabtpd->read(); - _descrdociva = _tabtpd->curr().get("S0"); - _natdoc = atoi(_tabtpd->curr().get("I0")); -} - -void TMastrini_application::ricerca_regiva() -{ - TString16 dep; - - _tabreg->curr().zero(); - dep << format("%04d", _annoiva); - dep << format("%3s" , (const char*) _regiva); - _tabreg->curr().put("CODTAB", (const char*) dep); - _tabreg->read(); - _tipo = _tabreg->get_int("I0"); -} - -bool TMastrini_application::preprocess_print(int file, int counter) -{ - if (file == LF_SALDI) - { - _g_prec = 0; - _c_prec = 0; - _s_prec = 0; - - _saldo_periodo = ZERO; - _totale_periodo_dare = ZERO; - _totale_periodo_avere = ZERO; - _saldo_progre = ZERO; - _totprogre_dare = ZERO; - _totprogre_avere = ZERO; - _saldo_progre_al = ZERO; - _totprogre_dare_al = ZERO; - _totprogre_avere_al = ZERO; - _progredare = ZERO; - _progreavere = ZERO; - _totale_prima_dare = ZERO; - _totale_prima_avere = ZERO; - _saldo_movimenti = ZERO; - _saldo_progressivi = ZERO; - _saldo_progre_prec = ZERO; - _riporto_parziale_dare = ZERO; - _riporto_parziale_avere = ZERO; - _protiva = 0; - - _prima_volta = TRUE; - - _stampa_progressivi_si = TRUE; - _stampa_footer_si = TRUE; - } - - return TRUE; -} - -bool TMastrini_application::set_print(int) -{ - KEY tasto; - TLocalisamfile* fl; - TString data1,data2; - - _puoi_stampare = TRUE; - - _msk->set_handler (F_DATAINI ,data_inizio); - _msk->set_handler (F_DATAFINE ,data_fine); - - tasto = _msk->run(); - - if (tasto == K_ENTER) - { - _annomsk = atoi(_msk->get(F_ANNO)); - - _stampaprogre = (bool)(_msk->get(F_STAMPAPROGRE) == "X"); - _stampatotiva = (bool)(_msk->get(F_STAMPATOTIVA) == "X"); - _stampanum = atoi(_msk->get(F_STAMPANUM)); - _stampa_mov_prov = (bool)(_msk->get(F_STAMPAMOVPROV) == "X"); - int gruppoini = atoi(_msk->get(F_GRUPPOINI)); - int contoini = atoi(_msk->get(F_CONTOINI_CONTO)); - long sottocontoini = atol(_msk->get(F_SOTTOCINI_CONTO)); - int gruppofine = atoi(_msk->get(F_GRUPPOFINE)); - int contofine = atoi(_msk->get(F_CONTOFINE_CONTO)); - long sottocontofine = atol(_msk->get(F_SOTTOCFINE_CONTO)); - _tipostampa = atoi(_msk->get(F_TIPOSTAMPA)); - _numcarat = atoi(_msk->get(F_NUMCARAT)); - int formato = atoi(_msk->get(F_FORMATO)); - _nummast = atoi(_msk->get(F_NUMMAST)); - _codice_ditta = get_firm(); - - ricerca_dati_ditta(); - - if (_annomsk != 0) - _anno_corrente = _annomsk; - else - if (_annomsk == 0) - _anno_corrente = _anno_ghost; - - // GNACK! NO! poooorco zeeus! poooorca giunoooone! - // _anno_precedente = _anno_corrente - 1; - _tabesc->zero(); - TString16 dep(format("%04d", _anno_corrente)); - _tabesc->put("CODTAB", dep); - _tabesc->read(); - TDate ini = _tabesc->get("D0"); - --ini; - for (_tabesc->first(); !_tabesc->eof(); _tabesc->next()) - { - if (_tabesc->get_date("D1") == ini) - { - _anno_precedente = _tabesc->get_int("CODTAB"); - break; - } - else if (_tabesc->get_date("D1") < ini) - _anno_precedente = _tabesc->get_int("CODTAB"); - } - // LA'! - - if (_nummast == 1 || _nummast == 3) - printer().footerlen(4); - else - printer().footerlen(2); - -//Crea il cursore su gruppo, conto e sottoconto del file RMOV - - reset_files(); //resetta l'albero di stampa - add_file(LF_SALDI); - add_file(LF_RMOV,LF_SALDI); - - select_cursor(_cur1); - fl = &(current_cursor()->file(LF_SALDI)); - TRectype da (fl->curr()); - TRectype a (fl->curr()); - - da.zero(); - a.zero(); - - da.put(SLD_GRUPPO,gruppoini); - da.put(SLD_CONTO,contoini); - da.put(SLD_SOTTOCONTO,sottocontoini); - - a.put(SLD_GRUPPO,gruppofine); - a.put(SLD_CONTO,contofine); - a.put(SLD_SOTTOCONTO,sottocontofine); - - current_cursor()->setregion(da, a); - - if (_stampatotiva) - _b.destroy(); - - //_inizio_stampa = TRUE; - _numero_pag = 1; - if (_nummast == 3) - _pagina = 0; - else - _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; - break; - case 2: _totale_saldo = 0; - break; - case 3: _totale_saldo = 1; - break; - default: break; - } - - enable_print_menu(); - - enable_link("Collegamento prima nota: ", 'r'); - - return TRUE; - } - else - return FALSE; -} - -void TMastrini_application::data_fine_esercizio(int anno) -{ - TString16 dep; - - _tabesc->curr().zero(); - dep << format ("%04d", anno); - _tabesc->curr().put("CODTAB", (const char*) dep); - _tabesc->read(); - _data_finese = _tabesc->curr().get("D1"); - _data_inizioese = _tabesc->curr().get("D0"); -} - -void TMastrini_application::preprocess_header() -{ - 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(); - } - else - if (_nummast == 3 && !_gia_stampata_intestazione) - { - 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::preprocess_footer() -{ - reset_footer(); - - if (_nummast != 1 && _nummast != 3) - return; - - if (_devi_stampare_footer) - { - real dep_dare,dep_avere; - - if (_stampa_footer_si) - { - _riporto_footer_dare = _progredare + _riporto_parziale_dare; - _riporto_footer_avere = _progreavere + _riporto_parziale_avere; - - real imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - dep_dare = _stampato ? _riporto_footer_dare : _riporto_footer_dare - imp_d; - dep_avere = _stampato ? _riporto_footer_avere : _riporto_footer_avere - imp_a; - - _stampa_footer_si = FALSE; - } - else - { - _riporto_footer_dare += _riporto_parziale_dare; - _riporto_footer_avere += _riporto_parziale_avere; - - real imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - dep_dare = _stampato ? _riporto_footer_dare : _riporto_footer_dare - imp_d; - dep_avere = _stampato ? _riporto_footer_avere : _riporto_footer_avere - imp_a; - } - - if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) - { - TString dare (dep_dare.string("###.###.###.###")); - TString avere (dep_avere.string("###.###.###.###")); - if (_numcarat == 1) - { - set_footer (2,"@32gA RIPORTO@85g%s", (const char*) dare); - set_footer (2,"@101g%s", (const char*) avere); - } - else - if (_numcarat == 2) - { - set_footer (2,"@32gA RIPORTO@101g%s", (const char*) dare); - set_footer (2,"@117g%s", (const char*) avere); - } - } - } -} - -void TMastrini_application::conto(int gruppo, int conto, bool no_contropartita) -{ - TLocalisamfile pconti(LF_PCON); - - pconti.setkey(1); - pconti.zero(); - pconti.put(PCN_GRUPPO, gruppo); - pconti.put(PCN_CONTO , conto); - pconti.read(); - if (pconti.bad()) - pconti.zero(); - - if (no_contropartita) - { - _indbil = pconti.get_int(PCN_INDBIL); - _tmcf = pconti.get_char(PCN_TMCF); - } - else - _tipo_contr = pconti.get_char(PCN_TMCF); -} - -void TMastrini_application::ricerca_dati_ditta() -{ - long app; - - _nditte->setkey(1); - _nditte->curr().zero(); - _nditte->curr().put(NDT_CODDITTA,_codice_ditta); - _nditte->read(); - app=_nditte->curr().get_long(NDT_CODDITTA); - _ragsoc=_nditte->curr().get(NDT_RAGSOC); - - _unloc->setkey(1); - _unloc->curr().zero(); - _unloc->curr().put(ULC_CODDITTA,app); - _unloc->curr().put(ULC_CODULC,"1"); - _unloc->read(); - _indulc=_unloc->curr().get(ULC_INDULC); - _civulc=_unloc->curr().get(ULC_CIVULC); - int len = _indulc.len(); - if (len <= 31) - { - if (len <= 26) - _indulc << " " << _civulc; - else - _indulc << " " << _civulc.mid(0,5); - } - else - { - _indulc = _indulc.mid(0,31); - _indulc << " " << _civulc.mid(0,5); - } - _capulc=_unloc->curr().get(ULC_CAPULC); - _comulc=_unloc->curr().get(ULC_COMULC); - - _comuni->setkey(1); - _comuni->zero(); - _comuni->put(COM_COM,_comulc); - _comuni->read(); - if (_comuni->good()) - { - _com=_comuni->get(COM_DENCOM); - _prov=_comuni->get(COM_PROVCOM); - } - else - { - _com=""; - _prov=""; - } -} - -// Crea l'intestazione per la stampa a 132 e a 198 caratteri - -void TMastrini_application::crea_intestazione() -{ - TString sep(132),sep1(198); - sep = ""; - - reset_header(); - - int np = get_page_number(); - - if (_cambia_mastrino) - { - if (_nummast != 3) - _pagina = 1; - _cambia_mastrino = FALSE; - } - if (_numcarat == 1) - { - if (_nummast == 3) - { - if (_pagina != np) - sep << "Pag. @#"; - } - else - sep << "Pag. " << _pagina; - sep.right_just(132); - set_header(1,(const char*) sep); - sep =""; - set_header(2,"@1g%s",(const char*) sep); - //set_header(1,"@126gPag. %2d", _numero_pag++); - } - else if (_numcarat == 2) - { - if (_nummast == 3) - { - if (_pagina != np) - sep1 << "Pagina @#"; - } - else - 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++); - } - if (_nummast != 3) - _pagina++; - - if (_nummast != 3 || _pagina != np) - { - set_header (1, "@0gDITTA@6g%5ld", _codice_ditta); - set_header (1, "@12g%-.45s", (const char*) _ragsoc); - set_header (1, "@59g%s", (const char*) _indulc); - //set_header (1, "@86g%-.9s", (const char*) _civulc); - set_header (1, "@97g%-.5s", (const char*) _capulc); - set_header (1, "@103g%-.18s", (const char*) _com); - set_header (1, "@122g%-.3s", (const char*) _prov); - } - if (_nummast == 3) - { - set_header (3, "@0gSottoconto@12g@b%d", _gruppo); - set_header (3, "@16g@b%d", _conto); - set_header (3, "@20g@b%ld", _sottoc); - } - else - { - set_header (3, "@0gSottoconto@12g%d", _gruppo); - set_header (3, "@16g%d", _conto); - set_header (3, "@20g%ld", _sottoc); - } - - if (_tmcf == 'C') - _tipo_mask = 1; - else if (_tmcf == 'F') - _tipo_mask = 2; - else if (_tmcf == '\0') - _tipo_mask = 3; - switch (_tipo_mask) - { - case 1: ricerca_clifo(); - break; - case 2: ricerca_clifo(); - break; - case 3: ricerca_gruppo(); - break; - default: break; - } - - if (_numcarat == 1) - { - sep.fill('-'); //Stampa 132 - (sep(132)) - set_header (6, (const char *) sep); - set_header (7,"Operazione@19gDocumento@117gContro@131gA"); - if (_stampa_mov_prov) - set_header(7,"@129gM"); - set_header (8,"Data"); - if (_stampanum < 3) - set_header (8,"@11gnumero"); - set_header (8,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@96gDare@111gAvere@117gPartita@131gC"); - if (_stampa_mov_prov) - set_header(8,"@129gP"); - sep.fill('-'); - set_header (9, (const char *) sep); - } - else if (_numcarat == 2) - { - sep1.fill('-'); //Stampa 198 - (sep1(198)) - set_header (6,"@0g%s", (const char *) sep1); - set_header (7,"Operazione@23gData@34gNumero@169gContro@180gReg@188gNumero@197gA"); - if (_stampa_mov_prov) - set_header(7,"@195gM"); - set_header (8,"Data"); - if (_stampanum < 3) - set_header (8,"@11gnumero"); - set_header (8,"@23gDocumento@42gCod.Causale@70gDescrizione@112gDare@127gAvere@135gSaldo progre.@152gSaldo movim.@169gPartita@180gIva@184gProtocollo@197gC"); - if (_stampa_mov_prov) - set_header(8,"@195gP"); - sep1.fill('-'); - set_header (9,"@0g%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@101g%15s",(const char*)string); - string = _progreavere.string("###.###.###.###"); - set_header (10,"@117g%15s",(const char*) string); - string = _saldo_progre_prec.string("###.###.###.###"); - set_header (10,"@133g%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; - - real dep_dare,dep_avere,imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; - dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; - - if (_nummast != 3 || dep_dare != ZERO || dep_avere != 0) - { - if (_numcarat == 1) - { - TString string = dep_dare.string("###.###.###.###"); - set_header (10,"@32gA RIPORTO@85g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); - set_header (10,"@101g%15s",(const char*) string); - } - if (_numcarat == 2) - { - TString string = dep_dare.string("###.###.###.###"); - set_header (10,"@32gA RIPORTO@101g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); - set_header (10,"@117g%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); - } - if (_pagina != np) - _pagina = np; -} - -int TMastrini_application::crea_intestazione(int start_riga) -{ - TString sep(132),sep1(198); - int r = start_riga + 2; - sep = ""; - - reset_header(); - - int np = get_page_number(); - - _conta_mastrini++; - - if (_nummast == 3) - _gia_stampata_intestazione = TRUE; - - if (_nummast == 2) - if (_cambia_mastrino) - { - _numero_pag = 1; - _cambia_mastrino = FALSE; - } - if (_nummast == 3) - { - if (_pagina != np) - { - if (_numcarat == 1) - { - sep << "Pag. @#"; - set_row(r,"@126g%s", (const char*) sep); - } - else if (_numcarat == 2) - { - sep << "Pagina @#"; - set_row(r,"@190g%s", (const char*) sep); - } - } - } - else - { - if (_numcarat == 1) - set_row(r,"@126gPag. %2d", _numero_pag++); - else if (_numcarat == 2) - set_row(r,"@190gPagina %2d", _numero_pag++); - } - if (_nummast != 3 || _pagina != np) - { - set_row (r, "@0gDITTA@6g%5ld", _codice_ditta); - set_row (r, "@12g%-45s", (const char*) _ragsoc); - set_row (r, "@59g%s", (const char*) _indulc); - //set_row (r, "@86g%-9s", (const char*) _civulc); - set_row (r, "@97g%-5s", (const char*) _capulc); - set_row (r, "@103g%-18s", (const char*) _com); - set_row (r, "@122g%-3s", (const char*) _prov); - r += 2; - } - if (_nummast == 3) - { - set_row (r, "@0gSottoconto@12g@b%d", _gruppo); - set_row (r, "@16g@b%d", _conto); - set_row (r, "@20g@b%ld", _sottoc); - } - else - { - set_row (r, "@0gSottoconto@12g%d", _gruppo); - set_row (r, "@16g%d", _conto); - set_row (r, "@20g%ld", _sottoc); - } - - if (_tmcf == 'C') - _tipo_mask = 1; - else if (_tmcf == 'F') - _tipo_mask = 2; - else if (_tmcf == '\0') - _tipo_mask = 3; - switch (_tipo_mask) - { - case 1: r = ricerca_clifo(r); - break; - case 2: r = ricerca_clifo(r); - break; - case 3: r = ricerca_gruppo(r); - break; - default: break; - } - - r++; - - if (_numcarat == 1) - { - sep.fill('-'); //Stampa 132 - (sep(132)) - set_row (r++,"@1g%s", (const char *) sep); - set_row (r++,"Operazione@19gDocumento@117gContro@131gA"); - if (_stampa_mov_prov) - set_header(r-1,"@129gM"); - set_row (r,"Data"); - if (_stampanum < 3) - set_row (r,"@11gnumero"); - set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@96gDare@111gAvere@117gPartita@131gC"); - if (_stampa_mov_prov) - set_header(r-1,"@129gP"); - sep.fill('-'); - set_row (r++,"@1g%s", (const char *) sep); - } - else if (_numcarat == 2) - { - sep1.fill('-'); //Stampa 198 - (sep1(198)) - set_row (r++,"@0g%s", (const char *) sep1); - set_row (r++,"Operazione@23gData@34gNumero@169gContro@180gReg@188gNumero@197gA"); - if (_stampa_mov_prov) - set_row(r-1,"@195gM"); - set_row (r,"Data"); - if (_stampanum < 3) - set_row (r,"@11gnumero"); - set_row (r,"@23gDocumento@42gCod.Causale@70gDescrizione@112gDare@127gAvere"); - set_row (r++,"@135gSaldo progre.@152gSaldo movim.@169gPartita@180gIva@184gProtocollo@197gC"); - if (_stampa_mov_prov) - set_row (r-1,"@195gP"); - sep1.fill('-'); - set_row (r++,"@0g%s", (const char *) sep1); - } - if (_pagina != np) - _pagina = np; - 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(); - _riporto_dare = _progredare; - _riporto_avere = _progreavere; - _stampa_progressivi_si = FALSE; - } - else - { - _riporto_dare += _riporto_parziale_dare; - _riporto_avere += _riporto_parziale_avere; - - real dep_dare,dep_avere,imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; - dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; - - if (_nummast != 3 || dep_dare != ZERO || dep_avere != 0) - { - if (_numcarat == 1) - { - TString string = dep_dare.string("###.###.###.###"); - set_row (_rw,"@32gA RIPORTO@85g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); - set_row (_rw++,"@101g%15s",(const char*) string); - } - if (_numcarat == 2) - { - TString string = dep_dare.string("###.###.###.###"); - set_row (_rw,"@32gA RIPORTO@101g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); - set_row (_rw++,"@117g%15s",(const char*) string); - } - } - _riporto_parziale_dare = ZERO; - _riporto_parziale_avere = ZERO; - } - if (_numcarat == 1) - { - sep =""; - set_row(_rw,"@1g%s",(const char*) sep); - } - else if (_numcarat == 2) - { - 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; - - real dep_dare,dep_avere,imp_d,imp_a; - imp_d = _sezione == "D" ? _importo : ZERO; - imp_a = _sezione == "A" ? _importo : ZERO; - dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; - dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; - - if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) - { - if (_numcarat == 1) - { - TString string = dep_dare.string("###.###.###.###"); - set_row (r,"@32gA RIPORTO@85g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); - set_row (r++,"@101g%15s",(const char*) string); - } - if (_numcarat == 2) - { - TString string = dep_dare.string("###.###.###.###"); - set_row (r,"@32gA RIPORTO@101g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); - set_row (r++,"@117g%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() -{ - long record,sottoc,annoes; - int gruppo,conto; - TDate datareg, datacomp; - TLocalisamfile & rmov = current_cursor()->file(LF_RMOV); - char sezione; - real importo; - TDate data; - - _totale_prima_dare = ZERO; - _totale_prima_avere = ZERO; - - record = rmov.recno(); - rmov.zero(); - rmov.put(RMV_GRUPPO, _gruppo); - rmov.put(RMV_CONTO, _conto); - rmov.put(RMV_SOTTOCONTO, _sottoc); - for (rmov.read();!rmov.eof() ;rmov.next()) - { - annoes = rmov.get_int (RMV_ANNOES); - datareg = rmov.get_date(RMV_DATAREG); - sezione = rmov.get (RMV_SEZIONE)[0]; - importo = rmov.get_real(RMV_IMPORTO); - long numreg = rmov.get_long(RMV_NUMREG); - - _mov->setkey(1); - _mov->curr().zero(); - _mov->curr().put(MOV_NUMREG,numreg); - _mov->read(); - if (_mov->bad()) - _mov->zero(); - datacomp = (_mov->curr().get(MOV_DATACOMP)); - TString provvis (_mov->curr().get(MOV_PROVVIS)); - - if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) - { - if (_annomsk == 0) - { - datareg = rmov.get_date(RMV_DATAREG); - data = _inizioes; - } - else - if (_annomsk != 0) - { - datareg = datacomp; - data = _data_inizioese; - } - - gruppo = rmov.get_int(RMV_GRUPPO); - conto = rmov.get_int(RMV_CONTO); - sottoc = rmov.get_long(RMV_SOTTOCONTO); - if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) - break; - else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale - if (sezione == 'D') - _totale_prima_dare += importo; - else if (sezione == 'A') - _totale_prima_avere += importo; - } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) - } - rmov.readat(record); -} - -void TMastrini_application::calcola_progressivi() -{ - /* fv 20/3/96: aggiustato per nuova struttura saldi - modificata ricerca - * record scaricati e assegnazione dare/avere relativo - Controllare che - * non occorra considerare il saldo di chiusura (SALDOFIN) aggiunto al - * record */ - - TLocalisamfile saldi(LF_SALDI, FALSE); - real progdare_attuale,progavere_attuale,progdare_prec,progavere_prec; - real saldo,progredare_eseprec,progreavere_eseprec,pdarep,paverep,saldoini_attuale,saldofine_attuale; - char salini,salini_attuale,salfine_attuale; - - saldo = ZERO; - pdarep = ZERO; - paverep = ZERO; - -// Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto -// uguali a quelli di rmov per il calcolo dei progressivi precedenti - - - saldi.setkey(2); - saldi.zero(); - saldi.put(SLD_GRUPPO, _gruppo); - saldi.put(SLD_CONTO, _conto); - saldi.put(SLD_SOTTOCONTO, _sottoc); - - TRectype record(saldi.curr()); - - for (saldi.read(_isgteq); saldi.good() && saldi.curr() == record; saldi.next()) - { - if (!saldi.get_bool(SLD_FLSCA)) - { - int annoes_saldi = saldi.curr().get_int(SLD_ANNOES); - -//Calcola i progressivi dell'esercizio attuale - - if (annoes_saldi == _anno_corrente) - { - progdare_attuale = saldi.get_real(SLD_PDARE); - progavere_attuale = saldi.get_real(SLD_PAVERE); - saldo = saldi.get_real(SLD_SALDO); - salini = saldi.get(SLD_FLAGSALINI)[0]; - _ultima_data_reg = saldi.get_date(SLD_DATAULMOV); - saldoini_attuale = saldi.get_real(SLD_SALDO); - salini_attuale = saldi.get_char(SLD_FLAGSALINI); - saldofine_attuale = saldi.get_real(SLD_SALDOFIN); - salfine_attuale = saldi.get_char(SLD_FLAGSALFIN); - } - -//Calcola i progressivi dell'esercizio precedente - - if (annoes_saldi == _anno_precedente) - { - pdarep = saldi.get_real(SLD_PDARE); - paverep = saldi.get_real(SLD_PAVERE); - - if (_stampa_mov_prov) - { - progredare_eseprec = pdarep + saldi.get_real(SLD_PDAREPRO); - progreavere_eseprec = paverep + saldi.get_real(SLD_PAVEREPRO); - } - - // cerca eventuale record scaricati - } - -// Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che -// quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere -// i progressivi dell'esercizio precedente devo a questo punto sommare i -// progressivi dell'esercizio e i progressivi di quelli scaricati, tenendo -// conto del flag salini per sapere se il saldo e' dare oppure avere. - -/* - if (_annomsk != 0 && _anno_corrente == annoes_saldi) - { - if (saldo != ZERO) - { - if (salini == 'D') - { - progredare_eseprec = saldo;// + pdarescap + pdarep; - progdare_prec = saldo; - } - else if (salini == 'A') - { - progreavere_eseprec = saldo;// + paverescap + paverep; - progavere_prec = saldo; - } - } - } -*/ - } // if (!saldi.get_bool(SLD_FLSCA)) - } // FOR - -//Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo -// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil - - if (_annomsk != 0 /*&& saldo == ZERO*/) - { - if ((_indbil == 1) || (_indbil == 2) || (_indbil == 5)) - { - const TRecnotype pos = saldi.recno(); - // W96SALDI del 18-07-96 saldofin_esprec usa il flag TRUE xche' deve - // considerare anche il saldo finale - saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE,FALSE); - saldi.readat(pos); - - if (saldo> ZERO) - { - progredare_eseprec = saldo; - progdare_prec = saldo; - } - else if (saldo < ZERO) - { - saldo = -saldo; - progreavere_eseprec = saldo; - progavere_prec = saldo; - } - } - } - - calcola_progressivi_al(); - -//Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov -//che hanno la data di registrazione inferiore alla data di inizio stampa, -//dei progressivi dell'anno esercizio precedente, e dei progressivi dei -//movimenti scaricati dell'esercizio attuale. - - _progredare = progredare_eseprec + _totale_prima_dare; - _progreavere = progreavere_eseprec + _totale_prima_avere; - _saldo_progre_prec = _progredare - _progreavere; - -//Calcolo dei progressivi al - -//Se sulla maschera e' stato selezionato il controllo competenza esercizio -//Sommo i progressivi dell'esercizio precedente e quelli dell'esercizio attuale -//altrimenti solo quelli dell'esercizio attuale - - if (_annomsk != 0) - { - _totprogre_dare_al = progdare_attuale + progdare_prec; - _totprogre_avere_al = progavere_attuale + progavere_prec; - - if (salini_attuale == 'D') - _totprogre_dare_al += saldoini_attuale; - else if (salini_attuale == 'A') - _totprogre_avere_al += saldoini_attuale; - if (salfine_attuale == 'D') - _totprogre_dare_al += saldofine_attuale; - else if (salfine_attuale == 'A') - _totprogre_avere_al += saldofine_attuale; - } - else - { - _totprogre_dare_al = progdare_attuale; - _totprogre_avere_al = progavere_attuale; - - if (salini_attuale == 'D') - _totprogre_dare_al += saldoini_attuale; - else if (salini_attuale == 'A') - _totprogre_avere_al += saldoini_attuale; - if (salfine_attuale == 'D') - _totprogre_dare_al += saldofine_attuale; - else if (salfine_attuale == 'A') - _totprogre_avere_al += saldofine_attuale; - } -} - -void TMastrini_application::stampa_progressivi() -{ - if (_nummast == 1 || _nummast == 3) - _rw = 1; - - if (_numcarat == 1) - { - TString string = _saldo_progre_prec.string("###.###.###.###"); - set_row (_rw,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); - string = _progredare.string("###.###.###.###"); - set_row (_rw,"@85g%15s",(const char*) string); - string = _progreavere.string("###.###.###.###"); - set_row (_rw++,"@101g%15s",(const char*) string); - } - - if (_numcarat == 2) - { - TString string = _progredare.string("###.###.###.###"); - set_row (_rw,"@70gPROGRESSIVI PRECEDENTI@101g%15s",(const char*)string); - string = _progreavere.string("###.###.###.###"); - set_row (_rw,"@117g%15s",(const char*) string); - string = _saldo_progre_prec.string("###.###.###.###"); - set_row (_rw++,"@133g%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@101g%15s",(const char*)string); - string = _progreavere.string("###.###.###.###"); - set_row (r,"@117g%15s",(const char*) string); - string = _saldo_progre_prec.string("###.###.###.###"); - set_row (r++,"@133g%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() -{ - TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep; - TLocalisamfile clifo(LF_CLIFO); - TLocalisamfile pconti(LF_PCON); - TString16 dataini,datafine; - TString descriz,descriz2; - int numrivd; - - indcf = ""; - - clifo.setkey(1); - clifo.zero(); - clifo.put(CLI_TIPOCF, _tmcf); - clifo.put(CLI_CODCF, _sottoc); - clifo.read(); - if (clifo.bad()) - clifo.zero(); - TConto tc (_gruppo,_conto,_sottoc,_tmcf); - - ragsoc = tc.descrizione(); - paiv = clifo.get(CLI_PAIV); - cofi = clifo.get(CLI_COFI); - indcf = clifo.get(CLI_INDCF); - indcf.trim(); - indcf << " " << clifo.get(CLI_CIVCF); - capcf = clifo.get(CLI_CAPCF); - ptel = clifo.get(CLI_PTEL); - tel = clifo.get(CLI_TEL); - statocf = clifo.get(CLI_STATOCF); - comcf = clifo.get(CLI_COMCF); - - _comuni->setkey(1); - _comuni->zero(); - _comuni->put(COM_STATO, statocf); - _comuni->put(COM_COM, comcf); - _comuni->read(); - if (_comuni->good()) - { - dencom = _comuni->get(COM_DENCOM); - provcom = _comuni->get(COM_PROVCOM); - } - else - { - //dencom=""; - dencom = clifo.get(CLI_LOCCF); - provcom=""; - } - - pconti.setkey(1); - pconti.zero(); - pconti.put(PCN_GRUPPO, _gruppo); - pconti.put(PCN_CONTO, _conto); - pconti.read(); - _sezivd = pconti.get_char(PCN_SEZIVD); - _lettivd = pconti.get_char(PCN_LETTIVD); - numrivd = pconti.get_int(PCN_NUMRIVD); - _numrivd = itor(numrivd); - _numivd = pconti.get_int(PCN_NUMIVD); - - descriz = descrizione_classe(_sezivd,_lettivd,numrivd,_numivd); - - if (_numivd != 0) //Ora devo stampare la descrizione del livello della - { //classe immediatamente precedente a quello appena - if (_numrivd != "") //stampato - descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); - else - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - } - else - if (_numrivd != "") - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - else - descriz2 = ""; - - set_header(3,"@27g%-.30s",(const char*) descrizione_gruppo()); - set_header(3,"@59g%-.30s",(const char*) descrizione_conto()); - set_header(3, "@91g%-.41s",(const char*) ragsoc); - if (_nummast == 3) - set_header(4, "@rClasse@8g@b%c", _lettivd); - else - set_header(4, "Classe@8g%c", _lettivd); - set_header(4, "@10g%-8s", (const char*) _numrivd); - if (_numivd != 0) - set_header(4, "@19g%2d", _numivd); - if (descriz2 != "") - { - set_header(4,"@23g%-50s",(const char*) descriz2); - set_header(4,"@80g%-50s",(const char*) descriz); - } - else - set_header(4,"@23g%-50s",(const char*) descriz); - - dataini = _data_ini.string(); - datafine = _data_fine.string(); - - if (_annomsk == 0) - { - if (_nummast == 3) - { - set_header (5, "@rPeriodo@10g@b%s", (const char*) dataini); - set_header (5, "@22g@b%s@r", (const char*) datafine); - } - else - { - set_header (5, "Periodo@10g%s", (const char*) dataini); - set_header (5, "@22g%s", (const char*) datafine); - } - } - else - { - if (_nummast == 3) - { - set_header (5, "@rComp. da@9g@b%s", (const char*) dataini); - set_header (5, "@20g@ra@22g@b%s@r", (const char*) datafine); - } - else - { - set_header (5, "Comp. da@9g%s", (const char*) dataini); - set_header (5, "@20ga@22g%s", (const char*) datafine); - } - } - - set_header (5, "@33gP.I.@37g%-11s",(const char*) paiv); - set_header (5, "@49gCF@52g%-16s",(const char*) cofi); - set_header (5, "@69g%-.25s",(const char*) indcf); - set_header (5, "@95g%-5s",(const char*) capcf); - set_header (5, "@101g%-.24s",(const char*) dencom); - set_header (5, "@126g%-5s",(const char*) provcom); - - if (_numcarat == 2) - { - set_header (5,"@134g%-4s",(const char*) ptel); - if (tel != "") - set_header (5,"@138g/@139g%-10s",(const char*) tel); - } -} - -int TMastrini_application::ricerca_clifo(int start) -{ - TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep; - TLocalisamfile clifo(LF_CLIFO); - TLocalisamfile pconti(LF_PCON); - TString16 dataini,datafine; - TString descriz,descriz2; - int numrivd; - int r = start; - - indcf = ""; - - clifo.setkey(1); - clifo.zero(); - clifo.put(CLI_TIPOCF, _tmcf); - clifo.put(CLI_CODCF, _sottoc); - clifo.read(); - if (clifo.bad()) - clifo.zero(); - TConto tc (_gruppo,_conto,_sottoc,_tmcf); - - ragsoc = tc.descrizione(); - paiv = clifo.get(CLI_PAIV); - cofi = clifo.get(CLI_COFI); - indcf = clifo.get(CLI_INDCF); - indcf.trim(); - indcf << " " << clifo.get(CLI_CIVCF); - capcf = clifo.get(CLI_CAPCF); - ptel = clifo.get(CLI_PTEL); - tel = clifo.get(CLI_TEL); - statocf = clifo.get(CLI_STATOCF); - comcf = clifo.get(CLI_COMCF); - - _comuni->setkey(1); - _comuni->zero(); - _comuni->put(COM_STATO, statocf); - _comuni->put(COM_COM, comcf); - _comuni->read(); - if (_comuni->good()) - { - dencom = _comuni->get(COM_DENCOM); - provcom = _comuni->get(COM_PROVCOM); - } - else - { - //dencom=""; - dencom=clifo.get(CLI_LOCCF); - provcom=""; - } - - pconti.setkey(1); - pconti.zero(); - pconti.put(PCN_GRUPPO, _gruppo); - pconti.put(PCN_CONTO, _conto); - pconti.read(); - _sezivd = pconti.get_char(PCN_SEZIVD); - _lettivd = pconti.get_char(PCN_LETTIVD); - numrivd = pconti.get_int(PCN_NUMRIVD); - _numrivd = itor(numrivd); - _numivd = pconti.get_int(PCN_NUMIVD); - - descriz = descrizione_classe(_sezivd,_lettivd,numrivd,_numivd); - - if (_numivd != 0) //Ora devo stampare la descrizione del livello della - { //classe immediatamente precedente a quello appena - if (_numrivd != "") //stampato - descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); - else - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - } - else - if (_numrivd != "") - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - else - descriz2 = ""; - - set_row (r,"@27g%-30s",(const char*) descrizione_gruppo()); - set_row (r,"@59g%-30s",(const char*) descrizione_conto()); - set_row(r++, "@91g%-30s",(const char*) ragsoc); - if (_nummast == 3) - set_row(r, "@rClasse@8g@b%c", _lettivd); - else - set_row(r, "Classe@8g%c", _lettivd); - set_row(r, "@10g%-8s", (const char*) _numrivd); - if (_numivd != 0) - set_row(r, "@19g%2d", _numivd); - if (descriz2 != "") - { - set_row(r,"@23g%-50s",(const char*) descriz2); - set_row(r++,"@80g%-50s",(const char*) descriz); - } - else - set_row(r++,"@23g%-50s",(const char*) descriz); - - dataini = _data_ini.string(); - datafine = _data_fine.string(); - - if (_annomsk == 0) - { - if (_nummast == 3) - { - set_row (r, "@rPeriodo@10g@b%s", (const char*) dataini); - set_row (r, "@22g%s@r", (const char*) datafine); - } - else - { - set_row (r, "Periodo@10g%s", (const char*) dataini); - set_row (r, "@22g%s", (const char*) datafine); - } - } - else - { - if (_nummast == 3) - { - set_row (r, "@rComp. da@9g@b%s", (const char*) dataini); - set_row (r, "@20g@ra@22g@b%s@r", (const char*) datafine); - } - else - { - set_row (r, "Comp. da@9g%s", (const char*) dataini); - set_row (r, "@20ga@22g%s", (const char*) datafine); - } - } - - set_row (r, "@33gP.I.@37g%-11s",(const char*) paiv); - set_row (r, "@49gCF@52g%-16s",(const char*) cofi); - set_row (r, "@69g%-.25s",(const char*) indcf); - set_row (r, "@95g%-5s",(const char*) capcf); - set_row (r, "@101g%-.24s",(const char*) dencom); - set_row (r, "@126g%-5s",(const char*) provcom); - - if (_numcarat == 2) - { - set_row (r,"@134g%-4s",(const char*) ptel); - if (tel != "") - set_row (r++,"@138g/@139g%-10s",(const char*) tel); - } - return r; -} - - -// Se la ricerca selezionata sulla maschera e' per gruppo, conto, sottoconto -// ricerca i corrispondenti su PCON, con relativa IV direttiva CEE - -void TMastrini_application::ricerca_classe_IV(bool scelta) -{ - TLocalisamfile pconti(LF_PCON); - - pconti.setkey(1); - pconti.zero(); - pconti.put(PCN_GRUPPO, _gruppo); - pconti.put(PCN_CONTO, _conto); - if (scelta) - pconti.put(PCN_SOTTOCONTO, _sottoc); - pconti.read(); - _sezivd = pconti.get_char(PCN_SEZIVD); - _lettivd = pconti.get_char(PCN_LETTIVD); - _numrivd_int = pconti.get_int (PCN_NUMRIVD); - _numrivd = itor(_numrivd_int); - _numivd = pconti.get_int (PCN_NUMIVD); -} - -void TMastrini_application::ricerca_gruppo() -{ - TString80 descr,descriz,descriz2,dep; - TString dataini,datafine; - - ricerca_classe_IV (TRUE); //Esiste a livello di sottoconto - - if (_sezivd == '0') //Non esiste a livello di sottoconto - ricerca_classe_IV (FALSE); //Allora la cerco a livello di conto - - descriz = descrizione_classe(_sezivd,_lettivd,_numrivd_int,_numivd); - if (_numivd != 0) //Ora devo stampare la descrizione del livello della - { //classe immediatamente precedente a quello appena - if (_numrivd != "") //stampato - descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); - else - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - } - else - if (_numrivd != "") - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - else - descriz2 = ""; - - set_header(3,"@27g%-.30s",(const char*) descrizione_gruppo()); - set_header(3,"@59g%-.30s",(const char*) descrizione_conto()); - - set_header(3,"@91g%-.41s",(const char*) descrizione_sottoconto()); - if (_nummast == 3) - set_header(4, "@0g@rClasse@12g@b%c", _lettivd); - else - set_header(4, "@0gClasse@12g%c", _lettivd); - set_header(4, "@14g%-8s",(const char*) _numrivd); - if (_numivd != 0) - set_header(4, "@23g%d", _numivd); - if (descriz2 != "") - { - set_header(4,"@27g%-50s",(const char*) descriz2); - set_header(4,"@80g%-50s",(const char*) descriz); - } - else - set_header(4,"@27g%-50s",(const char*) descriz); - - dataini = _data_ini.string(); - datafine = _data_fine.string(); - - if (_annomsk == 0) - { - if (_nummast == 3) - { - set_header (5, "@rPeriodo@12g@b%s", (const char*) dataini); - set_header (5, "@24g@b%s@r", (const char*) datafine); - } - else - { - set_header (5, "Periodo@12g%s", (const char*) dataini); - set_header (5, "@24g%s", (const char*) datafine); - } - } - else - { - if (_nummast == 3) - { - set_header (5, "@rPeriodo di competenza@23g@b%s", (const char*) dataini); - set_header (5, "@35g%s@r", (const char*) datafine); - } - else - { - set_header (5, "Periodo di competenza@23g%s", (const char*) dataini); - set_header (5, "@35g%s", (const char*) datafine); - } - } -} - -int TMastrini_application::ricerca_gruppo(int start) -{ - TString80 descr,descriz,descriz2,dep; - TString dataini,datafine; - int r = start; - - ricerca_classe_IV (TRUE); //Esiste a livello di sottoconto - - if (_sezivd == '0') //Non esiste a livello di sottoconto - ricerca_classe_IV (FALSE); //Allora la cerco a livello di conto - - descriz = descrizione_classe(_sezivd,_lettivd,_numrivd_int,_numivd); - if (_numivd != 0) //Ora devo stampare la descrizione del livello della - { //classe immediatamente precedente a quello appena - if (_numrivd != "") //stampato - descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); - else - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - } - else - if (_numrivd != "") - descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); - else - descriz2 = ""; - - set_row(r,"@27g%-.30s",(const char*) descrizione_gruppo()); - set_row(r,"@59g%-.30s",(const char*) descrizione_conto()); - - set_row(r++,"@91g%-.41s",(const char*) descrizione_sottoconto()); - if (_nummast == 3) - set_row(r, "@0g@rClasse@12g@b%c", _lettivd); - else - set_row(r, "@0gClasse@12g%c", _lettivd); - set_row(r, "@14g%-8s",(const char*) _numrivd); - if (_numivd != 0) - set_row(r, "@23g%d", _numivd); - if (descriz2 != "") - { - set_row(r,"@27g%-50s",(const char*) descriz2); - set_row(r++,"@80g%-50s",(const char*) descriz); - } - else - set_row(r++,"@27g%-50s",(const char*) descriz); - - dataini = _data_ini.string(); - datafine = _data_fine.string(); - - if (_annomsk == 0) - { - if (_nummast == 3) - { - set_row (r, "@rPeriodo@12g@b%s", (const char*) dataini); - set_row (r, "@24g%s@r", (const char*) datafine); - } - else - { - set_row (r, "Periodo@12g%s", (const char*) dataini); - set_row (r, "@24g%s", (const char*) datafine); - } - } - else - { - if (_nummast == 3) - { - set_row (r, "@rPeriodo di competenza@23g@b%s", (const char*) dataini); - set_row (r, "@35g%s@r", (const char*) datafine); - } - else - { - set_row (r, "Periodo di competenza@23g%s", (const char*) dataini); - set_row (r, "@35g%s", (const char*) datafine); - } - } - return r; -} - -const char* TMastrini_application::descrizione_classe(char sezione, char lettera, int numr, int numero) -{ - TTable tabivd(TAB_IVD); - TString dep,dep2; - - tabivd.zero(); - if (numr == 0 && numero == 0) - dep = format("%c%c",sezione,lettera); - else - if (numero == 0) - { - if (numr != 0) - dep = format("%1c%1c%04d",sezione, lettera, numr); - else - dep = format("%c%c ",sezione,lettera); - } - else - { - if (numr != 0) - dep = format("%1c%1c%04d%02d",sezione, lettera, numr,numero); - else - dep = format("%c%c %02d",sezione,lettera,numero); - } - - tabivd.put("CODTAB", dep); - tabivd.read(); - dep2 = tabivd.get("CODTAB"); - if (dep == dep2) - TMP = tabivd.get("S0"); - else - TMP = ""; - return TMP; -} - -//Ricerca la descrizione relativa al gruppo da stampare - -const char* TMastrini_application::descrizione_gruppo() -{ - TLocalisamfile pconti(LF_PCON); - - pconti.zero(); - pconti.put(PCN_GRUPPO,_gruppo); - if (pconti.read() != NOERR) pconti.zero(); - TMP = pconti.get(PCN_DESCR); - return TMP; -} - -// Ricerca la descrizione relativa al conto da stampare - -const char* TMastrini_application::descrizione_conto() -{ - TLocalisamfile pconti(LF_PCON); - - pconti.zero(); - pconti.put(PCN_GRUPPO,_gruppo); - pconti.put(PCN_CONTO,_conto); - if (pconti.read() != NOERR) pconti.zero(); - TMP = pconti.get(PCN_DESCR); - return TMP; -} - -const char* TMastrini_application::descrizione_sottoconto() -{ - TLocalisamfile pconti(LF_PCON); - - pconti.zero(); - pconti.put(PCN_GRUPPO, _gruppo); - pconti.put(PCN_CONTO, _conto); - pconti.put(PCN_SOTTOCONTO, _sottoc); - if (pconti.read() != NOERR) pconti.zero(); - TMP = pconti.get(PCN_DESCR); - return TMP; -} - -bool TMastrini_application::user_create() -{ - TToken_string exp; - - _rel = new TRelation (LF_SALDI); - - exp.add("GRUPPO=GRUPPO"); - exp.add("CONTO=CONTO"); - exp.add("SOTTOCONTO=SOTTOCONTO"); - _rel->add(LF_RMOV,exp,2,LF_SALDI); - -// _cur1=add_cursor(new TCursor(_rel,"FLSCA=\"F\"",2)); - _cur1=add_cursor(new TCursor(_rel,"FLSCA=\" \"",2)); - _nditte = new TLocalisamfile (LF_NDITTE); - _unloc = new TLocalisamfile (LF_UNLOC); - _comuni = new TLocalisamfile (LF_COMUNI); - _mov = new TLocalisamfile (LF_MOV); - _clifo = new TLocalisamfile (LF_CLIFO); - _caus = new TLocalisamfile (LF_CAUSALI); - _tabivd = new TTable (TAB_IVD); - _tabtpd = new TTable (TAB_TPD); - _tabreg = new TTable (TAB_REG); - _tabesc = new TTable (TAB_ESC); - _sld = new TSaldo (); - - _d18 = new TParagraph_string ("",18); - _d23 = new TParagraph_string ("",23); - _d30 = new TParagraph_string ("",30); - - _msk = new TMask("cg3200a"); - -/* Guy: Provo a non usarli e uso i check normali - _msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); - _msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini); - _msk->set_handler(F_SOTTOCINI_FORN, sottoc_handler_ini); - _msk->set_handler(F_SOTTOCFINE_CONTO, sottoc_handler_fine); - _msk->set_handler(F_SOTTOCFINE_CLIENTE, sottoc_handler_fine); - _msk->set_handler(F_SOTTOCFINE_FORN, sottoc_handler_fine); -*/ - _msk->set_handler (F_GRUPPOFINE ,gruppo_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); - - _gia_stampata_intestazione = FALSE; - -// _msk->set_handler (F_SOTTOCFINE_CONTO ,sottoc_hnd); -// _msk->set_handler (F_SOTTOCFINE_CLIENTE ,sottoc_hnd); -// _msk->set_handler (F_SOTTOCFINE_FORN ,sottoc_hnd); - - return TRUE; -} - -bool TMastrini_application::user_destroy() -{ - delete _msk; - delete _rel; - delete _mov; - delete _nditte; - delete _unloc; - delete _comuni; - delete _clifo; - delete _caus; - delete _tabivd; - delete _tabtpd; - delete _tabreg; - delete _tabesc; - delete _sld; - delete _d18; - delete _d23; - delete _d30; - - return TRUE; - -} - -int cg3200(int argc, char* argv[]) -{ - - TMastrini_application a; - - a.run(argc, argv, "Stampa Mastrini"); - - return 0; -} - - +//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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cg3.h" +#include "cg3200.h" +#include "cglib.h" +#include "cglib04.h" +#include "cglib03.h" + +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 contoi_hnd (TMask_field& f, KEY k); + static bool contof_hnd (TMask_field& f, KEY k); + static bool sottoc_handler_ini (TMask_field& f, KEY k); + static bool sottoc_handler_fine (TMask_field& f, KEY k); + + static bool memorizza_handler(TMask_field& f, KEY k); + static bool scelte_notify(TSheet_field& s, int r, KEY k); + + TDociva_array _b; + TRelation* _rel; + TMask* _msk; + TTable* _tabivd, * _tabtpd, * _tabreg; + TLocalisamfile* _mov; + TLocalisamfile* _nditte; + TLocalisamfile* _unloc; + TLocalisamfile* _comuni; + TLocalisamfile* _clifo; + 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; + int _cur1,_gruppo,_conto,_numcarat,_stampanum,_numivd,_annoiva; + int _numrig,_natdoc,_tipo,_tipostampa,_g_prec,_c_prec,_numrivd_int; + real _progredare,_progreavere,_totprogre_dare_al,_totprogre_avere_al; + real _totprogre_dare,_totprogre_avere,_importo; + real _riporto_dare,_riporto_avere,_riporto_parziale_dare,_riporto_parziale_avere; + real _totale_periodo_dare,_totale_periodo_avere,_totale_prima_dare,_totale_prima_avere; + real _saldo_periodo,_saldo_progre,_saldo_progre_al,_saldo_progre_prec; + real _saldo_movimenti,_saldo_progressivi,_totale_saldo,_riporto_footer_dare,_riporto_footer_avere; + TString _ragsoc,_indulc,_civulc,_capulc,_com,_prov,_comulc; + long _codice_ditta,_s_prec; + TString _tipodoc,_codcaus,_descrcaus,_descrdociva,_regiva,_g_contr,_c_contr,_s_contr; + char _sezivd,_lettivd; + TString _descrizione,_sezione,_numdoc,_descrizionemov,_numrivd,_descr; + TString _dataregs, _datadocs; + int _gruppocontr,_contocontr,_nummast,_pagina; + long _sottocontocontr; + + bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov; + bool _stampato,_devi_stampare_footer; + + 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,_stampa_footer_si; + bool _cambia_mastrino,_gia_stampata_intestazione; + char _tmcf,_tipo_contr; + + TDate _dataregrmov; + 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(); + virtual bool set_print(int m); + + virtual bool preprocess_print(int file, int counter); + virtual bool preprocess_page (int,int); + virtual print_action postprocess_page (int,int); + virtual print_action postprocess_print(int,int); + virtual void preprocess_header(); + virtual void preprocess_footer(); + virtual void set_page(int,int); + virtual void process_link(int id, const char* txt); + + void set_handlers(TMask* msk) const; + bool mask2sheet(); + bool sheet2mask(); + +public: + TDate _inizioEs,_fineEs; + + int date2esc(const TDate& d); + void ricerca_clifo(); + void ricerca_gruppo(); + int ricerca_clifo(int riga); + int ricerca_gruppo(int riga); + + 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(); + int crea_intestazione(int riga); + void crea_intestazione(); + void fai_stampa132(); + void fai_stampa198(); + void stampa_totali132(); + 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); + const char* descrizione_gruppo(); + const char* descrizione_conto(); + const char* descrizione_sottoconto(); + const char* descrizione_classe(char,char,int,int); + bool almeno_un_record(); + 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() {} + virtual ~TMastrini_application() {} +}; + +inline 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"; + TToken_string ss(10); + ss.add("1"); + ss.add(txt); + + TMessage fs(cmd2name(app), MSG_LN, ss); + fs.send(); + + TExternal_app pn(app); + pn.run(); +} + +bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key) +{ + const short id = f.dlg(); + bool warning = FALSE; + + const int gruppo = f.mask().get_int(F_GRUPPOINI); + + int conto; + 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 ) + { + if (sottoconto != 0 && conto == 0) + return f.warning_box("Manca il CONTO"); + + if (conto != 0 && gruppo == 0) + return f.warning_box("Manca il GRUPPO"); + } + + if ( key == K_TAB && f.mask().is_running()) + { + TString ds; + if (id == F_SOTTOCINI_CONTO) + { + TLocalisamfile pconti(LF_PCON); + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto); + pconti.put(PCN_SOTTOCONTO, sottoconto); + 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_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"); + } + else + if (id == F_SOTTOCINI_CLIENTE || id == F_SOTTOCINI_FORN) + { + TString rs; + char tipo = id == F_SOTTOCINI_CLIENTE ? 'C' : 'F'; + TLocalisamfile clifo (LF_CLIFO); + if (sottoconto != 0) + { + 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_DESCRINI_CLIENTE, rs); + f.mask().set(F_DESCRINI_FORN, rs); + + if (warning) + return f.warning_box("Anagrafica inesistente"); + } + } + } + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// Inizio modifica del 02-05-95 riguardo controlli di validita' su gruppo, // +// conto e sottoconto iniziale e finale. // +///////////////////////////////////////////////////////////////////////////// + +bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key) +{ + const short id = f.dlg(); + int conto; + TString ds; + TString80 rs; + bool warning; + + 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 ) + { + if (sottoconto != 0 && conto == 0) + return f.warning_box("Manca il CONTO"); + + if (conto != 0 && gruppo == 0) + return f.warning_box("Manca il GRUPPO"); + + if (!app().check_ordine(f,key)) + return FALSE; + } + + if ( key == K_TAB && f.mask().is_running()) + { + if (id == F_SOTTOCFINE_CONTO) + { + TLocalisamfile pconti (LF_PCON); + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto); + pconti.put(PCN_SOTTOCONTO, sottoconto); + 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"); + } + else + if (id == F_SOTTOCFINE_CLIENTE || id == F_SOTTOCFINE_FORN) + { + char tipo = id == F_SOTTOCFINE_CLIENTE ? 'C' : 'F'; + TLocalisamfile clifo (LF_CLIFO); + if (sottoconto != 0) + { + 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); + + if (gruppof == 0) + return TRUE; + + int gruppoi = f.mask().get_int(F_GRUPPOINI); + + if (gruppoi > gruppof) + return f.error_box("Il gruppo di partenza deve essere inferiore o uguale al gruppo di arrivo"); + } + + return TRUE; +} + +bool TMastrini_application::contoi_hnd (TMask_field& f, KEY k) +{ + TLocalisamfile pconti (LF_PCON); + TString ds; + + const short id = f.dlg(); + + if (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); + + if (gruppof == 0) + return TRUE; + + int gruppoi = f.mask().get_int(F_GRUPPOINI); + + if (gruppoi < gruppof) + return TRUE; + + 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_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; +} + +///////////////////////////////////////////////////////////////////////////// +// FINE MODIFICA DEL 02-05-95 // +///////////////////////////////////////////////////////////////////////////// + +bool TMastrini_application::check_ordine(TMask_field& f, KEY k) +{ + const int gruppof = f.mask().get_int(F_GRUPPOFINE); + + if (gruppof == 0) + return TRUE; + + const int gruppoi = f.mask().get_int(F_GRUPPOINI); + + if (gruppoi < gruppof) + return TRUE; + + int contof = f.mask().get_int(F_CONTOFINE_CONTO); + int contoi = f.mask().get_int(F_CONTOINI_CONTO); + + if (contoi < contof) + return TRUE; + + 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"); + + return TRUE; +} + +bool TMastrini_application::memorizza_handler(TMask_field& f, KEY k) +{ + bool ok = TRUE; + if (k == K_SPACE) + ok = app().mask2sheet(); + return ok; +} + +bool TMastrini_application::scelte_notify(TSheet_field& s, int r, KEY k) +{ + bool ok = TRUE; + if (k == K_INS) + return ok = FALSE; + return ok; +} + +int TMastrini_application::date2esc(const TDate& d) +{ + TEsercizi_contabili esc; + return esc.date2esc(d); +} + +//Questa funzione restituisce vero se il record su piano dei conti ha almeno un +//record figlio (e che soddisfa la condizione riguardante la data di registr.). +//Viene successivamente utilizzata per stampare l'intestazione (e i totali) +//oppure no + +bool TMastrini_application::almeno_un_record() +{ + bool trovato=FALSE; + long record,sottoc; + int gruppo,conto; + TDate datareg, datacomp; + TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); + + if (current_cursor()->is_first_match(LF_RMOV)) + { + record = rmov.recno(); + rmov.zero(); + rmov.put(RMV_GRUPPO, _gruppo); + rmov.put(RMV_CONTO, _conto); + rmov.put(RMV_SOTTOCONTO, _sottoc); + for (rmov.read(); !rmov.eof() ;rmov.next()) + { + int annoes = rmov.get_int (RMV_ANNOES); + long numreg = rmov.get_long(RMV_NUMREG); + + _mov->setkey(1); + _mov->curr().zero(); + _mov->curr().put(MOV_NUMREG,numreg); + _mov->read(); + if (_mov->bad()) + _mov->zero(); + datacomp = (_mov->curr().get(MOV_DATACOMP)); + TString provvis (_mov->curr().get(MOV_PROVVIS)); + + if (_annomsk == 0) + datareg = rmov.get_date(RMV_DATAREG); + else + if (_annomsk != 0) + datareg = datacomp; + + gruppo = rmov.get_int(RMV_GRUPPO); + conto = rmov.get_int(RMV_CONTO); + sottoc = rmov.get_long(RMV_SOTTOCONTO); + if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) + break; + else + if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.trim().empty())) + { + trovato = TRUE; + break; + } + } + rmov.readat(record); + } + return trovato; +} + +bool TMastrini_application::data_inizio(TMask_field& f, KEY k) +{ + const TDate data = f.mask().get (F_DATAINI); + const int anno = f.mask().get_int(F_ANNO); + app()._annomsk = anno; + + if (k == K_ENTER) + { + if (anno != 0) + { + app().data_fine_esercizio(anno); + + if (data == botime) + app()._data_ini = app()._data_inizioese; + else + { + if (data < app()._data_inizioese || data > app()._data_finese) + { + f.error_box("La data non appartiene all'esercizio indicato"); + return FALSE; + } + else + app()._data_ini = data; + } + } + else + { + if (anno == 0) + { + if (data == botime) + { + f.error_box("La data deve essere obbligatoriamente indicata"); + return FALSE; + } + else + app()._data_ini = data; + } + } + } + return TRUE; +} + +bool TMastrini_application::data_fine(TMask_field& f, KEY k) +{ + int annoes; + TDate data, data_ini; + + annoes = f.mask().get_int(F_ANNO); + data = f.mask().get (F_DATAFINE); + data_ini = f.mask().get (F_DATAINI); + app()._annomsk = annoes; + + if (k == K_ENTER) + { + if (annoes != 0) + { + app().data_fine_esercizio(annoes); + + if (data == botime) + app()._data_fine = app()._data_finese; + else + if (data < app()._data_inizioese || data > app()._data_finese) + { + f.error_box("La data non appartiene all'esercizio indicato"); + return FALSE; + } + else + app()._data_fine = data; + } + else + if (annoes == 0) + { + if (data == botime) + { + f.error_box("La data deve essere obbligatoriamente indicata"); + return FALSE; + } + + app()._anno_ghost = app().date2esc(data_ini); + + app()._inizioes = app()._inizioEs; + + if (data < app()._inizioEs || data > app()._fineEs) + { + f.error_box("La data non appartiene all'esercizio indicato"); + return FALSE; + } + else + app()._data_fine = data; + } + + if (data < data_ini) + { + f.error_box("La data finale non puo' essere inferiore alla data di partenza"); + return FALSE; + } + + + } + return TRUE; +} + +void TMastrini_application::saldi_zero() +{ + TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); + real saldo_dare, saldo_avere; + long record; + + saldo_dare = saldo_avere = 0; + + if (current_cursor()->is_first_match(LF_RMOV)) + { + record = rmov.recno(); + + while (!rmov.eof()) + { + long numreg = rmov.get_long(RMV_NUMREG); + _mov->setkey(1); + _mov->curr().zero(); + _mov->curr().put(MOV_NUMREG,numreg); + _mov->read(); + if (_mov->bad()) + _mov->zero(); + TString provvis (_mov->curr().get(MOV_PROVVIS)); + int gruppo = atoi(rmov.get(RMV_GRUPPO)); + int conto = atoi(rmov.get(RMV_CONTO)); + long sottoc = atol(rmov.get(RMV_SOTTOCONTO)); + + if ((gruppo == _gruppo)&&(conto == _conto)&&(sottoc == _sottoc)) + { + if (_stampa_mov_prov || provvis.trim().empty()) + { + char sezione = rmov.curr().get(RMV_SEZIONE)[0]; + real importo = rmov.curr().get_real(RMV_IMPORTO); + if (sezione == 'D') + saldo_dare += importo; + else if (sezione == 'A') + saldo_avere += importo; + } + } + else break; + rmov.next(); + } + rmov.readat(record); + } + _totale_saldo = saldo_dare - saldo_avere; +} + +void TMastrini_application::fai_stampa132() +{ + 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); + + if (_item != 0) + { + 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; + + if (_item != 0) + _riga.destroy(); + } + + set_row (_rw,"@0g#t", &_dataregs); + if (_stampanum == 1) + set_row (_rw,"@11g$[r]#7d$[n]", &_numreg); + else + if (_stampanum == 2) + { + set_row (_rw,"@11g#7d", &_numgio); + } + + set_row (_rw,"@19g#t", &_datadocs); + set_row (_rw,"@30g#7t", &_numdoc); + set_row (_rw,"@38g#3t", &_codcaus); + + 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() +{ + 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); + + if (_item != 0) + { + 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; + + if (_item != 0) + _riga.destroy(); + } + + set_row (_rw,"@0g#t", &_dataregs); + if (_stampanum == 1) + { + set_row (_rw,"@11g$[r]#7d$[n]", &_numreg); + set_row (_rw,"@18g/#3d", &_numrig); + } + else if (_stampanum == 2) + set_row (_rw,"@11g#7d", &_numgio); + + set_row (_rw,"@23g#t", &_datadocs); + set_row (_rw,"@34g#7t", &_numdoc); + set_row (_rw,"@42g#3t", &_codcaus); + +// Stampa saldo movimenti + + set_row (_rw,"@149g#t", &_saldo_movimenti_str); + + set_row (_rw,"@165g#3t", &_g_contr); + set_row (_rw,"@169g#3t", &_c_contr); + set_row (_rw,"@173g#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(_rw++,"@0g%s", (const char *) sep); + + _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; + TString string = _saldo_periodo.string("###.###.###.###"); + set_row (_rw,"@32gTOTALI PERIODO@69g%15s", (const char*)string); + string = _totale_periodo_dare.string("###.###.###.###"); + set_row (_rw,"@85g%15s", (const char*)string); + string = _totale_periodo_avere.string("###.###.###.###"); + set_row (_rw++,"@101g%15s", (const char*)string); + string = _saldo_progre.string("###.###.###.###"); + set_row (_rw,"@32gTOTALI PROGRESSIVI@69g%15s", (const char*)string); + string = _totprogre_dare.string("###.###.###.###"); + set_row (_rw,"@85g%15s", (const char*)string); + string = _totprogre_avere.string("###.###.###.###"); + set_row (_rw++,"@101g%15s", (const char*)string); + if (_stampaprogre) //Progressivi attuali + { + TString str = _saldo_progre_al.string("###.###.###.###"); + 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 (_rw,"@85g%15s", (const char*)str); + str = _totprogre_avere_al.string("###.###.###.###"); + set_row (_rw,"@101g%15s", (const char*)str); + } + _devi_stampare_footer = FALSE; +} + +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(); + + _devi_stampare_footer = FALSE; +} + +void TMastrini_application::stampa_totali198() +{ + TString sep(198); + + if (_nummast == 1 || _nummast == 3) + _rw = 1; + + sep.fill('-'); //Stampa 198 - (sep(198)) + 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 (_rw,"@32gTOTALI PERIODO@101g%15s", (const char*)string); + string = _totale_periodo_avere.string("###.###.###.###"); + set_row (_rw,"@117g%15s", (const char*)string); + string = _saldo_movimenti.string("###.###.###.###"); + set_row (_rw++,"@149g%15s", (const char*)string); + string = _totprogre_dare.string("###.###.###.###"); + set_row (_rw,"@32gTOTALI PROGRESSIVI@101g%15s",(const char*)string); + string = _totprogre_avere.string("###.###.###.###"); + set_row (_rw,"@117g%15s", (const char*)string); + string = _saldo_progressivi.string("###.###.###.###"); + set_row (_rw++,"@133g%15s", (const char*)string); + if (_stampaprogre) //Progressivi attuali + { + set_row(_rw,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); + TString str = _totprogre_dare_al.string("###.###.###.###"); + set_row (_rw,"@101g%15s", (const char*)str); + str = _totprogre_avere_al.string("###.###.###.###"); + set_row (_rw,"@117g%15s", (const char*)str); + str = _saldo_progressivi.string("###.###.###.###"); + set_row (_rw,"@133g%15s", (const char*)str); + } + _devi_stampare_footer = FALSE; +} + +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@101g%15s@117g%15s@149g%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@101g%15s@117g%15s@133g%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@101g%15s@117g%15s@133g%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(); + + _devi_stampare_footer = FALSE; +} + +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; + TString datasuccstring,dataregrmovstring; + int gruppof,contof; + long sottocf; + TString provvis = ""; + int annoes; + + if (counter) + return TRUE; + + switch (file) + { + case LF_SALDI: + +// Usati in crea_intestazione() + + _devi_stampare_footer = TRUE; + + 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); + + if (annoes != _anno_corrente && annoes != _anno_precedente) + return FALSE; + + if (_g_prec == _gruppo && _c_prec == _conto && _s_prec == _sottoc) + return FALSE; + + _g_prec = _gruppo; + _c_prec = _conto; + _s_prec = _sottoc; + + _saldo_periodo = ZERO; + _totale_periodo_dare = ZERO; + _totale_periodo_avere = ZERO; + _saldo_progre = ZERO; + _totprogre_dare = ZERO; + _totprogre_avere = ZERO; + _saldo_progre_al = ZERO; + _totprogre_dare_al = ZERO; + _totprogre_avere_al = ZERO; + _progredare = ZERO; + _progreavere = ZERO; + _totale_prima_dare = ZERO; + _totale_prima_avere = ZERO; + _saldo_movimenti = ZERO; + _saldo_progressivi = ZERO; + _saldo_progre_prec = ZERO; + if (_tipostampa == 2) + saldi_zero(); + else + _totale_saldo = 1; + + if ((_tipostampa == 1) || (_tipostampa == 2)) + { + if ((almeno_un_record()) && (_totale_saldo != 0)) + { + _puoi_stampare = TRUE; + + if (_nummast == 3 || _nummast == 2) + { + int cur_row = printer().formlen() - printer().rows_left(); + int diff = printer().formlen() - cur_row; + if (diff <= 13 && diff != 0) + printer().formfeed(); + + _rw = crea_intestazione(_rw); + calcola_progressivi(); + _saldo_progressivi += _saldo_progre_prec; + _rw = stampa_progre_riporto(_rw); + } + } + else + { + _puoi_stampare = FALSE; + return FALSE; + } + } + else + if (_tipostampa == 3) + { + if (_nummast == 2 || _nummast == 3) + calcola_progressivi(); + if (_progredare == ZERO && _progreavere == ZERO && !almeno_un_record()) + { + _puoi_stampare = FALSE; + return FALSE; + } + else + { + _puoi_stampare = TRUE; + + if (_nummast == 3 || _nummast == 2) + { + int cur_row = printer().formlen() - printer().rows_left(); + int diff = printer().formlen() - cur_row; + if (diff <= 13 && diff != 0) + printer().formfeed(); + + _rw = crea_intestazione(_rw); + _saldo_progressivi += _saldo_progre_prec; + _rw = stampa_progre_riporto(_rw); + } + } + } + break; + + case LF_RMOV: + { + //Il flag _gia_stampata_intestazione serve nella stampa in continuo, xche' + //sono costretto a richiamare l'intestazione sia nella preprocess_page (per + //i mastrini con intestazione a meta' pagina), sia nella preprocess_header + //per i mastrini che si trovano a cavallo fra una pagina e quella successiva. + //In quest'ultimo caso infatti quando vado a pagina nuova devo stampare l'intestazione + //ma senza il flag rischio di stamparla due volte. + if (_nummast == 3) + _gia_stampata_intestazione = FALSE; + + 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)); + _numrig = atoi (current_cursor()->curr(LF_RMOV).get(RMV_NUMRIG)); + + _gruppocontr = rmov.get_int (RMV_GRUPPOC); + _contocontr = rmov.get_int (RMV_CONTOC); + _sottocontocontr = rmov.get_long(RMV_SOTTOCONTOC); + _g_contr = rmov.get(RMV_GRUPPOC); + _c_contr = rmov.get(RMV_CONTOC); + _s_contr = rmov.get(RMV_SOTTOCONTOC); + + // Stampa solo quelli che hanno anno esercizio uguale a quello specificato + // nella maschera. Se non viene specificato li stampa tutti + + _importo = current_cursor()->curr(LF_RMOV).get_real(RMV_IMPORTO); + _importo_str = _importo.string("###.###.###.###"); + _mov->setkey(1); + _mov->curr().zero(); + _mov->curr().put(MOV_NUMREG,_numreg); + _mov->read(); + if (_mov->bad()) + _mov->zero(); + _annoes = _mov->get_int(MOV_ANNOES); + _regiva = _mov->curr().get(MOV_REG); + _annoiva = _mov->curr().get_int(MOV_ANNOIVA); + + // Controlla se saldo e' diverso da 0 + + if (((_annoes == _annomsk) || (_annomsk == 0)) && (_totale_saldo != 0)) + { + _sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE); + + if (_annomsk == 0) + { + _datareg = (_mov->curr().get(MOV_DATAREG)); + _datareg_stampa = _datareg; + } + else + if (_annomsk != 0) + { + _datareg = _mov->curr().get(MOV_DATACOMP); + _datareg_stampa = _mov->curr().get(MOV_DATAREG); + } + + provvis = _mov->curr().get(MOV_PROVVIS); + + _dataregs = _datareg_stampa.string(); + + if ((_stampa_mov_prov)||((!_stampa_mov_prov)&&(provvis.trim().empty()))) + { + if ((_datareg >= _data_ini) && (_datareg <= _data_fine)) + { + // Determino l' anno di competenza dell' operazione in esame + int anno = date2esc(_datareg_stampa); + if (anno != _annoes) + if (_numcarat == 1) + set_row (_rw, "@131g*"); + else + if (_numcarat == 2) + set_row (_rw, "@197g*"); + + if (_stampa_mov_prov && provvis.trim().not_empty()) + if (_numcarat == 1) + set_row(_rw, "@129gP"); + else + if (_numcarat == 2) + set_row(_rw, "@195gP"); + + _codcaus = _mov->curr().get(MOV_CODCAUS); + _tipodoc = _mov->curr().get(MOV_TIPODOC); + if (_stampatotiva && (_tmcf == 'C' || _tmcf == 'F')) + { + if (_tipodoc != "") + { + documenti_iva(); + _b.add_riga(_descrdociva,_importo, _natdoc); + if (_descrdociva.len() > _ddociva_len) + _ddociva_len = _descrdociva.len(); + } + } + _datadoc = (_mov->curr().get(MOV_DATADOC)); + _datadocs = _datadoc.string(); + _numdoc = _mov->curr().get(MOV_NUMDOC); + descrizione_causale(); + _descrizionemov = _mov->curr().get(MOV_DESCR); + _numgio = atol(_mov->curr().get(MOV_NUMGIO)); + + _descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR); + + if (_nummast == 1 || _nummast == 3) + { + if (_numcarat == 1) // Stampa 132 caratteri + { + if (_descrizione != "") + { + *_d23 = (const char*) _descrizione; + if (_descrizionemov != "") + { + *_d18 = (const char*) _descrizionemov; + set_row(_rw, "@42g#a", _d18); + set_row(_rw, "@61g#a", _d23); + } + else if (_descrizionemov == "") + { + *_d18 = (const char*) _descrcaus; + set_row(_rw, "@42g#a", _d18); + set_row(_rw, "@61g#a", _d23); + } + } + else if (_descrizione == "") + if (_descrizionemov != "") + { + *_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); + 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 (_rw,"@42g#a", _d18); + if (descr_contr != "Sconosciuto") + { + *_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 ) + { + int app = 0; + riga = (printer().formlen() / 2); + if (printer().rows_left() == 0) + app = printer().formlen() - _rw; + else + app = printer().rows_left(); + cur_row = printer().formlen() - app; + diff = riga - cur_row; + } + else + { + riga = printer().formlen(); + cur_row = printer().formlen() - printer().rows_left(); + diff = riga - cur_row; + } + + bool stampa_riporti; + + int lim = 0; + if (_item >= diff) + { + lim = diff - 1; + stampa_riporti = TRUE; + } + else + { + lim = _item; + stampa_riporti = FALSE; + } + + _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++; + } + if (stampa_riporti) + { + _rw = k; + if (lim == 0) + { + if (_numcarat == 1) + { + TString app (132); + app.spaces(); + set_row (_rw, "@0g%s", (const char*) app); + } + else + { + TString app (198); + app.spaces(); + set_row (_rw, "@0g%s", (const char*) app); + } + } + real dep_dare,dep_avere; + if (_stampa_footer_si) + { + _riporto_footer_dare = _progredare + _riporto_parziale_dare; + _riporto_footer_avere = _progreavere + _riporto_parziale_avere; + + real imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + if (lim != 0) + { + _riporto_footer_dare += imp_d; + _riporto_footer_avere += imp_a; + } + dep_dare = _riporto_footer_dare; + dep_avere = _riporto_footer_avere; + + _stampa_footer_si = FALSE; + } + else + { + _riporto_footer_dare += _riporto_parziale_dare; + _riporto_footer_avere += _riporto_parziale_avere; + + real imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + if (lim != 0) + { + _riporto_footer_dare += imp_d; + _riporto_footer_avere += imp_a; + } + dep_dare = _riporto_footer_dare; + dep_avere = _riporto_footer_avere; + } + + if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) + { + TString dare (dep_dare.string("###.###.###.###")); + TString avere (dep_avere.string("###.###.###.###")); + if (_numcarat == 1) + { + set_row (_rw,"@32gA RIPORTO@85g%s", (const char*) dare); + set_row (_rw,"@101g%s", (const char*) avere); + } + else + if (_numcarat == 2) + { + set_row (_rw,"@32gA RIPORTO@101g%s", (const char*) dare); + set_row (_rw,"@117g%s", (const char*) avere); + } + } + if (lim == 0) + { + rmov.prev(); + _riga.destroy(); + _item = 0; + return TRUE; + } + _rw--; +// return TRUE; + } + //_riga.destroy(); + } //if (_nummast == 2) + + if (_sezione == "D") + { + _totale_periodo_dare += _importo; + _riporto_parziale_dare += _importo; + + if (_numcarat == 1) // Stampa 132 caratteri + set_row (_rw,"@85g%s", (const char*) _importo_str); + else + if (_numcarat == 2) // Stampa 198 caratteri + { + _saldo_progressivi += _importo; + _saldo_movimenti += _importo; + set_row (_rw,"@101g%s", (const char*) _importo_str); + } + } + else if (_sezione == "A") + { + _totale_periodo_avere += _importo; + _riporto_parziale_avere += _importo; + + if (_numcarat == 1) // Stampa 132 caratteri + set_row (_rw,"@101g%s", (const char*) _importo_str); + else + if (_numcarat == 2) // Stampa 198 caratteri + { + _saldo_progressivi -= _importo; + _saldo_movimenti -= _importo; + set_row (_rw,"@117g%s", (const char*) _importo_str); + } + } + + const int righe_rimaste = printer().rows_left(); + _stampato = righe_rimaste >= 1; + + _saldo_progressivi_str=_saldo_progressivi.string("###.###.###.###"); + _saldo_movimenti_str=_saldo_movimenti.string("###.###.###.###"); + if (_numcarat == 2) + { + ricerca_regiva(); + _protiva = atol(_mov->curr().get(MOV_PROTIVA)); + if (_protiva != 0) + set_row (_rw,"@189g%5d", _protiva); + + if (_tipo < 3) + set_row (_rw,"@180g#t" , &_regiva); + _dataregrmov = current_cursor()->curr(LF_RMOV).get_date(RMV_DATAREG); + dataregrmovstring=_dataregrmov.string(); + +//Gestire la stampa di saldo_progressivi nella postprocess_page di RMOV + + rec = rmov.recno(); + rmov.next(); + gruppof = rmov.get_int(RMV_GRUPPO); + contof = rmov.get_int(RMV_CONTO); + sottocf = rmov.get_int(RMV_SOTTOCONTO); + datasucc = rmov.get_date(RMV_DATAREG); + datasuccstring=datasucc.string(); + if (((gruppof!=_gruppo)||(contof!=_conto)||(sottocf!=_sottoc))||(rmov.eof())) + datasucc = (""); + if (datasucc != _dataregrmov) + set_row (_rw,"@133g#t", &_saldo_progressivi_str); + rmov.readat(rec); + } + _rw = 1; + + return TRUE; + } + else + return FALSE; + } + else + return FALSE; + } + else + return FALSE; + break; + } + default: + break; + } + return TRUE; +} + +void TMastrini_application::set_page(int file, int counter) +{ + switch (file) + { + case LF_SALDI: + reset_print(); + break; + + case LF_RMOV: + reset_print(); + if (_numcarat == 1) + fai_stampa132(); + else if (_numcarat == 2) + fai_stampa198(); + break; + default: + break; + } +} + +print_action TMastrini_application::postprocess_page(int file, int counter) +{ + if (_nummast == 1 || _nummast == 3) + { + 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; + _stampa_footer_si = TRUE; + _riporto_dare = ZERO; + _riporto_avere = ZERO; + _riporto_footer_dare = ZERO; + _riporto_footer_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; + _stampa_footer_si = TRUE; + _riporto_dare = ZERO; + _riporto_avere = ZERO; + _riporto_footer_dare = ZERO; + _riporto_footer_avere = ZERO; + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + _ddociva_len = 0; + + return NEXT_PAGE; + } + } + + switch (file) + { + case LF_SALDI: + { + if (_nummast == 1 || _nummast == 3) + { + if (_tipostampa == 3) + { + reset_print(); + 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 (_tipostampa == 1) + { + reset_print(); + if (_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_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; + _prima_volta = TRUE; + return REPEAT_PAGE; + } + case LF_RMOV: + force_setpage(); + break; + default: + break; + } + return NEXT_PAGE; +} + +print_action TMastrini_application::postprocess_print(int file, int counter) +{ + if (file == LF_SALDI) + { + _msk->reset(F_TIPOCF_INI); + + _msk->reset(F_GRUPPOINI); + + _msk->reset(F_CONTOINI_CONTO); + _msk->reset(F_CONTOINI_CLIENTE); + _msk->reset(F_CONTOINI_FORN); + + _msk->reset(F_SOTTOCINI_CONTO); + _msk->reset(F_SOTTOCINI_CLIENTE); + _msk->reset(F_SOTTOCINI_FORN); + + _msk->reset(F_DESCRINI_CONTO); + _msk->reset(F_DESCRINI_CLIENTE); + _msk->reset(F_DESCRINI_FORN); + + _msk->reset(F_TIPOCF_FINE); + + _msk->reset(F_GRUPPOFINE); + + _msk->reset(F_CONTOFINE_CONTO); + _msk->reset(F_CONTOFINE_CLIENTE); + _msk->reset(F_CONTOFINE_FORN); + + _msk->reset(F_SOTTOCFINE_CONTO); + _msk->reset(F_SOTTOCFINE_CLIENTE); + _msk->reset(F_SOTTOCFINE_FORN); + + _msk->reset(F_DESCRFINE_CONTO); + _msk->reset(F_DESCRFINE_CLIENTE); + _msk->reset(F_DESCRFINE_FORN); + } + return NEXT_PAGE; +} +// Stampa dei totali documenti iva se richiesta + +void TMastrini_application::stampa_totaliiva() +{ + real totale; + + 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 +// sull'archivio CAUS.dta + +void TMastrini_application::descrizione_causale() +{ + _caus->setkey(1); + _caus->curr().zero(); + _caus->curr().put(CAU_CODCAUS, _codcaus); + _caus->read(); + if (_caus->bad()) + _caus->zero(); + _descrcaus = _caus->curr().get(CAU_DESCR); +} + +// Ricerca sulla tabella dei tipi documento, la descrizione e la natura del +// documento, accedendovi tramite il tipo documento trovato su MOV.dta + +void TMastrini_application::documenti_iva() +{ + TString dep; + + _tabtpd->curr().zero(); + dep << format ("%2s",(const char*) _tipodoc); + _tabtpd->curr().put("CODTAB", (const char*) dep); + _tabtpd->read(); + _descrdociva = _tabtpd->curr().get("S0"); + _natdoc = atoi(_tabtpd->curr().get("I0")); +} + +void TMastrini_application::ricerca_regiva() +{ + TString16 dep; + + _tabreg->curr().zero(); + dep << format("%04d", _annoiva); + dep << format("%3s" , (const char*) _regiva); + _tabreg->curr().put("CODTAB", (const char*) dep); + _tabreg->read(); + _tipo = _tabreg->get_int("I0"); +} + +bool TMastrini_application::preprocess_print(int file, int counter) +{ + if (file == LF_SALDI) + { + _g_prec = 0; + _c_prec = 0; + _s_prec = 0; + + _saldo_periodo = ZERO; + _totale_periodo_dare = ZERO; + _totale_periodo_avere = ZERO; + _saldo_progre = ZERO; + _totprogre_dare = ZERO; + _totprogre_avere = ZERO; + _saldo_progre_al = ZERO; + _totprogre_dare_al = ZERO; + _totprogre_avere_al = ZERO; + _progredare = ZERO; + _progreavere = ZERO; + _totale_prima_dare = ZERO; + _totale_prima_avere = ZERO; + _saldo_movimenti = ZERO; + _saldo_progressivi = ZERO; + _saldo_progre_prec = ZERO; + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + _protiva = 0; + + _prima_volta = TRUE; + + _stampa_progressivi_si = TRUE; + _stampa_footer_si = TRUE; + } + + return TRUE; +} + +bool TMastrini_application::set_print(int) +{ + _puoi_stampare = TRUE; + + KEY tasto; + + // Controlla se esistono impostazioni di stampa in coda + if (sheet2mask()) + { + tasto = K_ENTER; + } + else + { + tasto = _msk->run(); + if (tasto == K_ENTER) + { + mask2sheet(); // Forza la maschera corrente in coda + sheet2mask(); // Estrae la prima dalla coda + } + } + + if (tasto == K_ENTER) + { + _codice_ditta = get_firm(); + _annomsk = _msk->get_int(F_ANNO); + + int gruppoini = _msk->get_int(F_GRUPPOINI); + int contoini = _msk->get_int(F_CONTOINI_CONTO); + long sottocontoini = _msk->get_long(F_SOTTOCINI_CONTO); + int gruppofine = _msk->get_int(F_GRUPPOFINE); + int contofine = _msk->get_int(F_CONTOFINE_CONTO); + long sottocontofine = _msk->get_long(F_SOTTOCFINE_CONTO); + + _stampaprogre = _msk->get_bool(F_STAMPAPROGRE); + _stampatotiva = _msk->get_bool(F_STAMPATOTIVA); + _stampanum = _msk->get_int(F_STAMPANUM); + _stampa_mov_prov = _msk->get_bool(F_STAMPAMOVPROV); + _tipostampa = _msk->get_int(F_TIPOSTAMPA); + + _numcarat = _msk->get_int(F_NUMCARAT); + int formato = _msk->get_int(F_FORMATO); + _nummast = _msk->get_int(F_NUMMAST); + + ricerca_dati_ditta(); + + if (_annomsk != 0) + _anno_corrente = _annomsk; + else + if (_annomsk == 0) + _anno_corrente = _anno_ghost; + + TEsercizi_contabili esc; + _anno_precedente = esc.pred(_anno_corrente); + + if (_nummast == 1 || _nummast == 3) + printer().footerlen(4); + else + printer().footerlen(2); + +//Crea il cursore su gruppo, conto e sottoconto del file RMOV + + reset_files(); //resetta l'albero di stampa + add_file(LF_SALDI); + add_file(LF_RMOV,LF_SALDI); + + select_cursor(_cur1); + + TLocalisamfile* fl = &(current_cursor()->file(LF_SALDI)); + TRectype da (fl->curr()); + TRectype a (fl->curr()); + + da.zero(); + a.zero(); + + da.put(SLD_GRUPPO,gruppoini); + da.put(SLD_CONTO,contoini); + da.put(SLD_SOTTOCONTO,sottocontoini); + + a.put(SLD_GRUPPO,gruppofine); + a.put(SLD_CONTO,contofine); + a.put(SLD_SOTTOCONTO,sottocontofine); + + current_cursor()->setregion(da, a); + + if (_stampatotiva) + _b.destroy(); + + //_inizio_stampa = TRUE; + _numero_pag = 1; + if (_nummast == 3) + _pagina = 0; + else + _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; + break; + case 2: _totale_saldo = 0; + break; + case 3: _totale_saldo = 1; + break; + default: break; + } + + enable_print_menu(); + + enable_link("Collegamento prima nota: ", 'r'); + + return TRUE; + } + else + return FALSE; +} + +void TMastrini_application::data_fine_esercizio(int anno) +{ + TEsercizi_contabili esc; + _data_finese = esc[anno].fine(); + _data_inizioese = esc[anno].inizio(); +} + +void TMastrini_application::preprocess_header() +{ + 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(); + } + else + if (_nummast == 3 && !_gia_stampata_intestazione) + { + 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::preprocess_footer() +{ + reset_footer(); + + if (_nummast != 1 && _nummast != 3) + return; + + if (_devi_stampare_footer) + { + real dep_dare,dep_avere; + + if (_stampa_footer_si) + { + _riporto_footer_dare = _progredare + _riporto_parziale_dare; + _riporto_footer_avere = _progreavere + _riporto_parziale_avere; + + real imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_footer_dare : _riporto_footer_dare - imp_d; + dep_avere = _stampato ? _riporto_footer_avere : _riporto_footer_avere - imp_a; + + _stampa_footer_si = FALSE; + } + else + { + _riporto_footer_dare += _riporto_parziale_dare; + _riporto_footer_avere += _riporto_parziale_avere; + + real imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_footer_dare : _riporto_footer_dare - imp_d; + dep_avere = _stampato ? _riporto_footer_avere : _riporto_footer_avere - imp_a; + } + + if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) + { + TString dare (dep_dare.string("###.###.###.###")); + TString avere (dep_avere.string("###.###.###.###")); + if (_numcarat == 1) + { + set_footer (2,"@32gA RIPORTO@85g%s", (const char*) dare); + set_footer (2,"@101g%s", (const char*) avere); + } + else + if (_numcarat == 2) + { + set_footer (2,"@32gA RIPORTO@101g%s", (const char*) dare); + set_footer (2,"@117g%s", (const char*) avere); + } + } + } +} + +void TMastrini_application::conto(int gruppo, int conto, bool no_contropartita) +{ + TLocalisamfile pconti(LF_PCON); + + pconti.setkey(1); + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo); + pconti.put(PCN_CONTO , conto); + pconti.read(); + if (pconti.bad()) + pconti.zero(); + + if (no_contropartita) + { + _indbil = pconti.get_int(PCN_INDBIL); + _tmcf = pconti.get_char(PCN_TMCF); + } + else + _tipo_contr = pconti.get_char(PCN_TMCF); +} + +void TMastrini_application::ricerca_dati_ditta() +{ + long app; + + _nditte->setkey(1); + _nditte->curr().zero(); + _nditte->curr().put(NDT_CODDITTA,_codice_ditta); + _nditte->read(); + app=_nditte->curr().get_long(NDT_CODDITTA); + _ragsoc=_nditte->curr().get(NDT_RAGSOC); + + _unloc->setkey(1); + _unloc->curr().zero(); + _unloc->curr().put(ULC_CODDITTA,app); + _unloc->curr().put(ULC_CODULC,"1"); + _unloc->read(); + _indulc=_unloc->curr().get(ULC_INDULC); + _civulc=_unloc->curr().get(ULC_CIVULC); + int len = _indulc.len(); + if (len <= 31) + { + if (len <= 26) + _indulc << " " << _civulc; + else + _indulc << " " << _civulc.mid(0,5); + } + else + { + _indulc = _indulc.mid(0,31); + _indulc << " " << _civulc.mid(0,5); + } + _capulc=_unloc->curr().get(ULC_CAPULC); + _comulc=_unloc->curr().get(ULC_COMULC); + + _comuni->setkey(1); + _comuni->zero(); + _comuni->put(COM_COM,_comulc); + _comuni->read(); + if (_comuni->good()) + { + _com=_comuni->get(COM_DENCOM); + _prov=_comuni->get(COM_PROVCOM); + } + else + { + _com=""; + _prov=""; + } +} + +// Crea l'intestazione per la stampa a 132 e a 198 caratteri + +void TMastrini_application::crea_intestazione() +{ + TString sep(132),sep1(198); + sep = ""; + + reset_header(); + + int np = get_page_number(); + + if (_cambia_mastrino) + { + if (_nummast != 3) + _pagina = 1; + _cambia_mastrino = FALSE; + } + if (_numcarat == 1) + { + if (_nummast == 3) + { + if (_pagina != np) + sep << "Pag. @#"; + } + else + sep << "Pag. " << _pagina; + sep.right_just(132); + set_header(1,(const char*) sep); + sep =""; + set_header(2,"@1g%s",(const char*) sep); + //set_header(1,"@126gPag. %2d", _numero_pag++); + } + else if (_numcarat == 2) + { + if (_nummast == 3) + { + if (_pagina != np) + sep1 << "Pagina @#"; + } + else + 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++); + } + if (_nummast != 3) + _pagina++; + + if (_nummast != 3 || _pagina != np) + { + set_header (1, "@0gDITTA@6g%5ld", _codice_ditta); + set_header (1, "@12g%-.45s", (const char*) _ragsoc); + set_header (1, "@59g%s", (const char*) _indulc); + //set_header (1, "@86g%-.9s", (const char*) _civulc); + set_header (1, "@97g%-.5s", (const char*) _capulc); + set_header (1, "@103g%-.18s", (const char*) _com); + set_header (1, "@122g%-.3s", (const char*) _prov); + } + if (_nummast == 3) + { + set_header (3, "@0gSottoconto@12g@b%d", _gruppo); + set_header (3, "@16g@b%d", _conto); + set_header (3, "@20g@b%ld", _sottoc); + } + else + { + set_header (3, "@0gSottoconto@12g%d", _gruppo); + set_header (3, "@16g%d", _conto); + set_header (3, "@20g%ld", _sottoc); + } + + if (_tmcf == 'C') + _tipo_mask = 1; + else if (_tmcf == 'F') + _tipo_mask = 2; + else if (_tmcf == '\0') + _tipo_mask = 3; + switch (_tipo_mask) + { + case 1: ricerca_clifo(); + break; + case 2: ricerca_clifo(); + break; + case 3: ricerca_gruppo(); + break; + default: break; + } + + if (_numcarat == 1) + { + sep.fill('-'); //Stampa 132 - (sep(132)) + set_header (6, (const char *) sep); + set_header (7,"Operazione@19gDocumento@117gContro@131gA"); + if (_stampa_mov_prov) + set_header(7,"@129gM"); + set_header (8,"Data"); + if (_stampanum < 3) + set_header (8,"@11gnumero"); + set_header (8,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@96gDare@111gAvere@117gPartita@131gC"); + if (_stampa_mov_prov) + set_header(8,"@129gP"); + sep.fill('-'); + set_header (9, (const char *) sep); + } + else if (_numcarat == 2) + { + sep1.fill('-'); //Stampa 198 - (sep1(198)) + set_header (6,"@0g%s", (const char *) sep1); + set_header (7,"Operazione@23gData@34gNumero@169gContro@180gReg@188gNumero@197gA"); + if (_stampa_mov_prov) + set_header(7,"@195gM"); + set_header (8,"Data"); + if (_stampanum < 3) + set_header (8,"@11gnumero"); + set_header (8,"@23gDocumento@42gCod.Causale@70gDescrizione@112gDare@127gAvere@135gSaldo progre.@152gSaldo movim.@169gPartita@180gIva@184gProtocollo@197gC"); + if (_stampa_mov_prov) + set_header(8,"@195gP"); + sep1.fill('-'); + set_header (9,"@0g%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@101g%15s",(const char*)string); + string = _progreavere.string("###.###.###.###"); + set_header (10,"@117g%15s",(const char*) string); + string = _saldo_progre_prec.string("###.###.###.###"); + set_header (10,"@133g%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; + + real dep_dare,dep_avere,imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; + dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; + + if (_nummast != 3 || dep_dare != ZERO || dep_avere != 0) + { + if (_numcarat == 1) + { + TString string = dep_dare.string("###.###.###.###"); + set_header (10,"@32gA RIPORTO@85g%15s",(const char*) string); + string = dep_avere.string("###.###.###.###"); + set_header (10,"@101g%15s",(const char*) string); + } + if (_numcarat == 2) + { + TString string = dep_dare.string("###.###.###.###"); + set_header (10,"@32gA RIPORTO@101g%15s",(const char*) string); + string = dep_avere.string("###.###.###.###"); + set_header (10,"@117g%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); + } + if (_pagina != np) + _pagina = np; +} + +int TMastrini_application::crea_intestazione(int start_riga) +{ + TString sep(132),sep1(198); + int r = start_riga + 2; + sep = ""; + + reset_header(); + + int np = get_page_number(); + + _conta_mastrini++; + + if (_nummast == 3) + _gia_stampata_intestazione = TRUE; + + if (_nummast == 2) + if (_cambia_mastrino) + { + _numero_pag = 1; + _cambia_mastrino = FALSE; + } + if (_nummast == 3) + { + if (_pagina != np) + { + if (_numcarat == 1) + { + sep << "Pag. @#"; + set_row(r,"@126g%s", (const char*) sep); + } + else if (_numcarat == 2) + { + sep << "Pagina @#"; + set_row(r,"@190g%s", (const char*) sep); + } + } + } + else + { + if (_numcarat == 1) + set_row(r,"@126gPag. %2d", _numero_pag++); + else if (_numcarat == 2) + set_row(r,"@190gPagina %2d", _numero_pag++); + } + if (_nummast != 3 || _pagina != np) + { + set_row (r, "@0gDITTA@6g%5ld", _codice_ditta); + set_row (r, "@12g%-45s", (const char*) _ragsoc); + set_row (r, "@59g%s", (const char*) _indulc); + //set_row (r, "@86g%-9s", (const char*) _civulc); + set_row (r, "@97g%-5s", (const char*) _capulc); + set_row (r, "@103g%-18s", (const char*) _com); + set_row (r, "@122g%-3s", (const char*) _prov); + r += 2; + } + if (_nummast == 3) + { + set_row (r, "@0gSottoconto@12g@b%d", _gruppo); + set_row (r, "@16g@b%d", _conto); + set_row (r, "@20g@b%ld", _sottoc); + } + else + { + set_row (r, "@0gSottoconto@12g%d", _gruppo); + set_row (r, "@16g%d", _conto); + set_row (r, "@20g%ld", _sottoc); + } + + if (_tmcf == 'C') + _tipo_mask = 1; + else if (_tmcf == 'F') + _tipo_mask = 2; + else if (_tmcf == '\0') + _tipo_mask = 3; + switch (_tipo_mask) + { + case 1: r = ricerca_clifo(r); + break; + case 2: r = ricerca_clifo(r); + break; + case 3: r = ricerca_gruppo(r); + break; + default: break; + } + + r++; + + if (_numcarat == 1) + { + sep.fill('-'); //Stampa 132 - (sep(132)) + set_row (r++,"@1g%s", (const char *) sep); + set_row (r++,"Operazione@19gDocumento@117gContro@131gA"); + if (_stampa_mov_prov) + set_header(r-1,"@129gM"); + set_row (r,"Data"); + if (_stampanum < 3) + set_row (r,"@11gnumero"); + set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@96gDare@111gAvere@117gPartita@131gC"); + if (_stampa_mov_prov) + set_header(r-1,"@129gP"); + sep.fill('-'); + set_row (r++,"@1g%s", (const char *) sep); + } + else if (_numcarat == 2) + { + sep1.fill('-'); //Stampa 198 - (sep1(198)) + set_row (r++,"@0g%s", (const char *) sep1); + set_row (r++,"Operazione@23gData@34gNumero@169gContro@180gReg@188gNumero@197gA"); + if (_stampa_mov_prov) + set_row(r-1,"@195gM"); + set_row (r,"Data"); + if (_stampanum < 3) + set_row (r,"@11gnumero"); + set_row (r,"@23gDocumento@42gCod.Causale@70gDescrizione@112gDare@127gAvere"); + set_row (r++,"@135gSaldo progre.@152gSaldo movim.@169gPartita@180gIva@184gProtocollo@197gC"); + if (_stampa_mov_prov) + set_row (r-1,"@195gP"); + sep1.fill('-'); + set_row (r++,"@0g%s", (const char *) sep1); + } + if (_pagina != np) + _pagina = np; + 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(); + _riporto_dare = _progredare; + _riporto_avere = _progreavere; + _stampa_progressivi_si = FALSE; + } + else + { + _riporto_dare += _riporto_parziale_dare; + _riporto_avere += _riporto_parziale_avere; + + real dep_dare,dep_avere,imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; + dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; + + if (_nummast != 3 || dep_dare != ZERO || dep_avere != 0) + { + if (_numcarat == 1) + { + TString string = dep_dare.string("###.###.###.###"); + set_row (_rw,"@32gA RIPORTO@85g%15s",(const char*) string); + string = dep_avere.string("###.###.###.###"); + set_row (_rw++,"@101g%15s",(const char*) string); + } + if (_numcarat == 2) + { + TString string = dep_dare.string("###.###.###.###"); + set_row (_rw,"@32gA RIPORTO@101g%15s",(const char*) string); + string = dep_avere.string("###.###.###.###"); + set_row (_rw++,"@117g%15s",(const char*) string); + } + } + _riporto_parziale_dare = ZERO; + _riporto_parziale_avere = ZERO; + } + if (_numcarat == 1) + { + sep =""; + set_row(_rw,"@1g%s",(const char*) sep); + } + else if (_numcarat == 2) + { + 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; + + real dep_dare,dep_avere,imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; + dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; + + if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) + { + if (_numcarat == 1) + { + TString string = dep_dare.string("###.###.###.###"); + set_row (r,"@32gA RIPORTO@85g%15s",(const char*) string); + string = dep_avere.string("###.###.###.###"); + set_row (r++,"@101g%15s",(const char*) string); + } + if (_numcarat == 2) + { + TString string = dep_dare.string("###.###.###.###"); + set_row (r,"@32gA RIPORTO@101g%15s",(const char*) string); + string = dep_avere.string("###.###.###.###"); + set_row (r++,"@117g%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() +{ + long record,sottoc,annoes; + int gruppo,conto; + TDate datareg, datacomp; + TLocalisamfile & rmov = current_cursor()->file(LF_RMOV); + char sezione; + real importo; + TDate data; + + _totale_prima_dare = ZERO; + _totale_prima_avere = ZERO; + + record = rmov.recno(); + rmov.zero(); + rmov.put(RMV_GRUPPO, _gruppo); + rmov.put(RMV_CONTO, _conto); + rmov.put(RMV_SOTTOCONTO, _sottoc); + for (rmov.read();!rmov.eof() ;rmov.next()) + { + annoes = rmov.get_int (RMV_ANNOES); + datareg = rmov.get_date(RMV_DATAREG); + sezione = rmov.get (RMV_SEZIONE)[0]; + importo = rmov.get_real(RMV_IMPORTO); + long numreg = rmov.get_long(RMV_NUMREG); + + _mov->setkey(1); + _mov->curr().zero(); + _mov->curr().put(MOV_NUMREG,numreg); + _mov->read(); + if (_mov->bad()) + _mov->zero(); + datacomp = (_mov->curr().get(MOV_DATACOMP)); + TString provvis (_mov->curr().get(MOV_PROVVIS)); + + if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) + { + if (_annomsk == 0) + { + datareg = rmov.get_date(RMV_DATAREG); + data = _inizioes; + } + else + if (_annomsk != 0) + { + datareg = datacomp; + data = _data_inizioese; + } + + gruppo = rmov.get_int(RMV_GRUPPO); + conto = rmov.get_int(RMV_CONTO); + sottoc = rmov.get_long(RMV_SOTTOCONTO); + if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) + break; + else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale + if (sezione == 'D') + _totale_prima_dare += importo; + else if (sezione == 'A') + _totale_prima_avere += importo; + } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) + } + rmov.readat(record); +} + +void TMastrini_application::calcola_progressivi() +{ + /* fv 20/3/96: aggiustato per nuova struttura saldi - modificata ricerca + * record scaricati e assegnazione dare/avere relativo - Controllare che + * non occorra considerare il saldo di chiusura (SALDOFIN) aggiunto al + * record */ + + TLocalisamfile saldi(LF_SALDI, FALSE); + real progdare_attuale,progavere_attuale,progdare_prec,progavere_prec; + real saldo,progredare_eseprec,progreavere_eseprec,pdarep,paverep,saldoini_attuale,saldofine_attuale; + char salini,salini_attuale,salfine_attuale; + + saldo = ZERO; + pdarep = ZERO; + paverep = ZERO; + +// Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto +// uguali a quelli di rmov per il calcolo dei progressivi precedenti + + + saldi.setkey(2); + saldi.zero(); + saldi.put(SLD_GRUPPO, _gruppo); + saldi.put(SLD_CONTO, _conto); + saldi.put(SLD_SOTTOCONTO, _sottoc); + + TRectype record(saldi.curr()); + + for (saldi.read(_isgteq); saldi.good() && saldi.curr() == record; saldi.next()) + { + if (!saldi.get_bool(SLD_FLSCA)) + { + int annoes_saldi = saldi.curr().get_int(SLD_ANNOES); + +//Calcola i progressivi dell'esercizio attuale + + if (annoes_saldi == _anno_corrente) + { + progdare_attuale = saldi.get_real(SLD_PDARE); + progavere_attuale = saldi.get_real(SLD_PAVERE); + saldo = saldi.get_real(SLD_SALDO); + salini = saldi.get(SLD_FLAGSALINI)[0]; + _ultima_data_reg = saldi.get_date(SLD_DATAULMOV); + saldoini_attuale = saldi.get_real(SLD_SALDO); + salini_attuale = saldi.get_char(SLD_FLAGSALINI); + saldofine_attuale = saldi.get_real(SLD_SALDOFIN); + salfine_attuale = saldi.get_char(SLD_FLAGSALFIN); + } + +//Calcola i progressivi dell'esercizio precedente + + if (annoes_saldi == _anno_precedente) + { + pdarep = saldi.get_real(SLD_PDARE); + paverep = saldi.get_real(SLD_PAVERE); + + if (_stampa_mov_prov) + { + progredare_eseprec = pdarep + saldi.get_real(SLD_PDAREPRO); + progreavere_eseprec = paverep + saldi.get_real(SLD_PAVEREPRO); + } + + // cerca eventuale record scaricati + } + +// Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che +// quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere +// i progressivi dell'esercizio precedente devo a questo punto sommare i +// progressivi dell'esercizio e i progressivi di quelli scaricati, tenendo +// conto del flag salini per sapere se il saldo e' dare oppure avere. + +/* + if (_annomsk != 0 && _anno_corrente == annoes_saldi) + { + if (saldo != ZERO) + { + if (salini == 'D') + { + progredare_eseprec = saldo;// + pdarescap + pdarep; + progdare_prec = saldo; + } + else if (salini == 'A') + { + progreavere_eseprec = saldo;// + paverescap + paverep; + progavere_prec = saldo; + } + } + } +*/ + } // if (!saldi.get_bool(SLD_FLSCA)) + } // FOR + +//Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo +// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil + + if (_annomsk != 0 /*&& saldo == ZERO*/) + { + if ((_indbil == 1) || (_indbil == 2) || (_indbil == 5)) + { + const TRecnotype pos = saldi.recno(); + // W96SALDI del 18-07-96 saldofin_esprec usa il flag TRUE xche' deve + // considerare anche il saldo finale + saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE,FALSE); + saldi.readat(pos); + + if (saldo> ZERO) + { + progredare_eseprec = saldo; + progdare_prec = saldo; + } + else if (saldo < ZERO) + { + saldo = -saldo; + progreavere_eseprec = saldo; + progavere_prec = saldo; + } + } + } + + calcola_progressivi_al(); + +//Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov +//che hanno la data di registrazione inferiore alla data di inizio stampa, +//dei progressivi dell'anno esercizio precedente, e dei progressivi dei +//movimenti scaricati dell'esercizio attuale. + + _progredare = progredare_eseprec + _totale_prima_dare; + _progreavere = progreavere_eseprec + _totale_prima_avere; + _saldo_progre_prec = _progredare - _progreavere; + +//Calcolo dei progressivi al + +//Se sulla maschera e' stato selezionato il controllo competenza esercizio +//Sommo i progressivi dell'esercizio precedente e quelli dell'esercizio attuale +//altrimenti solo quelli dell'esercizio attuale + + if (_annomsk != 0) + { + _totprogre_dare_al = progdare_attuale + progdare_prec; + _totprogre_avere_al = progavere_attuale + progavere_prec; + + if (salini_attuale == 'D') + _totprogre_dare_al += saldoini_attuale; + else if (salini_attuale == 'A') + _totprogre_avere_al += saldoini_attuale; + if (salfine_attuale == 'D') + _totprogre_dare_al += saldofine_attuale; + else if (salfine_attuale == 'A') + _totprogre_avere_al += saldofine_attuale; + } + else + { + _totprogre_dare_al = progdare_attuale; + _totprogre_avere_al = progavere_attuale; + + if (salini_attuale == 'D') + _totprogre_dare_al += saldoini_attuale; + else if (salini_attuale == 'A') + _totprogre_avere_al += saldoini_attuale; + if (salfine_attuale == 'D') + _totprogre_dare_al += saldofine_attuale; + else if (salfine_attuale == 'A') + _totprogre_avere_al += saldofine_attuale; + } +} + +void TMastrini_application::stampa_progressivi() +{ + if (_nummast == 1 || _nummast == 3) + _rw = 1; + + if (_numcarat == 1) + { + TString string = _saldo_progre_prec.string("###.###.###.###"); + set_row (_rw,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); + string = _progredare.string("###.###.###.###"); + set_row (_rw,"@85g%15s",(const char*) string); + string = _progreavere.string("###.###.###.###"); + set_row (_rw++,"@101g%15s",(const char*) string); + } + + if (_numcarat == 2) + { + TString string = _progredare.string("###.###.###.###"); + set_row (_rw,"@70gPROGRESSIVI PRECEDENTI@101g%15s",(const char*)string); + string = _progreavere.string("###.###.###.###"); + set_row (_rw,"@117g%15s",(const char*) string); + string = _saldo_progre_prec.string("###.###.###.###"); + set_row (_rw++,"@133g%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@101g%15s",(const char*)string); + string = _progreavere.string("###.###.###.###"); + set_row (r,"@117g%15s",(const char*) string); + string = _saldo_progre_prec.string("###.###.###.###"); + set_row (r++,"@133g%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() +{ + TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep; + TLocalisamfile clifo(LF_CLIFO); + TLocalisamfile pconti(LF_PCON); + TString16 dataini,datafine; + TString descriz,descriz2; + int numrivd; + + indcf = ""; + + clifo.setkey(1); + clifo.zero(); + clifo.put(CLI_TIPOCF, _tmcf); + clifo.put(CLI_CODCF, _sottoc); + clifo.read(); + if (clifo.bad()) + clifo.zero(); + TConto tc (_gruppo,_conto,_sottoc,_tmcf); + + ragsoc = tc.descrizione(); + paiv = clifo.get(CLI_PAIV); + cofi = clifo.get(CLI_COFI); + indcf = clifo.get(CLI_INDCF); + indcf.trim(); + indcf << " " << clifo.get(CLI_CIVCF); + capcf = clifo.get(CLI_CAPCF); + ptel = clifo.get(CLI_PTEL); + tel = clifo.get(CLI_TEL); + statocf = clifo.get(CLI_STATOCF); + comcf = clifo.get(CLI_COMCF); + + _comuni->setkey(1); + _comuni->zero(); + _comuni->put(COM_STATO, statocf); + _comuni->put(COM_COM, comcf); + _comuni->read(); + if (_comuni->good()) + { + dencom = _comuni->get(COM_DENCOM); + provcom = _comuni->get(COM_PROVCOM); + } + else + { + //dencom=""; + dencom = clifo.get(CLI_LOCCF); + provcom=""; + } + + pconti.setkey(1); + pconti.zero(); + pconti.put(PCN_GRUPPO, _gruppo); + pconti.put(PCN_CONTO, _conto); + pconti.read(); + _sezivd = pconti.get_char(PCN_SEZIVD); + _lettivd = pconti.get_char(PCN_LETTIVD); + numrivd = pconti.get_int(PCN_NUMRIVD); + _numrivd = itor(numrivd); + _numivd = pconti.get_int(PCN_NUMIVD); + + descriz = descrizione_classe(_sezivd,_lettivd,numrivd,_numivd); + + if (_numivd != 0) //Ora devo stampare la descrizione del livello della + { //classe immediatamente precedente a quello appena + if (_numrivd != "") //stampato + descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); + else + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + } + else + if (_numrivd != "") + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + else + descriz2 = ""; + + set_header(3,"@27g%-.30s",(const char*) descrizione_gruppo()); + set_header(3,"@59g%-.30s",(const char*) descrizione_conto()); + set_header(3, "@91g%-.41s",(const char*) ragsoc); + if (_nummast == 3) + set_header(4, "@rClasse@8g@b%c", _lettivd); + else + set_header(4, "Classe@8g%c", _lettivd); + set_header(4, "@10g%-8s", (const char*) _numrivd); + if (_numivd != 0) + set_header(4, "@19g%2d", _numivd); + if (descriz2 != "") + { + set_header(4,"@23g%-50s",(const char*) descriz2); + set_header(4,"@80g%-50s",(const char*) descriz); + } + else + set_header(4,"@23g%-50s",(const char*) descriz); + + dataini = _data_ini.string(); + datafine = _data_fine.string(); + + if (_annomsk == 0) + { + if (_nummast == 3) + { + set_header (5, "@rPeriodo@10g@b%s", (const char*) dataini); + set_header (5, "@22g@b%s@r", (const char*) datafine); + } + else + { + set_header (5, "Periodo@10g%s", (const char*) dataini); + set_header (5, "@22g%s", (const char*) datafine); + } + } + else + { + if (_nummast == 3) + { + set_header (5, "@rComp. da@9g@b%s", (const char*) dataini); + set_header (5, "@20g@ra@22g@b%s@r", (const char*) datafine); + } + else + { + set_header (5, "Comp. da@9g%s", (const char*) dataini); + set_header (5, "@20ga@22g%s", (const char*) datafine); + } + } + + set_header (5, "@33gP.I.@37g%-11s",(const char*) paiv); + set_header (5, "@49gCF@52g%-16s",(const char*) cofi); + set_header (5, "@69g%-.25s",(const char*) indcf); + set_header (5, "@95g%-5s",(const char*) capcf); + set_header (5, "@101g%-.24s",(const char*) dencom); + set_header (5, "@126g%-5s",(const char*) provcom); + + if (_numcarat == 2) + { + set_header (5,"@134g%-4s",(const char*) ptel); + if (tel != "") + set_header (5,"@138g/@139g%-10s",(const char*) tel); + } +} + +int TMastrini_application::ricerca_clifo(int start) +{ + TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep; + TLocalisamfile clifo(LF_CLIFO); + TLocalisamfile pconti(LF_PCON); + TString16 dataini,datafine; + TString descriz,descriz2; + int numrivd; + int r = start; + + indcf = ""; + + clifo.setkey(1); + clifo.zero(); + clifo.put(CLI_TIPOCF, _tmcf); + clifo.put(CLI_CODCF, _sottoc); + clifo.read(); + if (clifo.bad()) + clifo.zero(); + TConto tc (_gruppo,_conto,_sottoc,_tmcf); + + ragsoc = tc.descrizione(); + paiv = clifo.get(CLI_PAIV); + cofi = clifo.get(CLI_COFI); + indcf = clifo.get(CLI_INDCF); + indcf.trim(); + indcf << " " << clifo.get(CLI_CIVCF); + capcf = clifo.get(CLI_CAPCF); + ptel = clifo.get(CLI_PTEL); + tel = clifo.get(CLI_TEL); + statocf = clifo.get(CLI_STATOCF); + comcf = clifo.get(CLI_COMCF); + + _comuni->setkey(1); + _comuni->zero(); + _comuni->put(COM_STATO, statocf); + _comuni->put(COM_COM, comcf); + _comuni->read(); + if (_comuni->good()) + { + dencom = _comuni->get(COM_DENCOM); + provcom = _comuni->get(COM_PROVCOM); + } + else + { + //dencom=""; + dencom=clifo.get(CLI_LOCCF); + provcom=""; + } + + pconti.setkey(1); + pconti.zero(); + pconti.put(PCN_GRUPPO, _gruppo); + pconti.put(PCN_CONTO, _conto); + pconti.read(); + _sezivd = pconti.get_char(PCN_SEZIVD); + _lettivd = pconti.get_char(PCN_LETTIVD); + numrivd = pconti.get_int(PCN_NUMRIVD); + _numrivd = itor(numrivd); + _numivd = pconti.get_int(PCN_NUMIVD); + + descriz = descrizione_classe(_sezivd,_lettivd,numrivd,_numivd); + + if (_numivd != 0) //Ora devo stampare la descrizione del livello della + { //classe immediatamente precedente a quello appena + if (_numrivd != "") //stampato + descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); + else + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + } + else + if (_numrivd != "") + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + else + descriz2 = ""; + + set_row (r,"@27g%-30s",(const char*) descrizione_gruppo()); + set_row (r,"@59g%-30s",(const char*) descrizione_conto()); + set_row(r++, "@91g%-30s",(const char*) ragsoc); + if (_nummast == 3) + set_row(r, "@rClasse@8g@b%c", _lettivd); + else + set_row(r, "Classe@8g%c", _lettivd); + set_row(r, "@10g%-8s", (const char*) _numrivd); + if (_numivd != 0) + set_row(r, "@19g%2d", _numivd); + if (descriz2 != "") + { + set_row(r,"@23g%-50s",(const char*) descriz2); + set_row(r++,"@80g%-50s",(const char*) descriz); + } + else + set_row(r++,"@23g%-50s",(const char*) descriz); + + dataini = _data_ini.string(); + datafine = _data_fine.string(); + + if (_annomsk == 0) + { + if (_nummast == 3) + { + set_row (r, "@rPeriodo@10g@b%s", (const char*) dataini); + set_row (r, "@22g%s@r", (const char*) datafine); + } + else + { + set_row (r, "Periodo@10g%s", (const char*) dataini); + set_row (r, "@22g%s", (const char*) datafine); + } + } + else + { + if (_nummast == 3) + { + set_row (r, "@rComp. da@9g@b%s", (const char*) dataini); + set_row (r, "@20g@ra@22g@b%s@r", (const char*) datafine); + } + else + { + set_row (r, "Comp. da@9g%s", (const char*) dataini); + set_row (r, "@20ga@22g%s", (const char*) datafine); + } + } + + set_row (r, "@33gP.I.@37g%-11s",(const char*) paiv); + set_row (r, "@49gCF@52g%-16s",(const char*) cofi); + set_row (r, "@69g%-.25s",(const char*) indcf); + set_row (r, "@95g%-5s",(const char*) capcf); + set_row (r, "@101g%-.24s",(const char*) dencom); + set_row (r, "@126g%-5s",(const char*) provcom); + + if (_numcarat == 2) + { + set_row (r,"@134g%-4s",(const char*) ptel); + if (tel != "") + set_row (r++,"@138g/@139g%-10s",(const char*) tel); + } + return r; +} + + +// Se la ricerca selezionata sulla maschera e' per gruppo, conto, sottoconto +// ricerca i corrispondenti su PCON, con relativa IV direttiva CEE + +void TMastrini_application::ricerca_classe_IV(bool scelta) +{ + TLocalisamfile pconti(LF_PCON); + + pconti.setkey(1); + pconti.zero(); + pconti.put(PCN_GRUPPO, _gruppo); + pconti.put(PCN_CONTO, _conto); + if (scelta) + pconti.put(PCN_SOTTOCONTO, _sottoc); + pconti.read(); + _sezivd = pconti.get_char(PCN_SEZIVD); + _lettivd = pconti.get_char(PCN_LETTIVD); + _numrivd_int = pconti.get_int (PCN_NUMRIVD); + _numrivd = itor(_numrivd_int); + _numivd = pconti.get_int (PCN_NUMIVD); +} + +void TMastrini_application::ricerca_gruppo() +{ + TString80 descr,descriz,descriz2,dep; + TString dataini,datafine; + + ricerca_classe_IV (TRUE); //Esiste a livello di sottoconto + + if (_sezivd == '0') //Non esiste a livello di sottoconto + ricerca_classe_IV (FALSE); //Allora la cerco a livello di conto + + descriz = descrizione_classe(_sezivd,_lettivd,_numrivd_int,_numivd); + if (_numivd != 0) //Ora devo stampare la descrizione del livello della + { //classe immediatamente precedente a quello appena + if (_numrivd != "") //stampato + descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); + else + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + } + else + if (_numrivd != "") + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + else + descriz2 = ""; + + set_header(3,"@27g%-.30s",(const char*) descrizione_gruppo()); + set_header(3,"@59g%-.30s",(const char*) descrizione_conto()); + + set_header(3,"@91g%-.41s",(const char*) descrizione_sottoconto()); + if (_nummast == 3) + set_header(4, "@0g@rClasse@12g@b%c", _lettivd); + else + set_header(4, "@0gClasse@12g%c", _lettivd); + set_header(4, "@14g%-8s",(const char*) _numrivd); + if (_numivd != 0) + set_header(4, "@23g%d", _numivd); + if (descriz2 != "") + { + set_header(4,"@27g%-50s",(const char*) descriz2); + set_header(4,"@80g%-50s",(const char*) descriz); + } + else + set_header(4,"@27g%-50s",(const char*) descriz); + + dataini = _data_ini.string(); + datafine = _data_fine.string(); + + if (_annomsk == 0) + { + if (_nummast == 3) + { + set_header (5, "@rPeriodo@12g@b%s", (const char*) dataini); + set_header (5, "@24g@b%s@r", (const char*) datafine); + } + else + { + set_header (5, "Periodo@12g%s", (const char*) dataini); + set_header (5, "@24g%s", (const char*) datafine); + } + } + else + { + if (_nummast == 3) + { + set_header (5, "@rPeriodo di competenza@23g@b%s", (const char*) dataini); + set_header (5, "@35g%s@r", (const char*) datafine); + } + else + { + set_header (5, "Periodo di competenza@23g%s", (const char*) dataini); + set_header (5, "@35g%s", (const char*) datafine); + } + } +} + +int TMastrini_application::ricerca_gruppo(int start) +{ + TString80 descr,descriz,descriz2,dep; + TString dataini,datafine; + int r = start; + + ricerca_classe_IV (TRUE); //Esiste a livello di sottoconto + + if (_sezivd == '0') //Non esiste a livello di sottoconto + ricerca_classe_IV (FALSE); //Allora la cerco a livello di conto + + descriz = descrizione_classe(_sezivd,_lettivd,_numrivd_int,_numivd); + if (_numivd != 0) //Ora devo stampare la descrizione del livello della + { //classe immediatamente precedente a quello appena + if (_numrivd != "") //stampato + descriz2 = descrizione_classe(_sezivd,_lettivd,_numrivd_int,0); + else + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + } + else + if (_numrivd != "") + descriz2 = descrizione_classe(_sezivd,_lettivd,0,0); + else + descriz2 = ""; + + set_row(r,"@27g%-.30s",(const char*) descrizione_gruppo()); + set_row(r,"@59g%-.30s",(const char*) descrizione_conto()); + + set_row(r++,"@91g%-.41s",(const char*) descrizione_sottoconto()); + if (_nummast == 3) + set_row(r, "@0g@rClasse@12g@b%c", _lettivd); + else + set_row(r, "@0gClasse@12g%c", _lettivd); + set_row(r, "@14g%-8s",(const char*) _numrivd); + if (_numivd != 0) + set_row(r, "@23g%d", _numivd); + if (descriz2 != "") + { + set_row(r,"@27g%-50s",(const char*) descriz2); + set_row(r++,"@80g%-50s",(const char*) descriz); + } + else + set_row(r++,"@27g%-50s",(const char*) descriz); + + dataini = _data_ini.string(); + datafine = _data_fine.string(); + + if (_annomsk == 0) + { + if (_nummast == 3) + { + set_row (r, "@rPeriodo@12g@b%s", (const char*) dataini); + set_row (r, "@24g%s@r", (const char*) datafine); + } + else + { + set_row (r, "Periodo@12g%s", (const char*) dataini); + set_row (r, "@24g%s", (const char*) datafine); + } + } + else + { + if (_nummast == 3) + { + set_row (r, "@rPeriodo di competenza@23g@b%s", (const char*) dataini); + set_row (r, "@35g%s@r", (const char*) datafine); + } + else + { + set_row (r, "Periodo di competenza@23g%s", (const char*) dataini); + set_row (r, "@35g%s", (const char*) datafine); + } + } + return r; +} + +const char* TMastrini_application::descrizione_classe(char sezione, char lettera, int numr, int numero) +{ + TTable tabivd(TAB_IVD); + TString dep,dep2; + + tabivd.zero(); + if (numr == 0 && numero == 0) + dep = format("%c%c",sezione,lettera); + else + if (numero == 0) + { + if (numr != 0) + dep = format("%1c%1c%04d",sezione, lettera, numr); + else + dep = format("%c%c ",sezione,lettera); + } + else + { + if (numr != 0) + dep = format("%1c%1c%04d%02d",sezione, lettera, numr,numero); + else + dep = format("%c%c %02d",sezione,lettera,numero); + } + + tabivd.put("CODTAB", dep); + tabivd.read(); + dep2 = tabivd.get("CODTAB"); + if (dep == dep2) + TMP = tabivd.get("S0"); + else + TMP = ""; + return TMP; +} + +//Ricerca la descrizione relativa al gruppo da stampare + +const char* TMastrini_application::descrizione_gruppo() +{ + TLocalisamfile pconti(LF_PCON); + + pconti.zero(); + pconti.put(PCN_GRUPPO,_gruppo); + if (pconti.read() != NOERR) pconti.zero(); + TMP = pconti.get(PCN_DESCR); + return TMP; +} + +// Ricerca la descrizione relativa al conto da stampare + +const char* TMastrini_application::descrizione_conto() +{ + TLocalisamfile pconti(LF_PCON); + + pconti.zero(); + pconti.put(PCN_GRUPPO,_gruppo); + pconti.put(PCN_CONTO,_conto); + if (pconti.read() != NOERR) pconti.zero(); + TMP = pconti.get(PCN_DESCR); + return TMP; +} + +const char* TMastrini_application::descrizione_sottoconto() +{ + TLocalisamfile pconti(LF_PCON); + + pconti.zero(); + pconti.put(PCN_GRUPPO, _gruppo); + pconti.put(PCN_CONTO, _conto); + pconti.put(PCN_SOTTOCONTO, _sottoc); + if (pconti.read() != NOERR) pconti.zero(); + TMP = pconti.get(PCN_DESCR); + return TMP; +} + +// Funzione per settare tutti gli handlers della maschera principale +// o di quella dello spreadsheet della seconda pagina +void TMastrini_application::set_handlers(TMask* msk) const +{ +/* Guy: Provo a non usarli e uso i check normali + msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); + msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini); + msk->set_handler(F_SOTTOCINI_FORN, sottoc_handler_ini); + msk->set_handler(F_SOTTOCFINE_CONTO, sottoc_handler_fine); + msk->set_handler(F_SOTTOCFINE_CLIENTE, sottoc_handler_fine); + msk->set_handler(F_SOTTOCFINE_FORN, sottoc_handler_fine); +*/ + msk->set_handler(F_DATAINI, data_inizio); + msk->set_handler(F_DATAFINE, data_fine); + msk->set_handler(F_GRUPPOFINE, gruppo_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); +} + +// Copia i parametri della prima pagina in una nuova riga dello spreadsheet +// a meno che non ci siano gia' +bool TMastrini_application::mask2sheet() +{ + TToken_string row(120); + + short id = F_ANNO; + for (int pos = _msk->id2pos(id); pos >= 0; pos = _msk->id2pos(++id)) + row.add(_msk->fld(pos).get()); + + bool ok = FALSE; + if (!row.empty_items()) + { + TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE); + TString_array& rows = sht.rows_array(); + ok = rows.find(row) < 0; + if (ok) + { + rows.add(row); + sht.force_update(); + } + } + return ok; +} + +bool TMastrini_application::sheet2mask() +{ + TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE); + bool ok = sht.items() > 0; + if (ok) + { + TString_array& rows = sht.rows_array(); + TToken_string row = rows.row(0); + rows.destroy(0, TRUE); + + short id = F_ANNO; + for (int pos = _msk->id2pos(id); pos >= 0; pos = _msk->id2pos(++id)) + _msk->fld(pos).set(row.get()); + } + return ok; +} + +bool TMastrini_application::user_create() +{ + TToken_string exp; + + _rel = new TRelation (LF_SALDI); + + exp.add("GRUPPO=GRUPPO"); + exp.add("CONTO=CONTO"); + exp.add("SOTTOCONTO=SOTTOCONTO"); + _rel->add(LF_RMOV,exp,2,LF_SALDI); + +// _cur1=add_cursor(new TCursor(_rel,"FLSCA=\"F\"",2)); + _cur1=add_cursor(new TCursor(_rel,"FLSCA=\" \"",2)); + _nditte = new TLocalisamfile (LF_NDITTE); + _unloc = new TLocalisamfile (LF_UNLOC); + _comuni = new TLocalisamfile (LF_COMUNI); + _mov = new TLocalisamfile (LF_MOV); + _clifo = new TLocalisamfile (LF_CLIFO); + _caus = new TLocalisamfile (LF_CAUSALI); + _tabivd = new TTable (TAB_IVD); + _tabtpd = new TTable (TAB_TPD); + _tabreg = new TTable (TAB_REG); + _sld = new TSaldo (); + + _d18 = new TParagraph_string ("",18); + _d23 = new TParagraph_string ("",23); + _d30 = new TParagraph_string ("",30); + + _msk = new TMask("cg3200a"); + set_handlers(_msk); + _msk->set_handler(F_MEMORIZZA, memorizza_handler); + + TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE); + sht.set_notify(scelte_notify); + TMask& sm = sht.sheet_mask(); + set_handlers(&sm); + + _gia_stampata_intestazione = FALSE; + + return TRUE; +} + +bool TMastrini_application::user_destroy() +{ + delete _msk; + delete _rel; + delete _mov; + delete _nditte; + delete _unloc; + delete _comuni; + delete _clifo; + delete _caus; + delete _tabivd; + delete _tabtpd; + delete _tabreg; + delete _sld; + delete _d18; + delete _d23; + delete _d30; + + return TRUE; + +} + +int cg3200(int argc, char* argv[]) +{ + + TMastrini_application a; + + a.run(argc, argv, "Stampa Mastrini"); + + return 0; +} + + diff --git a/cg/cg3200.h b/cg/cg3200.h index 139caa6ef..14c971a80 100755 --- a/cg/cg3200.h +++ b/cg/cg3200.h @@ -6,42 +6,43 @@ #define TAB_REG "REG" #define TAB_ESC "ESC" -#define F_CODDITTA 101 -#define F_RAGSOC 102 -#define F_TIPOCF_INI 103 -#define F_GRUPPOINI 104 -#define F_GRUPPOFINE 105 -#define F_CONTOINI_CONTO 106 -#define F_CONTOFINE_CONTO 107 -#define F_SOTTOCINI_CONTO 108 -#define F_SOTTOCFINE_CONTO 109 -#define F_SOTTOCINI_CLIENTE 110 -#define F_SOTTOCFINE_CLIENTE 111 -#define F_SOTTOCINI_FORN 112 -#define F_SOTTOCFINE_FORN 113 -#define F_DESCRINI_CONTO 114 -#define F_DESCRFINE_CONTO 115 -#define F_DESCRINI_CLIENTE 116 -#define F_DESCRFINE_CLIENTE 117 -#define F_DESCRINI_FORN 118 -#define F_DESCRFINE_FORN 119 -#define F_DATAINI 120 -#define F_DATAFINE 121 -#define F_STAMPANUM 122 -#define F_STAMPAPROGRE 123 -#define F_STAMPATOTIVA 124 -#define F_TIPOSTAMPA 125 -#define F_STAMPAMOVPROV 126 -#define F_MEMORIZZA 127 -#define F_NUMCARAT 128 -#define F_NUMMAST 129 -#define F_ANNO 130 -#define F_FORMATO 131 -#define F_CONTOINI_CLIENTE 132 -#define F_CONTOINI_FORN 133 -#define F_CONTOFINE_CLIENTE 134 -#define F_CONTOFINE_FORN 135 -#define F_TIPOCF_FINE 136 +#define F_ANNO 101 +#define F_TIPOCF_INI 102 +#define F_GRUPPOINI 103 +#define F_CONTOINI_CONTO 104 +#define F_CONTOINI_CLIENTE 204 +#define F_CONTOINI_FORN 304 +#define F_SOTTOCINI_CONTO 105 +#define F_SOTTOCINI_CLIENTE 205 +#define F_SOTTOCINI_FORN 305 +#define F_TIPOCF_FINE 106 +#define F_GRUPPOFINE 107 +#define F_CONTOFINE_CONTO 108 +#define F_CONTOFINE_CLIENTE 208 +#define F_CONTOFINE_FORN 308 +#define F_SOTTOCFINE_CONTO 109 +#define F_SOTTOCFINE_CLIENTE 209 +#define F_SOTTOCFINE_FORN 309 +#define F_DESCRINI_CONTO 125 +#define F_DESCRINI_CLIENTE 135 +#define F_DESCRINI_FORN 145 +#define F_DESCRFINE_CONTO 129 +#define F_DESCRFINE_CLIENTE 139 +#define F_DESCRFINE_FORN 149 +#define F_DATAINI 110 +#define F_DATAFINE 111 +#define F_STAMPANUM 112 +#define F_STAMPAPROGRE 113 +#define F_STAMPATOTIVA 114 +#define F_TIPOSTAMPA 115 +#define F_STAMPAMOVPROV 116 +#define F_MEMORIZZA 500 +#define F_NUMCARAT 501 +#define F_NUMMAST 502 +#define F_FORMATO 503 +#define F_CODDITTA 504 +#define F_RAGSOC 505 +#define F_SCELTE 506 #endif // __CG3200_H diff --git a/cg/cg3200a.uml b/cg/cg3200a.uml index 7de1a4110..af580c115 100755 --- a/cg/cg3200a.uml +++ b/cg/cg3200a.uml @@ -1,531 +1,944 @@ -#include "cg3200.h" - -TOOLBAR "" 0 20 0 2 - -BUTTON DLG_PRINT 10 2 - -BEGIN - PROMPT -12 -11 "~Stampa" - MESSAGE EXIT,K_ENTER -END - -BUTTON DLG_QUIT 10 2 -BEGIN - PROMPT -22 -11 "" -END - -ENDPAGE - -PAGE "Stampa Mastrini" -1 -1 78 20 - -NUMBER F_CODDITTA 5 -BEGIN - PROMPT 4 1 "Ditta " - FLAGS "FRD" - USE LF_NDITTE KEY 1 - CHECKTYPE REQUIRED - INPUT CODDITTA F_CODDITTA - DISPLAY "Codice" CODDITTA - DISPLAY "Ragione sociale @50" RAGSOC - OUTPUT F_CODDITTA CODDITTA - OUTPUT F_RAGSOC RAGSOC -END - -STRING F_RAGSOC 50 -BEGIN - PROMPT 4 2 "Ragione sociale " - FLAGS "D" -END - -TEXT 96 -BEGIN - PROMPT 4 11 "Dalla data competenza" -END - -TEXT 97 -BEGIN - PROMPT 40 11 "Alla data competenza " -END - -TEXT 98 -BEGIN - PROMPT 4 11 "Dalla data operazione " -END - -TEXT 99 -BEGIN - PROMPT 40 11 "Alla data operazione " -END - -NUMBER F_ANNO 4 -BEGIN - PROMPT 47 1 "Codice esercizio " - HELP "Codice esercizio di cui stampare i mastrini" - USE ESC - INPUT CODTAB F_ANNO - DISPLAY "Codice Esercizio" CODTAB - DISPLAY "Data inizio esercizio" D0 - DISPLAY "Data fine esercizio " D1 - OUTPUT F_ANNO CODTAB - CHECKTYPE NORMAL - MESSAGE HIDE,98|HIDE,99|SHOW,96|SHOW,97 - MESSAGE EMPTY HIDE,96|HIDE,97|SHOW,98|SHOW,99 - FLAGS "RZ" - ADD RUN cg0 -5 esc -END - -LIST F_TIPOCF_INI 25 -BEGIN - PROMPT 4 4 "Ricerca " - HELP "Indicare il tipo di mastrini da stampare" - ITEM " |Gruppo/conto/sottoconto" - MESSAGE HIDE,2@|HIDE,3@|RESET,2@|RESET,3@|SHOW,1@ - ITEM "C|Clienti" - MESSAGE HIDE,1@|HIDE,3@|RESET,1@|RESET,3@|SHOW,2@ - ITEM "F|Fornitori" - MESSAGE HIDE,1@|HIDE,2@|RESET,1@|RESET,2@|SHOW,3@ -END - -NUMBER F_GRUPPOINI 3 -BEGIN - PROMPT 4 5 "Da Gruppo - Conto - Sottoconto " - HELP "Codice conto da cui iniziare la stampa" -END - -NUMBER F_CONTOINI_CONTO 3 -BEGIN - PROMPT 41 5 "" - HELP "Codice conto da cui iniziare la stampa" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") - INPUT GRUPPO F_GRUPPOINI - INPUT CONTO F_CONTOINI_CONTO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_CONTO CONTO - CHECKTYPE NORMAL - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCINI_CONTO - VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO - GROUP 1 -END - -NUMBER F_CONTOINI_CLIENTE 3 -BEGIN - PROMPT 41 5 "" - HELP "Codice conto da cui iniziare la stampa" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C") - INPUT GRUPPO F_GRUPPOINI - INPUT CONTO F_CONTOINI_CLIENTE - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_CLIENTE CONTO - CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CLIENTE - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCINI_CLIENTE - MESSAGE COPY,F_CONTOINI_CONTO - GROUP 2 -END - -NUMBER F_CONTOINI_FORN 3 -BEGIN - PROMPT 41 5 "" - HELP "Codice conto da cui iniziare la stampa" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F") - INPUT GRUPPO F_GRUPPOINI - INPUT CONTO F_CONTOINI_FORN - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_FORN CONTO - CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCINI_FORN - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCINI_FORN - MESSAGE COPY,F_CONTOINI_CONTO - GROUP 3 -END - -NUMBER F_SOTTOCINI_CONTO 6 -BEGIN - PROMPT 48 5 "" - HELP "Codice conto da cui iniziare la stampa" - USE LF_PCON SELECT SOTTOCONTO!="" - INPUT GRUPPO F_GRUPPOINI - INPUT CONTO F_CONTOINI_CONTO - INPUT SOTTOCONTO F_SOTTOCINI_CONTO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Sottoconto" SOTTOCONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_SOTTOCINI_CONTO SOTTOCONTO - OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_CONTO CONTO - OUTPUT F_DESCRINI_CONTO DESCR - CHECKTYPE NORMAL - GROUP 1 -END - -STRING F_DESCRINI_CONTO 50 -BEGIN - PROMPT 4 6 "Descrizione " - USE LF_PCON KEY 2 - CHECKTYPE NORMAL - INPUT DESCR F_DESCRINI_CONTO - DISPLAY "Descrizione@50" DESCR - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Sottoconto" SOTTOCONTO - COPY OUTPUT F_SOTTOCINI_CONTO - GROUP 1 -END - -NUMBER F_SOTTOCINI_CLIENTE 6 -BEGIN - PROMPT 48 5 "" - HELP "Codice conto da cui iniziare la stampa" - USE LF_CLIFO - CHECKTYPE NORMAL - INPUT TIPOCF "C" - INPUT CODCF F_SOTTOCINI_CLIENTE - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - OUTPUT F_SOTTOCINI_CLIENTE CODCF - OUTPUT F_DESCRINI_CLIENTE RAGSOC - MESSAGE COPY,F_SOTTOCINI_CONTO - GROUP 2 -END - -STRING F_DESCRINI_CLIENTE 50 -BEGIN - PROMPT 4 6 "Ragione sociale C " - HELP "Codice conto da cui iniziare la stampa" - FIELD LF_CLIFO->RAGSOC - USE LF_CLIFO KEY 2 - INPUT TIPOCF "C" - INPUT RAGSOC F_DESCRINI_CLIENTE - DISPLAY "Ragione Sociale Cliente@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Codice" CODCF - COPY OUTPUT F_SOTTOCINI_CLIENTE - MESSAGE COPY,F_DESCRINI_CONTO - CHECKTYPE NORMAL - GROUP 2 -END - -NUMBER F_SOTTOCINI_FORN 6 -BEGIN - PROMPT 48 5 "" - HELP "Codice conto da cui iniziare la stampa" - USE LF_CLIFO - CHECKTYPE NORMAL - INPUT TIPOCF "F" - INPUT CODCF F_SOTTOCINI_FORN - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - OUTPUT F_SOTTOCINI_FORN CODCF - OUTPUT F_DESCRINI_FORN RAGSOC - FLAGS "R" - GROUP 3 - MESSAGE COPY,F_SOTTOCINI_CONTO -END - -STRING F_DESCRINI_FORN 50 -BEGIN - PROMPT 4 6 "Ragione Sociale F " - HELP "Codice conto da cui iniziare la stampa" - USE LF_CLIFO KEY 2 - INPUT TIPOCF "F" - INPUT RAGSOC F_DESCRINI_FORN - DISPLAY "Ragione Sociale Fornitore@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Codice" CODCF - COPY OUTPUT F_SOTTOCINI_FORN - MESSAGE COPY,F_DESCRINI_CONTO - CHECKTYPE NORMAL - GROUP 3 -END - -LIST F_TIPOCF_FINE 25 -BEGIN - PROMPT 4 7 "Ricerca " - HELP "Indicare il tipo di mastrini da stamapare" - ITEM " |Gruppo/conto/sottoconto" - MESSAGE HIDE,5@|HIDE,6@|RESET,5@|RESET,6@|SHOW,4@ - ITEM "C|Clienti" - MESSAGE HIDE,4@|HIDE,6@|RESET,4@|RESET,6@|SHOW,5@ - ITEM "F|Fornitori" - MESSAGE HIDE,4@|HIDE,5@|RESET,4@|RESET,5@|SHOW,6@ -END - -NUMBER F_GRUPPOFINE 3 -BEGIN - PROMPT 4 8 "A Gruppo - Conto - Sottoconto " -END - -NUMBER F_CONTOFINE_CONTO 3 -BEGIN - PROMPT 41 8 "" - HELP "Codice conto a cui terminare la stampa" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") - INPUT GRUPPO F_GRUPPOFINE - INPUT CONTO F_CONTOFINE_CONTO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOFINE GRUPPO - OUTPUT F_CONTOFINE_CONTO CONTO - CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CONTO - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCFINE_CONTO - GROUP 4 -END - -NUMBER F_CONTOFINE_CLIENTE 3 -BEGIN - PROMPT 41 8 "" - HELP "Codice conto a cui terminare la stampa" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C") - INPUT GRUPPO F_GRUPPOFINE - INPUT CONTO F_CONTOFINE_CLIENTE - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOFINE GRUPPO - OUTPUT F_CONTOFINE_CLIENTE CONTO - CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CLIENTE - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCFINE_CLIENTE - MESSAGE COPY,F_CONTOFINE_CONTO - GROUP 5 -END - -NUMBER F_CONTOFINE_FORN 3 -BEGIN - PROMPT 41 8 "" - HELP "Codice conto a cui terminare la stampa" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F") - INPUT GRUPPO F_GRUPPOFINE - INPUT CONTO F_CONTOFINE_FORN - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOFINE GRUPPO - OUTPUT F_CONTOFINE_FORN CONTO - CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_FORN - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCFINE_FORN - MESSAGE COPY,F_CONTOFINE_CONTO - GROUP 6 -END - -NUMBER F_SOTTOCFINE_CONTO 6 -BEGIN - PROMPT 48 8 "" - HELP "Codice conto a cui terminare la stampa" - USE LF_PCON SELECT SOTTOCONTO!="" - INPUT GRUPPO F_GRUPPOFINE - INPUT CONTO F_CONTOFINE_CONTO - INPUT SOTTOCONTO F_SOTTOCFINE_CONTO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Sottoconto" SOTTOCONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_SOTTOCFINE_CONTO SOTTOCONTO - OUTPUT F_GRUPPOFINE GRUPPO - OUTPUT F_CONTOFINE_CONTO CONTO - OUTPUT F_DESCRFINE_CONTO DESCR - CHECKTYPE NORMAL - WARNING "Sottoconto inesistente o mancante" - GROUP 4 -END - -STRING F_DESCRFINE_CONTO 50 -BEGIN - PROMPT 4 9 "Descrizione " - HELP "Codice conto a cui terminare la stampa" - USE LF_PCON KEY 2 - CHECKTYPE NORMAL - INPUT DESCR F_DESCRINI_CONTO - DISPLAY "Descrizione@50" DESCR - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Sottoconto" SOTTOCONTO - COPY OUTPUT F_SOTTOCFINE_CONTO - GROUP 4 -END - -NUMBER F_SOTTOCFINE_CLIENTE 6 -BEGIN - PROMPT 48 8 "" - HELP "Codice conto a cui terminare la stampa" - USE LF_CLIFO - CHECKTYPE NORMAL - WARNING "Cliente inesistente o mancante" - INPUT TIPOCF "C" - INPUT CODCF F_SOTTOCFINE_CLIENTE - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - OUTPUT F_SOTTOCFINE_CLIENTE CODCF - OUTPUT F_DESCRFINE_CLIENTE RAGSOC - MESSAGE COPY,F_SOTTOCFINE_CONTO - GROUP 5 -END - -STRING F_DESCRFINE_CLIENTE 50 -BEGIN - PROMPT 4 9 "Ragione sociale " - HELP "Codice conto a cui terminare la stampa" - FIELD LF_CLIFO->RAGSOC - CHECKTYPE NORMAL - USE LF_CLIFO KEY 2 - INPUT TIPOCF "C" - INPUT RAGSOC F_DESCRFINE_CLIENTE - DISPLAY "Ragione Sociale Cliente@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Codice" CODCF - COPY OUTPUT F_SOTTOCFINE_CLIENTE - MESSAGE COPY,F_DESCRFINE_CONTO - GROUP 5 -END - -NUMBER F_SOTTOCFINE_FORN 6 -BEGIN - PROMPT 48 8 "" - HELP "Codice conto a cui terminare la stampa" - USE LF_CLIFO - CHECKTYPE NORMAL - WARNING "Fornitore inesistente o mancante" - INPUT TIPOCF "F" - INPUT CODCF F_SOTTOCFINE_FORN - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - OUTPUT F_SOTTOCFINE_FORN CODCF - OUTPUT F_DESCRFINE_FORN RAGSOC - MESSAGE COPY,F_SOTTOCFINE_CONTO - GROUP 6 -END - -STRING F_DESCRFINE_FORN 50 -BEGIN - PROMPT 4 9 "Ragione Sociale " - HELP "Codice conto a cui terminare la stampa" - USE LF_CLIFO KEY 2 - CHECKTYPE NORMAL - INPUT TIPOCF "F" - INPUT RAGSOC F_DESCRFINE_FORN - DISPLAY "Ragione Sociale Fornitore@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Codice" CODCF - COPY OUTPUT F_SOTTOCFINE_FORN - MESSAGE COPY,F_DESCRFINE_CONTO - GROUP 6 -END - -DATE F_DATAINI -BEGIN - PROMPT 26 11 "" - HELP "Data da cui iniziare la stampa" -END - -DATE F_DATAFINE -BEGIN - PROMPT 62 11 "" - HELP "Data a cui terminare la stampa" -END - -BOOLEAN F_STAMPATOTIVA -BEGIN - PROMPT 4 12 "Stampa totali documenti IVA" - HELP "Inidcare se stampare un totale per ogni tipo di doc. IVA" -END - -BOOLEAN F_STAMPAPROGRE -BEGIN - PROMPT 44 12 "Stampa progressivi attuali" - HELP "Indicare se stampare dati attuali a fondo pagina" -END - -BOOLEAN F_STAMPAMOVPROV -BEGIN - PROMPT 4 13 "Stampa movimenti provvisori" - HELP "Indicare se stampare movimenti provvisori" -END - -LIST F_STAMPANUM 15 -BEGIN - PROMPT 4 15 "Stampa numerazione " - HELP "Indicare il tipo di numerazione da stampare" - ITEM "1|Operazione" - ITEM "2|Riga giornale" - ITEM "3|Nessuna" -END - -LIST F_TIPOSTAMPA 34 -BEGIN - PROMPT 4 16 "Tipo stampa " - HELP "Indicare il tipo di stampa da ottenere" - ITEM "1|Mastrini movimentati nel periodo" - ITEM "2|Mastrini con saldi diversi da 0" - ITEM "3|Completa" -END - - -//BOOLEAN F_MEMORIZZA -//BEGIN -// PROMPT 4 17 "Memorizza scelte" -// HELP "Indicare se riproporre le scelte effettuate" -//END - -ENDPAGE - -PAGE "Parametri" -1 -1 60 10 - -LIST F_NUMCARAT 10 -BEGIN - PROMPT 4 2 "Numero caratteri " - HELP "Indicare il numero di caratteri del foglio di stampa (larghezza)" - ITEM "1|132 crt." - ITEM "2|198 crt." -END - -LIST F_FORMATO 23 -BEGIN - PROMPT 4 4 "Formato modulo di stampa " - HELP "Indicare l'altezza del modulo di stampa" - ITEM "66|11 pollici (27,94 cm)" - ITEM "72|12 pollici (30,48 cm)" -END - -LIST F_NUMMAST 10 -BEGIN - PROMPT 4 6 "Numero mastrini per pagina " - HELP "Indicare il numero di mastrini contenuti in una pagina" - ITEM "1|Uno" - ITEM "2|Due" - ITEM "3|Continua" -END - -ENDPAGE - -ENDMASK +#include "cg3200.h" + +TOOLBAR "" 0 20 0 2 + +BUTTON DLG_PRINT 16 2 +BEGIN + PROMPT -13 -11 "~Stampa" + MESSAGE EXIT,K_ENTER +END + +BUTTON F_MEMORIZZA 16 2 +BEGIN + PROMPT -23 -11 "Memorizza scelte" +END + +BUTTON DLG_QUIT 16 2 +BEGIN + PROMPT -33 -11 "" +END + +ENDPAGE + +PAGE "Stampa Mastrini" -1 -1 78 20 + +NUMBER F_CODDITTA 5 +BEGIN + PROMPT 4 1 "Ditta " + FLAGS "FRD" + USE LF_NDITTE KEY 1 + CHECKTYPE REQUIRED + INPUT CODDITTA F_CODDITTA + DISPLAY "Codice" CODDITTA + DISPLAY "Ragione sociale @50" RAGSOC + OUTPUT F_CODDITTA CODDITTA + OUTPUT F_RAGSOC RAGSOC +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 4 2 "Ragione sociale " + FLAGS "D" +END + +TEXT 96 +BEGIN + PROMPT 4 11 "Dalla data competenza" +END + +TEXT 97 +BEGIN + PROMPT 40 11 "Alla data competenza " +END + +TEXT 98 +BEGIN + PROMPT 4 11 "Dalla data operazione " +END + +TEXT 99 +BEGIN + PROMPT 40 11 "Alla data operazione " +END + +NUMBER F_ANNO 4 +BEGIN + PROMPT 47 1 "Codice esercizio " + USE ESC + INPUT CODTAB F_ANNO + DISPLAY "Codice Esercizio" CODTAB + DISPLAY "Data inizio esercizio" D0 + DISPLAY "Data fine esercizio " D1 + OUTPUT F_ANNO CODTAB + CHECKTYPE NORMAL + MESSAGE HIDE,98|HIDE,99|SHOW,96|SHOW,97 + MESSAGE EMPTY HIDE,96|HIDE,97|SHOW,98|SHOW,99 + FLAGS "RZ" +// ADD RUN cg0 -5 esc + ADD NONE +END + +LIST F_TIPOCF_INI 25 +BEGIN + PROMPT 4 4 "Ricerca " + ITEM " |Gruppo/conto/sottoconto" + MESSAGE HIDE,2@|HIDE,3@|RESET,2@|RESET,3@|SHOW,1@ + ITEM "C|Clienti" + MESSAGE HIDE,1@|HIDE,3@|RESET,1@|RESET,3@|SHOW,2@ + ITEM "F|Fornitori" + MESSAGE HIDE,1@|HIDE,2@|RESET,1@|RESET,2@|SHOW,3@ +END + +NUMBER F_GRUPPOINI 3 +BEGIN + PROMPT 4 5 "Da Gruppo - Conto - Sottoconto " +END + +NUMBER F_CONTOINI_CONTO 3 +BEGIN + PROMPT 41 5 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_CONTO CONTO + CHECKTYPE NORMAL + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCINI_CONTO + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO + GROUP 1 +END + +NUMBER F_CONTOINI_CLIENTE 3 +BEGIN + PROMPT 41 5 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C") + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_CLIENTE + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_CLIENTE CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CLIENTE + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCINI_CLIENTE + MESSAGE COPY,F_CONTOINI_CONTO + GROUP 2 +END + +NUMBER F_CONTOINI_FORN 3 +BEGIN + PROMPT 41 5 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F") + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_FORN + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_FORN CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_FORN + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCINI_FORN + MESSAGE COPY,F_CONTOINI_CONTO + GROUP 3 +END + +NUMBER F_SOTTOCINI_CONTO 6 +BEGIN + PROMPT 48 5 "" + USE LF_PCON SELECT SOTTOCONTO!="" + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_CONTO + INPUT SOTTOCONTO F_SOTTOCINI_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_SOTTOCINI_CONTO SOTTOCONTO + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_CONTO CONTO + OUTPUT F_DESCRINI_CONTO DESCR + CHECKTYPE NORMAL + GROUP 1 +END + +STRING F_DESCRINI_CONTO 50 +BEGIN + PROMPT 4 6 "Descrizione " + USE LF_PCON KEY 2 + CHECKTYPE NORMAL + INPUT DESCR F_DESCRINI_CONTO + DISPLAY "Descrizione@50" DESCR + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_SOTTOCINI_CONTO + GROUP 1 +END + +NUMBER F_SOTTOCINI_CLIENTE 6 +BEGIN + PROMPT 48 5 "" + USE LF_CLIFO + CHECKTYPE NORMAL + INPUT TIPOCF "C" + INPUT CODCF F_SOTTOCINI_CLIENTE + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCINI_CLIENTE CODCF + OUTPUT F_DESCRINI_CLIENTE RAGSOC + MESSAGE COPY,F_SOTTOCINI_CONTO + GROUP 2 +END + +STRING F_DESCRINI_CLIENTE 50 +BEGIN + PROMPT 4 6 "Ragione sociale C " + FIELD LF_CLIFO->RAGSOC + USE LF_CLIFO KEY 2 + INPUT TIPOCF "C" + INPUT RAGSOC F_DESCRINI_CLIENTE + DISPLAY "Ragione Sociale Cliente@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCINI_CLIENTE + MESSAGE COPY,F_DESCRINI_CONTO + CHECKTYPE NORMAL + GROUP 2 +END + +NUMBER F_SOTTOCINI_FORN 6 +BEGIN + PROMPT 48 5 "" + USE LF_CLIFO + CHECKTYPE NORMAL + INPUT TIPOCF "F" + INPUT CODCF F_SOTTOCINI_FORN + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCINI_FORN CODCF + OUTPUT F_DESCRINI_FORN RAGSOC + FLAGS "R" + GROUP 3 + MESSAGE COPY,F_SOTTOCINI_CONTO +END + +STRING F_DESCRINI_FORN 50 +BEGIN + PROMPT 4 6 "Ragione Sociale F " + USE LF_CLIFO KEY 2 + INPUT TIPOCF "F" + INPUT RAGSOC F_DESCRINI_FORN + DISPLAY "Ragione Sociale Fornitore@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCINI_FORN + MESSAGE COPY,F_DESCRINI_CONTO + CHECKTYPE NORMAL + GROUP 3 +END + +LIST F_TIPOCF_FINE 25 +BEGIN + PROMPT 4 7 "Ricerca " + ITEM " |Gruppo/conto/sottoconto" + MESSAGE HIDE,5@|HIDE,6@|RESET,5@|RESET,6@|SHOW,4@ + ITEM "C|Clienti" + MESSAGE HIDE,4@|HIDE,6@|RESET,4@|RESET,6@|SHOW,5@ + ITEM "F|Fornitori" + MESSAGE HIDE,4@|HIDE,5@|RESET,4@|RESET,5@|SHOW,6@ +END + +NUMBER F_GRUPPOFINE 3 +BEGIN + PROMPT 4 8 "A Gruppo - Conto - Sottoconto " +END + +NUMBER F_CONTOFINE_CONTO 3 +BEGIN + PROMPT 41 8 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_CONTO CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CONTO + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCFINE_CONTO + GROUP 4 +END + +NUMBER F_CONTOFINE_CLIENTE 3 +BEGIN + PROMPT 41 8 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C") + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_CLIENTE + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_CLIENTE CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CLIENTE + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCFINE_CLIENTE + MESSAGE COPY,F_CONTOFINE_CONTO + GROUP 5 +END + +NUMBER F_CONTOFINE_FORN 3 +BEGIN + PROMPT 41 8 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F") + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_FORN + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_FORN CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_FORN + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCFINE_FORN + MESSAGE COPY,F_CONTOFINE_CONTO + GROUP 6 +END + +NUMBER F_SOTTOCFINE_CONTO 6 +BEGIN + PROMPT 48 8 "" + USE LF_PCON SELECT SOTTOCONTO!="" + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_CONTO + INPUT SOTTOCONTO F_SOTTOCFINE_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_SOTTOCFINE_CONTO SOTTOCONTO + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_CONTO CONTO + OUTPUT F_DESCRFINE_CONTO DESCR + CHECKTYPE NORMAL + WARNING "Sottoconto inesistente o mancante" + GROUP 4 +END + +STRING F_DESCRFINE_CONTO 50 +BEGIN + PROMPT 4 9 "Descrizione " + USE LF_PCON KEY 2 + CHECKTYPE NORMAL + INPUT DESCR F_DESCRINI_CONTO + DISPLAY "Descrizione@50" DESCR + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_SOTTOCFINE_CONTO + GROUP 4 +END + +NUMBER F_SOTTOCFINE_CLIENTE 6 +BEGIN + PROMPT 48 8 "" + USE LF_CLIFO + CHECKTYPE NORMAL + WARNING "Cliente inesistente o mancante" + INPUT TIPOCF "C" + INPUT CODCF F_SOTTOCFINE_CLIENTE + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCFINE_CLIENTE CODCF + OUTPUT F_DESCRFINE_CLIENTE RAGSOC + MESSAGE COPY,F_SOTTOCFINE_CONTO + GROUP 5 +END + +STRING F_DESCRFINE_CLIENTE 50 +BEGIN + PROMPT 4 9 "Ragione sociale " + FIELD LF_CLIFO->RAGSOC + CHECKTYPE NORMAL + USE LF_CLIFO KEY 2 + INPUT TIPOCF "C" + INPUT RAGSOC F_DESCRFINE_CLIENTE + DISPLAY "Ragione Sociale Cliente@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCFINE_CLIENTE + MESSAGE COPY,F_DESCRFINE_CONTO + GROUP 5 +END + +NUMBER F_SOTTOCFINE_FORN 6 +BEGIN + PROMPT 48 8 "" + USE LF_CLIFO + CHECKTYPE NORMAL + WARNING "Fornitore inesistente o mancante" + INPUT TIPOCF "F" + INPUT CODCF F_SOTTOCFINE_FORN + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCFINE_FORN CODCF + OUTPUT F_DESCRFINE_FORN RAGSOC + MESSAGE COPY,F_SOTTOCFINE_CONTO + GROUP 6 +END + +STRING F_DESCRFINE_FORN 50 +BEGIN + PROMPT 4 9 "Ragione Sociale " + USE LF_CLIFO KEY 2 + CHECKTYPE NORMAL + INPUT TIPOCF "F" + INPUT RAGSOC F_DESCRFINE_FORN + DISPLAY "Ragione Sociale Fornitore@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCFINE_FORN + MESSAGE COPY,F_DESCRFINE_CONTO + GROUP 6 +END + +DATE F_DATAINI +BEGIN + PROMPT 26 11 "" +END + +DATE F_DATAFINE +BEGIN + PROMPT 62 11 "" +END + +BOOLEAN F_STAMPATOTIVA +BEGIN + PROMPT 4 12 "Stampa totali documenti IVA" +END + +BOOLEAN F_STAMPAPROGRE +BEGIN + PROMPT 44 12 "Stampa progressivi attuali" +END + +BOOLEAN F_STAMPAMOVPROV +BEGIN + PROMPT 4 13 "Stampa movimenti provvisori" +END + +LIST F_STAMPANUM 15 +BEGIN + PROMPT 4 15 "Stampa numerazione " + ITEM "1|Operazione" + ITEM "2|Riga giornale" + ITEM "3|Nessuna" +END + +LIST F_TIPOSTAMPA 34 +BEGIN + PROMPT 4 16 "Tipo stampa " + ITEM "1|Mastrini movimentati nel periodo" + ITEM "2|Mastrini con saldi diversi da 0" + ITEM "3|Completa" +END + +ENDPAGE + +PAGE "Parametri" -1 -1 78 20 + +LIST F_NUMCARAT 10 +BEGIN + PROMPT 4 2 "Numero caratteri " + ITEM "1|132 crt." + ITEM "2|198 crt." +END + +LIST F_FORMATO 23 +BEGIN + PROMPT 4 4 "Formato modulo di stampa " + ITEM "66|11 pollici (27,94 cm)" + ITEM "72|12 pollici (30,48 cm)" +END + +LIST F_NUMMAST 10 +BEGIN + PROMPT 4 6 "Numero mastrini per pagina " + ITEM "1|Uno" + ITEM "2|Due" + ITEM "3|Continua" +END + +SPREADSHEET F_SCELTE +BEGIN + PROMPT 0 8 "" + ITEM "Anno" + ITEM "Tipo@4" + ITEM "Gr." + ITEM "Co." + ITEM "Sottoc." + ITEM "Tipo@4" + ITEM "Gr." + ITEM "Co." + ITEM "Sottoc." + ITEM "Dal@10" + ITEM "Al@10" + ITEM "IVA" + ITEM "Progr." + ITEM "Provvis." + ITEM "Numerazione" + ITEM "Stampa" +END + +ENDPAGE + +ENDMASK + +PAGE "Scelte" -1 -1 68 13 + +NUMBER F_ANNO 4 +BEGIN + PROMPT 1 1 "Esercizio " + USE ESC + INPUT CODTAB F_ANNO + DISPLAY "Codice Esercizio" CODTAB + DISPLAY "Data inizio esercizio" D0 + DISPLAY "Data fine esercizio " D1 + OUTPUT F_ANNO CODTAB + CHECKTYPE NORMAL + FLAGS "Z" + ADD NONE +END + +LIST F_TIPOCF_INI 25 +BEGIN + PROMPT 1 2 "Dal conto " + ITEM " |Gruppo/conto/sottoconto" + MESSAGE HIDE,2@|HIDE,3@|RESET,2@|RESET,3@|SHOW,1@ + ITEM "C|Clienti" + MESSAGE HIDE,1@|HIDE,3@|RESET,1@|RESET,3@|SHOW,2@ + ITEM "F|Fornitori" + MESSAGE HIDE,1@|HIDE,2@|RESET,1@|RESET,2@|SHOW,3@ +END + +NUMBER F_GRUPPOINI 3 +BEGIN + PROMPT 44 2 "" +END + +NUMBER F_CONTOINI_CONTO 3 +BEGIN + PROMPT 50 2 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_CONTO CONTO + CHECKTYPE NORMAL + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCINI_CONTO + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO + GROUP 1 +END + +NUMBER F_CONTOINI_CLIENTE 3 +BEGIN + PROMPT 50 2 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C") + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_CLIENTE + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_CLIENTE CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CLIENTE + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCINI_CLIENTE + MESSAGE COPY,F_CONTOINI_CONTO + GROUP 2 +END + +NUMBER F_CONTOINI_FORN 3 +BEGIN + PROMPT 50 2 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F") + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_FORN + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_FORN CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_FORN + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCINI_FORN + MESSAGE COPY,F_CONTOINI_CONTO + GROUP 3 +END + +NUMBER F_SOTTOCINI_CONTO 6 +BEGIN + PROMPT 58 2 "" + USE LF_PCON SELECT SOTTOCONTO!="" + INPUT GRUPPO F_GRUPPOINI + INPUT CONTO F_CONTOINI_CONTO + INPUT SOTTOCONTO F_SOTTOCINI_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_SOTTOCINI_CONTO SOTTOCONTO + OUTPUT F_GRUPPOINI GRUPPO + OUTPUT F_CONTOINI_CONTO CONTO + OUTPUT F_DESCRINI_CONTO DESCR + CHECKTYPE NORMAL + GROUP 1 +END + +STRING F_DESCRINI_CONTO 50 +BEGIN + PROMPT 1 3 "Descrizione " + USE LF_PCON KEY 2 + CHECKTYPE NORMAL + INPUT DESCR F_DESCRINI_CONTO + DISPLAY "Descrizione@50" DESCR + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_SOTTOCINI_CONTO + GROUP 1 +END + +NUMBER F_SOTTOCINI_CLIENTE 6 +BEGIN + PROMPT 58 2 "" + USE LF_CLIFO + CHECKTYPE NORMAL + INPUT TIPOCF "C" + INPUT CODCF F_SOTTOCINI_CLIENTE + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCINI_CLIENTE CODCF + OUTPUT F_DESCRINI_CLIENTE RAGSOC + MESSAGE COPY,F_SOTTOCINI_CONTO + GROUP 2 +END + +STRING F_DESCRINI_CLIENTE 50 +BEGIN + PROMPT 1 3 "Cliente " + FIELD LF_CLIFO->RAGSOC + USE LF_CLIFO KEY 2 + INPUT TIPOCF "C" + INPUT RAGSOC F_DESCRINI_CLIENTE + DISPLAY "Ragione Sociale Cliente@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCINI_CLIENTE + MESSAGE COPY,F_DESCRINI_CONTO + CHECKTYPE NORMAL + GROUP 2 +END + +NUMBER F_SOTTOCINI_FORN 6 +BEGIN + PROMPT 58 2 "" + USE LF_CLIFO + CHECKTYPE NORMAL + INPUT TIPOCF "F" + INPUT CODCF F_SOTTOCINI_FORN + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCINI_FORN CODCF + OUTPUT F_DESCRINI_FORN RAGSOC + FLAGS "R" + GROUP 3 + MESSAGE COPY,F_SOTTOCINI_CONTO +END + +STRING F_DESCRINI_FORN 50 +BEGIN + PROMPT 1 3 "Fornitore " + USE LF_CLIFO KEY 2 + INPUT TIPOCF "F" + INPUT RAGSOC F_DESCRINI_FORN + DISPLAY "Ragione Sociale Fornitore@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCINI_FORN + MESSAGE COPY,F_DESCRINI_CONTO + CHECKTYPE NORMAL + GROUP 3 +END + +LIST F_TIPOCF_FINE 25 +BEGIN + PROMPT 1 4 "Al conto " + ITEM " |Gruppo/conto/sottoconto" + MESSAGE HIDE,5@|HIDE,6@|RESET,5@|RESET,6@|SHOW,4@ + ITEM "C|Clienti" + MESSAGE HIDE,4@|HIDE,6@|RESET,4@|RESET,6@|SHOW,5@ + ITEM "F|Fornitori" + MESSAGE HIDE,4@|HIDE,5@|RESET,4@|RESET,5@|SHOW,6@ +END + +NUMBER F_GRUPPOFINE 3 +BEGIN + PROMPT 44 4 "" +END + +NUMBER F_CONTOFINE_CONTO 3 +BEGIN + PROMPT 50 4 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_CONTO CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CONTO + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCFINE_CONTO + GROUP 4 +END + +NUMBER F_CONTOFINE_CLIENTE 3 +BEGIN + PROMPT 50 4 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C") + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_CLIENTE + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_CLIENTE CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CLIENTE + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCFINE_CLIENTE + MESSAGE COPY,F_CONTOFINE_CONTO + GROUP 5 +END + +NUMBER F_CONTOFINE_FORN 3 +BEGIN + PROMPT 50 4 "" + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F") + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_FORN + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_FORN CONTO + CHECKTYPE NORMAL + VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_FORN + WARNING "Conto inesistente o mancante" + MESSAGE DIRTY,F_SOTTOCFINE_FORN + MESSAGE COPY,F_CONTOFINE_CONTO + GROUP 6 +END + +NUMBER F_SOTTOCFINE_CONTO 6 +BEGIN + PROMPT 58 4 "" + USE LF_PCON SELECT SOTTOCONTO!="" + INPUT GRUPPO F_GRUPPOFINE + INPUT CONTO F_CONTOFINE_CONTO + INPUT SOTTOCONTO F_SOTTOCFINE_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_SOTTOCFINE_CONTO SOTTOCONTO + OUTPUT F_GRUPPOFINE GRUPPO + OUTPUT F_CONTOFINE_CONTO CONTO + OUTPUT F_DESCRFINE_CONTO DESCR + CHECKTYPE NORMAL + WARNING "Sottoconto inesistente o mancante" + GROUP 4 +END + +STRING F_DESCRFINE_CONTO 50 +BEGIN + PROMPT 1 5 "Descrizione " + USE LF_PCON KEY 2 + CHECKTYPE NORMAL + INPUT DESCR F_DESCRINI_CONTO + DISPLAY "Descrizione@50" DESCR + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_SOTTOCFINE_CONTO + GROUP 4 +END + +NUMBER F_SOTTOCFINE_CLIENTE 6 +BEGIN + PROMPT 58 4 "" + USE LF_CLIFO + CHECKTYPE NORMAL + WARNING "Cliente inesistente o mancante" + INPUT TIPOCF "C" + INPUT CODCF F_SOTTOCFINE_CLIENTE + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCFINE_CLIENTE CODCF + OUTPUT F_DESCRFINE_CLIENTE RAGSOC + MESSAGE COPY,F_SOTTOCFINE_CONTO + GROUP 5 +END + +STRING F_DESCRFINE_CLIENTE 50 +BEGIN + PROMPT 1 5 "Cliente " + FIELD LF_CLIFO->RAGSOC + CHECKTYPE NORMAL + USE LF_CLIFO KEY 2 + INPUT TIPOCF "C" + INPUT RAGSOC F_DESCRFINE_CLIENTE + DISPLAY "Ragione Sociale Cliente@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCFINE_CLIENTE + MESSAGE COPY,F_DESCRFINE_CONTO + GROUP 5 +END + +NUMBER F_SOTTOCFINE_FORN 6 +BEGIN + PROMPT 58 4 "" + USE LF_CLIFO + CHECKTYPE NORMAL + WARNING "Fornitore inesistente o mancante" + INPUT TIPOCF "F" + INPUT CODCF F_SOTTOCFINE_FORN + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOCFINE_FORN CODCF + OUTPUT F_DESCRFINE_FORN RAGSOC + MESSAGE COPY,F_SOTTOCFINE_CONTO + GROUP 6 +END + +STRING F_DESCRFINE_FORN 50 +BEGIN + PROMPT 1 5 "Fornitore " + USE LF_CLIFO KEY 2 + CHECKTYPE NORMAL + INPUT TIPOCF "F" + INPUT RAGSOC F_DESCRFINE_FORN + DISPLAY "Ragione Sociale Fornitore@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOCFINE_FORN + MESSAGE COPY,F_DESCRFINE_CONTO + GROUP 6 +END + +DATE F_DATAINI +BEGIN + PROMPT 1 6 "Dalla data " +END + +DATE F_DATAFINE +BEGIN + PROMPT 44 6 "Alla data " +END + +BOOLEAN F_STAMPATOTIVA +BEGIN + PROMPT 1 7 "Stampa totali documenti IVA" +END + +BOOLEAN F_STAMPAPROGRE +BEGIN + PROMPT 38 7 "Stampa progressivi attuali" +END + +BOOLEAN F_STAMPAMOVPROV +BEGIN + PROMPT 1 8 "Stampa movimenti provvisori" +END + +LIST F_STAMPANUM 15 +BEGIN + PROMPT 1 9 "Stampa numerazione " + ITEM "1|Operazione" + ITEM "2|Riga giornale" + ITEM "3|Nessuna" +END + +LIST F_TIPOSTAMPA 34 +BEGIN + PROMPT 1 10 "Tipo stampa " + ITEM "1|Mastrini movimentati nel periodo" + ITEM "2|Mastrini con saldi diversi da 0" + ITEM "3|Completa" +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -13 -1 "" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -23 -1 "" +END + + +BUTTON DLG_DELREC 10 2 +BEGIN + PROMPT -33 -1 "" +END + +ENDPAGE + +ENDMASK \ No newline at end of file