From 2f412eacd84a288840c9fc2fb84eedaa3410dbf1 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 1 Mar 1995 12:11:27 +0000 Subject: [PATCH] Correzioni al giornale e i registri git-svn-id: svn://10.65.10.50/trunk@1053 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3400.cpp | 87 ++++---- cg/cg4400.cpp | 545 ++++++++++++++++++++++++++----------------------- cg/cg4400.h | 127 ++++++------ cg/cg4400a.uml | 1 - 4 files changed, 397 insertions(+), 363 deletions(-) diff --git a/cg/cg3400.cpp b/cg/cg3400.cpp index 0116c7b83..807ccffbb 100755 --- a/cg/cg3400.cpp +++ b/cg/cg3400.cpp @@ -127,20 +127,21 @@ class CG3400_application : public TPrintapp static bool filtra_reg (const TRelation * r); private: - TRelation * _rel; - TCursor * _cur; - TRectype * _RecPartoDa, *_RecArrivoA; - int _ae; // anno esercizio di ALLA_DATA - int _tipo; // tipo del registro - int _annoEsMov; // anno esercizio letto da mov - TString16 _reg; - int _anno_iva; - bool _stampa_definitiva; - bool _MovGiaStampato; - bool _gia_settato_ariportare; - long _num_rig; - real _importo; - char _sezione; + TRelation* _rel; + TCursor* _cur; + TRectype* _RecPartoDa, *_RecArrivoA; + int _ae; // anno esercizio di ALLA_DATA + int _tipo; // tipo del registro + int _annoEsMov; // anno esercizio letto da mov + TString16 _reg; + int _anno_iva; + bool _stampa_definitiva; + bool _MovGiaStampato; + bool _gia_settato_ariportare; + bool _nuovo_mese; // Finito il mese ? + long _num_rig; + real _importo; + char _sezione; // TParagraph_string* _descr_conto; public: @@ -428,14 +429,14 @@ void CG3400_application::aggiorna_mov() _cur->setregion(da, a); (*_cur) = 0L; -#ifndef DBG2 +#ifndef DBG TProgind prnd (_cur->items(), "Aggiornamento movimenti ...", FALSE, TRUE); #endif // for (mov.read(_isgteq, _lock); mov.curr() < *_RecArrivoA && !mov.eof(); mov.next(_lock)) for ( ; _cur->pos() < _cur->items(); ++(*_cur)) { -#ifdef DBG2 +#ifdef DBG long numreg = _cur->file(LF_MOV).get_long("NUMREG"); TString datareg(_cur->file(LF_MOV).get("DATAREG")); @@ -450,7 +451,7 @@ void CG3400_application::aggiorna_mov() nprog++; } // else mov.reread(_unlock); -#ifndef DBG2 +#ifndef DBG prnd.addstatus(1); #endif } @@ -553,15 +554,16 @@ void CG3400_application::preprocess_footer() ap = TRUE; } - if (_cur->pos() < _cur->items()-1 && !_gia_settato_ariportare) // se sono sull'ultimo + if (_cur->pos() < _cur->items()-1 && !_gia_settato_ariportare) { dt = _tot_dare_progr + _tot_dare_progr_ap; at = _tot_avere_progr + _tot_avere_progr_ap; dts = dt.string(REAL_PICTURE); ats = at.string(REAL_PICTURE); - riga.format ("@b@%dgA riportare @%dg%c %s %c @%dg%s", - _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, + riga.format ("@b@%dg%s@%dg%c %s %c @%dg%s", + _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, + _nuovo_mese ? "Totale progressivi generali " : "A riportare ", _stampa_width == 132 ? DARE132-3 : DARE198, 'D', (const char *) dts, @@ -607,7 +609,7 @@ int CG3400_application::set_totali_pagina(int righe) 'D', (const char *) progr_dare, 'A', - _stampa_width == 132 ? AVERE132-1 : AVERE198, + _stampa_width == 132 ? AVERE132 : AVERE198, (const char *) progr_avere ); @@ -626,7 +628,7 @@ int CG3400_application::set_totali_pagina(int righe) ); set_row (r++, (const char*) riga); } - } + } // !stampa_definitiva _tot_dare_generale = _tot_dare_progr + _tot_dare_progr_ap; _tot_avere_generale = _tot_avere_progr + _tot_avere_progr_ap; @@ -649,6 +651,7 @@ int CG3400_application::set_totali_pagina(int righe) { // Se il movimento ha righe che continuano nella pagina successiva // "A riportare" viene stampato dalla preprocess_footer senno' qui + _gia_settato_ariportare = TRUE; dt = _tot_dare_progr + _tot_dare_progr_ap; @@ -656,14 +659,17 @@ int CG3400_application::set_totali_pagina(int righe) dts = dt.string(REAL_PICTURE); ats = at.string(REAL_PICTURE); - riga.format ("@b@%dgA riportare @%dg%c %s %c @%dg%s", - _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, - _stampa_width == 132 ? DARE132-3 : DARE198-2, - 'D', - (const char *) dts, - 'A', - _stampa_width == 132 ? AVERE132 : AVERE198, - (const char *) ats); + // "Se il mese e' finito devo scrivere Totale progressivi generali + // invece che A riportare" + + riga.format ("@b@%dgTotale progressivi generali @%dg%c %s %c @%dg%s", + _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, + _stampa_width == 132 ? DARE132-3 : DARE198-2, + 'D', + (const char *) dts, + 'A', + _stampa_width == 132 ? AVERE132 : AVERE198, + (const char *) ats); set_row (r++, (const char*) riga); } return r; @@ -831,16 +837,10 @@ bool CG3400_application::preprocess_print(int file, int counter) switch (file) { case LF_MOV: - - // _gia_settata_riga_mov = FALSE; // Stampa o no la riga di mov (solo se - // NO stampa giornale_iva_unico - + _nuovo_mese = FALSE; _iva_array.destroy(); - _nprog_mov = _nprog_da; - *_RecPartoDa = _cur->file(LF_MOV).curr(); - break; default: break; @@ -869,7 +869,7 @@ void CG3400_application::fill_page(int riga) // char frm[4]; word r_l = 0; - r_l = printer().rows_left(); + r_l = printer().rows_left() - RIGHE_FOOTER; // Se sono rimaste righe da riempire if (r_l) { @@ -896,14 +896,13 @@ void CG3400_application::fill_page(int riga) print_action CG3400_application::postprocess_page(int file, int counter) { int righe_iva_settate=0; - static bool nuovo_mese = FALSE; bool FINITO = FALSE; if (counter) { - if (nuovo_mese) { + if (_nuovo_mese) { printer().formfeed(); - nuovo_mese = FALSE; + _nuovo_mese = FALSE; } return NEXT_PAGE; } @@ -934,9 +933,9 @@ print_action CG3400_application::postprocess_page(int file, int counter) if (_data_corr != _data_succ || _cur->pos() == _cur->items()) // if (_data_corr != _data_succ || FINITO) { - nuovo_mese = (_mese_succ != _mese_corr); + _nuovo_mese = (_mese_succ != _mese_corr); int righe = set_totali_giorno(_data_corr, righe_iva_settate); - if (nuovo_mese) + if (_nuovo_mese) { righe = set_totali_pagina(righe); // Nella stampa su bollato metto un segno su tutte le righe @@ -1942,7 +1941,7 @@ bool CG3400_application::set_print(int) ma.set_handler (DATA_A, data_a_hndl); ma.set_handler (DATA_DA,data_da_hndl); - _pagina_da = 0; // Parto dall'inizio + _pagina_da = 0; // Parto dall'inizio while ((tasto = ma.run()) != K_QUIT) { diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 08acd7929..6cdc2b004 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -140,18 +140,6 @@ bool CG4400_application::mask_tipo_stampa(TMask_field& f, KEY k) bool CG4400_application::mask_mese (TMask_field& f, KEY k) { - /* - if (k == K_ENTER) - { - if (id == MESE) //Per stampa su libro unico - { - int umese = f.mask().get_int(ULTIMO_MESE); - if (mese != umese+1) - return f.warning_box ("Le stampe devono essere richieste mese per mese!\n" - "I mesi successivi a %s non sono ancora stati stampati.", itom(umese)); - } - } - */ if (k == K_SPACE) { const short id = f.dlg(); @@ -161,6 +149,7 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k) if (id == FINO_A_MESE) mese = f.mask().get_int(FINO_A_MESE); //Per stampa su bollato if (id == MESE) + { if (mese == 12) { f.mask().show (TIPO_RIEPILOGATIVO); @@ -170,14 +159,23 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k) { f.mask().hide (TIPO_RIEPILOGATIVO); f.mask().hide (RIF_VID); - } + } + //TMask_field& cc = f.mask().field(CODICE_LIBRO_IVA); + //cc.set_dirty(); + } if (id == FINO_A_MESE) { if (mese == 12) f.mask().show (TIPO_RIEPILOGATIVO); else f.mask().hide (TIPO_RIEPILOGATIVO); - } + } } + if (k==K_TAB && f.mask().is_running()) + { + const short id = f.dlg(); + if (id == MESE) + f.mask().send_key(K_TAB, CODICE_LIBRO_IVA); + } return TRUE; } @@ -223,7 +221,7 @@ bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const return FALSE; } -bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta) +bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta, bool* st) { int a, tipo; TString16 codtab; @@ -258,6 +256,7 @@ bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, if (u_data.month() < m - 1) { app().set_firm(__firm); + *st = FALSE; return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta); } ok = TRUE; @@ -312,9 +311,11 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k) } else { - ok = app().look_regs(anno,codlib,fino_a_mese,&mese,ditta); + ok = app().look_regs(anno,codlib,fino_a_mese,&mese,ditta,&can_print); if ( app()._selected[i] && !ok ) { + if (!can_print) + return FALSE; f.message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", ditta); continue; } @@ -744,11 +745,13 @@ void CG4400_application::calcola_progressivi() if ( _tipo_stampa == 2 || _tipo_stampa == 4 ) num = _datareg.month(); - //calcolo i totali del periodo: il discorso e' indipendente dalla frequenza! + //il discorso e' indipendente dalla frequenza! //if (_frequiva == 'T') // if (num%3 != 0) // num = num - (num%3); + //calcolo i totali del periodo + chiave = ""; //_codatt e' gia' Z perche' lo leggo dal registro chiave << _annoes << _codatt; @@ -770,50 +773,25 @@ void CG4400_application::calcola_progressivi() real impo = pim.get_real("R0"); real impos = pim.get_real("R1"); real implo = pim.get_real("R2"); + TToken_string& fatt_rit = (TToken_string&)pim.get("S1"); + real im = real::ita2eng(fatt_rit.get(0)); + real is = real::ita2eng(fatt_rit.get(1)); + impo += im; + impos += is; + implo += im+is; _tot_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva); if (_tipo_reg == 2) //registro acquisti _iva_array.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,0,TRUE); } } + //calcolo i totali progressivi + if (_tipo_stampa == 3) num = _fino_a_mese; if ( _tipo_stampa == 2 || _tipo_stampa == 4 ) num = _datareg.month(); - //calcolo i totali progressivi - /* - if (_frequiva == 'T') - for (i=3; i d) + Tabreg.put("D3", ultima_data); + } + else if (_data_a > d) + Tabreg.put("D3", _data_a); + + if (_tipo_reg == 2 && _stampa_cred_pre) + if (_mese_credito == 0 && _credito > ZERO) + if (_mov_empty) + Tabreg.put("I8", (long)_fino_a_mese); + else Tabreg.put("I8", (long)_datareg.month()); + + Tabreg.rewrite(); + } +} + void CG4400_application::aggiorna_reg(const bool aggiorna_vidi) { TString16 codtab; @@ -2203,32 +2222,72 @@ void CG4400_application::stampa_vidi() printer().close(); } +void CG4400_application::liq_b0_settato() +{ + TFilename f; + f.temp("rg"); + if (_tipo_stampa == 1) + send_message('S',f, _datareg.month()); + else send_message('s',f, _datareg.month()); + TString80 nomef; + nomef = f.path(); nomef << "\\" << f.name(); + if (fexist(nomef)) + { + printer().formfeed(); + _intesta_liq = TRUE; + merge_export_file(f,FALSE,TRUE); + _intesta_liq = FALSE; + } +} + +void CG4400_application::liq_other_case() +{ + if (_scelta == prosegui_cal_stampa) + { + _t.temp("reg"); + if (_tipo_stampa == 1) + send_message('L', _t, _datareg.month()); + else send_message('l', _t, _datareg.month()); + } + if (_scelta == prosegui_stampa) + { + _t.temp("reg"); + if (_tipo_stampa == 1) + send_message('S', _t, _datareg.month()); + else send_message('s', _t, _datareg.month()); + TFilename app; + app.temp(); + send_message('C', app, _datareg.month()); + } +} + print_action CG4400_application::postprocess_page (int file, int counter) { if (file == LF_MOV) { if (counter) //dopo aver fatto un REPEAT_PAGE (cioe' dopo aver stampato le righe settate in set_page_tot_reg()), in pratica a rottura di mese o alla fine { - reset_print(); + reset_print(); if (_liquidazione) if (!_st_liq[_datareg.month()] && stampo_liquidazione(_datareg.month())) { _st_liq[_datareg.month()] = TRUE; - TFilename t; - t.temp("rg"); - if (_tipo_stampa == 1) - send_message('L',t, _datareg.month()); - else send_message('l',t, _datareg.month()); - TString80 nomef; - nomef = t.path(); nomef << "\\" << t.name(); - if (fexist(nomef)) - { - printer().formfeed(); - _intesta_liq = TRUE; - merge_export_file(t,FALSE,TRUE); - _intesta_liq = FALSE; - } - } + if (_scelta == B0_settato) + liq_b0_settato(); + if (_scelta == prosegui_stampa || _scelta == prosegui_cal_stampa) + { + TString80 nomef; + nomef = _t.path(); nomef << "\\" << _t.name(); + if (fexist(nomef)) + { + printer().formfeed(); + _intesta_liq = TRUE; + merge_export_file(_t,FALSE,TRUE); + _intesta_liq = FALSE; + } + _t = NULL; + } + } } if (!counter) { @@ -2240,7 +2299,8 @@ print_action CG4400_application::postprocess_page (int file, int counter) if ( FINITO ) { - if (_tipo_stampa == 2 || _tipo_stampa == 4) + liq_other_case(); + if (_tipo_stampa != 1) calcola_progressivi(); set_page_tot_reg(); return REPEAT_PAGE; @@ -2256,7 +2316,8 @@ print_action CG4400_application::postprocess_page (int file, int counter) if (_dataregs.month() != _dataregp.month()) { - if (_tipo_stampa == 2 || _tipo_stampa == 4) + liq_other_case(); + if (_tipo_stampa != 1) calcola_progressivi(); set_page_tot_reg(); return REPEAT_PAGE; @@ -2274,7 +2335,6 @@ bool CG4400_application::set_print(int n) bool ok; m.set_handler (TIPO_STAMPA, mask_tipo_stampa); - //m.set_handler (A_CODICE, mask_firm_to); m.set_handler (DA_DATA, mask_data); m.set_handler (A_DATA, mask_data); m.set_handler (MESE, mask_mese); @@ -2384,12 +2444,97 @@ bool CG4400_application::look_lia(long ditta) return ok; } +void CG4400_application::look_reg() +{ + _liquidazione = _tabreg->get_bool("B7"); + _riep_liq = _tabreg->get_bool("B6"); + _corrispettivi = _tabreg->get_bool("B0"); + _pagine_stampate = _tabreg->get_long("I1"); + _numini = _pagine_stampate; + _cod_un_loc = _tabreg->get_int("I7"); + _mese_ultima_liq = _tabreg->get_int("I4"); + _mese_credito = _tabreg->get_int("I8"); + _codatt = _tabreg->get("S8"); + _tipoatt = tipo_attivita(); + _attivita = desc_attivita(); + _desc_lib = _tabreg->get ("S0"); + _stampa_ind_ditta = _tabreg->get_bool ("B9"); + _stampa_ind_comp = _tabreg->get_bool ("B5"); + _stampa_cred_pre = _tabreg->get_bool ("B4"); +} + void CG4400_application::clear_stliq() { for (int i=0; i < 12; i++) _st_liq[i] = FALSE; } +bool CG4400_application::setta_mask(long i) +{ + if (_stampa_mese == 13) _stampa_mese = 0; + if (_tipo_stampa == 2 || _tipo_stampa == 4) + { + TMask mb("cg4400b"); + mb.set(F_CODDITTA, _ditta); + mb.set(F_RAGSOC, _ditte->row(i).get(2)); + mb.set(COD_LIB, _codreg); + const char* m = ""; + m = format("%02d", _stampa_mese); + mb.set(U_MESE, m); + mb.set(U_PAGINA, _pagine_stampate); + if (_u_data.ok()) + mb.set(U_DATA, _u_data.string()); + KEY tasto = mb.run(); + if (tasto != K_ENTER) return FALSE; + } + return TRUE; +} + +void CG4400_application::no_movimenti() +{ + _mov_empty = TRUE; + if (_liquidazione) + { + int da, a; + //stampo la liquidazione per tutti i mesi fino a _fino_a_mese + if (_tipo_stampa == 2 || _tipo_stampa == 4) + da = 1; + if (_tipo_stampa == 3) + da = _fino_a_mese; + if (_tipo_stampa == 1) + da = _data_da.month(); + if (_tipo_stampa == 1) + a = _data_a.month(); + else a = _fino_a_mese; + for (int m = da; m <= a; m++) + { + if (! printer().isopen()) + printer().open(); + if (stampo_liquidazione(m)) + { + _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header + TFilename t; + t.temp("rgp"); + if (_tipo_stampa == 1) + send_message('L',t, m); + else send_message('l',t, m); + TString80 nomef; + nomef = t.path(); nomef << "\\" << t.name(); + if (fexist(nomef)) + { + _intesta_liq = TRUE; + //if (m > da) printer().formfeed(); + merge_export_file(t,FALSE,TRUE); + printer().formfeed(); + _intesta_liq = FALSE; + } + } + } + if (printer().isopen()) printer().close(); + } + scrivi_reg(); //aggiorno il registro anche se non ho stampato proprio nulla per quel mese! +} + bool CG4400_application::stampa_registri_IVA(const TMask& m) { bool ok = FALSE; @@ -2402,8 +2547,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) _frequiva = _ditte->row(i).get_char(3); _intesta_liq = FALSE; _intesta_vidi = FALSE; - _ok_vidi = FALSE; + _ok_vidi = FALSE; _stampa_mese = 13; + _scelta = prosegui_stampa; TApplication::set_firm(_ditta); look_lia(); ok = compila_reg(m); @@ -2418,39 +2564,21 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) _cur->set_filterfunction(filter_func); if (!_stampa_tutti_i_registri) { + ok = setta_mask(i); + if (!ok) continue; if (_liquidazione) { clear_stliq(); - ok = controlla_liquidazione(); - if (!ok) continue; - } + _scelta = controlla_liquidazione(); + if (_scelta == non_proseguire) + return FALSE; + } + (*_cur) = 0L; //la filter function viene chiamata quando posiziono il cursore - if (_stampa_mese == 13) _stampa_mese = 0; const long item = _cur->items(); - if (_tipo_stampa == 2 || _tipo_stampa == 4) - { - TMask mb("cg4400b"); - mb.set(F_CODDITTA, _ditta); - mb.set(F_RAGSOC, _ditte->row(i).get(2)); - mb.set(COD_LIB, _codreg); - const char* m = ""; - m = format("%02d", _stampa_mese); - mb.set(U_MESE, m); - mb.set(U_PAGINA, _pagine_stampate); - if (_u_data.ok()) - mb.set(U_DATA, _u_data.string()); - KEY tasto = mb.run(); - if (tasto != K_ENTER) continue; - } + if (item > 0l) { - if (_tipo_stampa != 1) - { - TFilename t; - t.temp(); - send_message('C',t, _fino_a_mese); - } - print(); if (is_cancelled()) return FALSE; @@ -2458,50 +2586,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) if (_tipo_stampa != 3 && _liquidazione) stampa_liq_mesi_succ(); } - else //non ci sono movimenti da stampare nel periodo richiesto! - { - _mov_empty = TRUE; - if (_liquidazione) - { - int da, a; - //stampo la liquidazione per tutti i mesi fino a _fino_a_mese - if (_tipo_stampa == 2 || _tipo_stampa == 4) - //da = _stampa_mese; - da = 1; - if (_tipo_stampa == 3) - da = _fino_a_mese; - if (_tipo_stampa == 1) - da = _data_da.month(); - if (_tipo_stampa == 1) - a = _data_a.month(); - else a = _fino_a_mese; - for (int m = da; m <= a; m++) - { - if (! printer().isopen()) - printer().open(); - if (stampo_liquidazione(m)) - { - _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header - TFilename t; - t.temp("rgp"); - if (_tipo_stampa == 1) - send_message('L',t, m); - else send_message('l',t, m); - TString80 nomef; - nomef = t.path(); nomef << "\\" << t.name(); - if (fexist(nomef)) - { - _intesta_liq = TRUE; - //if (m > da) printer().formfeed(); - merge_export_file(t,FALSE,TRUE); - printer().formfeed(); - _intesta_liq = FALSE; - } - } - } - if (printer().isopen()) printer().close(); - } - } + //non ci sono movimenti da stampare nel periodo richiesto! + else no_movimenti(); + if (_tipo_stampa == 3 && _rif_vid) { _intesta_vidi = TRUE; @@ -2563,64 +2650,34 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) continue; } msg = FALSE; - _liquidazione = _tabreg->get_bool("B7"); - _riep_liq = _tabreg->get_bool("B6"); - _corrispettivi = _tabreg->get_bool("B0"); - _pagine_stampate = _tabreg->get_long("I1"); - _numini = _pagine_stampate; - _cod_un_loc = _tabreg->get_int("I7"); - _mese_ultima_liq = _tabreg->get_int("I4"); - _mese_credito = _tabreg->get_int("I8"); - _codatt = _tabreg->get("S8"); - _tipoatt = tipo_attivita(); - _attivita = desc_attivita(); - _desc_lib = _tabreg->get ("S0"); - _stampa_ind_ditta = _tabreg->get_bool ("B9"); - _stampa_ind_comp = _tabreg->get_bool ("B5"); - _stampa_cred_pre = _tabreg->get_bool ("B4"); + + look_reg(); _intesta_liq = FALSE; _intesta_vidi = FALSE; _ok_vidi = FALSE; _stampa_mese = 13; + _scelta = prosegui_stampa; + ok = setta_mask(i); + if (!ok) continue; + + if (_liquidazione) + { + clear_stliq(); + _scelta = controlla_liquidazione(); + if (_scelta == non_proseguire) + return FALSE; + } _cur->set_filterfunction(NULL); _cur->set_filterfunction(filter_func); // Vado a vedere se ci sono movimenti (*_cur) = 0L; - if (_stampa_mese == 13) _stampa_mese = 0; const long items = _cur->items(); - if (_tipo_stampa == 2 || _tipo_stampa == 4) - { - TMask mb("cg4400b"); - mb.set(F_CODDITTA, _ditta); - mb.set(F_RAGSOC, _ditte->row(i).get(2)); - mb.set(COD_LIB, _codreg); - const char* m = ""; - m = format("%02d", _stampa_mese); - mb.set(U_MESE, m); - mb.set(U_PAGINA, _pagine_stampate); - if (_u_data.ok()) - mb.set(U_DATA, _u_data.string()); - KEY tasto = mb.run(); - if (tasto != K_ENTER) continue; - } + if (items > 0l) { - if (_tipo_stampa != 1) - { - if (_liquidazione) //per i registri "validi" eseguo il controllo liquidazione - { - clear_stliq(); - ok = controlla_liquidazione(); - if (!ok) continue; - } - TFilename t; - t.temp(); - send_message('C',t, _fino_a_mese); - } - print(); if (is_cancelled()) return FALSE; @@ -2628,49 +2685,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) if (_tipo_stampa != 3 && _liquidazione) stampa_liq_mesi_succ(); } - else //anche se non ho dei movimenti devo stampare la liq. sotto certe ipotesi. - { - _mov_empty = TRUE; - //stampo la liquidazione per tutti i mesi fino a _fino_a_mese (in caso di stampa = 2/3/4) - if (_liquidazione) - { - int da, a; - if (_tipo_stampa == 2 || _tipo_stampa == 4) - da = 1; - if (_tipo_stampa == 3) - da = _fino_a_mese; - if (_tipo_stampa == 1) - da = _data_da.month(); - if (_tipo_stampa == 1) - a = _data_a.month(); - else a = _fino_a_mese; - for (int m = da; m <= a; m++) - { - if (!printer().isopen()) - printer().open(); - if (stampo_liquidazione(m)) - { - //ok = controlla_liquidazione(); - //if (!ok) break; - _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header - TFilename t; - t.temp("rgi"); - TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); - if (_tipo_stampa == 1) - send_message('L',t, m); - else send_message('l',t, m); - if (fexist(nomef)) - { - _intesta_liq = TRUE; - merge_export_file(t,FALSE,TRUE); - printer().formfeed(); - _intesta_liq = FALSE; - } - } - } - if (printer().isopen()) printer().close(); - } - } + else no_movimenti(); + if (_tipo_stampa == 3 && _rif_vid) { _intesta_vidi = TRUE; @@ -2681,7 +2697,7 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) if (msg) message_box("Ditta %ld: Nessun registro soddisfa i parametri indicati", _ditta); } - } + } } TApplication::set_firm(__firm); return TRUE; @@ -2702,8 +2718,8 @@ void CG4400_application::stampa_liq_mesi_succ() TFilename t; t.temp("iva"); if (_tipo_stampa == 1) - send_message('L',t, m); - else send_message('l',t,m); + send_message('S',t, m); + else send_message('s',t,m); TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); if (fexist(nomef)) { @@ -2720,18 +2736,25 @@ void CG4400_application::stampa_liq_mesi_succ() void CG4400_application::send_message(char tipo, const TFilename& nome, int mese) { //const char* const app = "cg4a -2 -icon"; - const char* const app = "cg4a -2"; + const char* app; + + if (tipo == 'S' || tipo == 's') + app = "cg4a -2 -S"; + else if (tipo == 'C') + app = "cg4a -2 -C"; + else app = "cg4a -2"; + TToken_string ss(10); ss.add(_annoes); - ss.add(mese); + ss.add(mese); ss.add(_ditta); ss.add(tipo); ss.add(_data_stampa.string()); ss.add(nome); ss.add("x"); - TMessage liq ("cg4a -2", "RCL", ss); + TMessage liq (app, "RCL", ss); liq.send(); TExternal_app pn(app); diff --git a/cg/cg4400.h b/cg/cg4400.h index d7a4ca650..87c0b4d92 100755 --- a/cg/cg4400.h +++ b/cg/cg4400.h @@ -26,7 +26,12 @@ #include "cglib03.h" #include "conto.h" -const int TABREG = (int)TTable::name2log("REG"); +enum messaggio { + B0_settato, + non_proseguire, + prosegui_stampa, + prosegui_cal_stampa + }; class CG4400_application : public TPrintapp { @@ -57,65 +62,14 @@ class CG4400_application : public TPrintapp real _totale_doc, _credito; TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt; TString _tipodoc, _descr_doc, _codlib, _codice_vidi; - TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis; + TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis; + TFilename _t; + messaggio _scelta; + +protected: -protected: - const char* desc_attivita (); - const char* tipo_attivita (); - const char* descr_doc (); - const char* descr_iva (const char *); - TRectype& ricerca_occ(const char*); - TRectype& ricerca_cf (char, long); - TRectype& look_comuni(const char*); - TArray_sheet* get_ditte_sheet() { return _ditte; } - int setta_riga (int, const TRigaiva&, real&, real&, real&, real&); - int riga_rmoviva(); - bool set_print(int); - bool set_ditte(TMask&); - bool compila_reg(const TMask&); - bool compila_lib(); - bool controlla_liquidazione(); - bool controlla_mov(); - bool stampo_liquidazione(int); - bool ventilazione(const char*); - bool cerca_libro_gio(TString&); - bool look_reg (int, int, TString&, int, const char*, int*, long); - bool look_regs(int, TString&, int, int*, long); - bool stampa_totali_finali(); - bool stampa_datareg(); - bool stampa_registri_IVA(const TMask&); - bool look_lia(long ditta = 0l); - void set_choice_limits(TMask&); - void build_ditte_sheet(); - void cerca_reg(const TString&, byte*); - void set_page_tot_reg(); - void send_message(char, const TFilename&,int); - void aggiorna_reg(const bool aggiorna_vidi); - void aggiorna_lib(); - void calcola_progressivi(); - void stampa_liq_mesi_succ(); - bool user_create(); - bool user_destroy(); - bool preprocess_page(int, int); - int stampa_intestazione(); - int stampa_prospetto(); - long select_firm_range(long,long); - void stampa_plafonds(int); - void get_dati_ditta(); - void stampa_vidi(); - int stampa_acquisti(int); - real stampa_valori_plafonds(const real&, const int, TTable&, const char*); - bool preprocess_print(int, int); - print_action postprocess_page (int, int); - void preprocess_header(); - void build_nomiditte(TProgind* pnd = NULL); - void set_year(int y) { _annoes = y; } - void clear_stliq(); - static bool filter_func (const TRelation * r); - static bool mask_tipo_stampa (TMask_field&, KEY); - //static bool mask_firm_to (TMask_field&, KEY); static bool to_ditt_handler (TMask_field&, KEY); static bool fr_ditt_handler (TMask_field&, KEY); static bool to_butt_handler (TMask_field&, KEY); @@ -131,6 +85,65 @@ protected: public: + const char* desc_attivita (); + const char* tipo_attivita (); + const char* descr_doc (); + const char* descr_iva (const char *); + TRectype& ricerca_occ(const char*); + TRectype& ricerca_cf (char, long); + TRectype& look_comuni(const char*); + TArray_sheet* get_ditte_sheet() { return _ditte; } + int setta_riga (int, const TRigaiva&, real&, real&, real&, real&); + int riga_rmoviva(); + bool set_print(int); + bool set_ditte(TMask&); + bool compila_reg(const TMask&); + bool compila_lib(); + messaggio controlla_liquidazione(); + bool controlla_mov(); + bool stampo_liquidazione(int); + bool ventilazione(const char*); + bool cerca_libro_gio(TString&); + bool look_reg (int, int, TString&, int, const char*, int*, long); + bool look_regs(int, TString&, int, int*, long, bool*); + bool stampa_totali_finali(); + bool stampa_datareg(); + bool stampa_registri_IVA(const TMask&); + bool look_lia(long ditta = 0l); + bool ricerca_mese(TString&,TString&,int,int,TMask_field&); + void set_choice_limits(TMask&); + void build_ditte_sheet(); + void cerca_reg(const TString&, byte*); + void set_page_tot_reg(); + void send_message(char, const TFilename&,int); + void aggiorna_reg(const bool aggiorna_vidi); + void aggiorna_lib(); + void calcola_progressivi(); + void stampa_liq_mesi_succ(); + void look_reg(); + void no_movimenti(); + void liq_b0_settato(); + void liq_other_case(); + bool setta_mask(long); + bool preprocess_page(int, int); + int stampa_intestazione(); + int stampa_prospetto(); + long select_firm_range(long,long); + void stampa_plafonds(int); + void get_dati_ditta(); + void stampa_vidi(); + void scrivi_reg(); + int stampa_acquisti(int); + real stampa_valori_plafonds(const real&, const int, TTable&, const char*); + void build_nomiditte(TProgind* pnd = NULL); + void set_year(int y) { _annoes = y; } + void clear_stliq(); + virtual bool preprocess_print(int, int); + virtual bool user_create(); + virtual bool user_destroy(); + virtual print_action postprocess_page (int, int); + virtual void preprocess_header(); + CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100) {} virtual ~CG4400_application() {} }; diff --git a/cg/cg4400a.uml b/cg/cg4400a.uml index 5a2d45d2e..31ccdcf6b 100755 --- a/cg/cg4400a.uml +++ b/cg/cg4400a.uml @@ -133,7 +133,6 @@ BEGIN CHECKTYPE REQUIRED WARNING "Inserire il codice del libro unico" VALIDATE ZEROFILL_FUNC 3 - MESSAGE K_TAB, CODICE_LIBRO_IVA GROUP 2 END