diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 368ff60be..ba2a6b32a 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -238,9 +238,30 @@ bool TLiquidazione_app::user_create() to.put(MOV_DATAREG, t); _cur->setregion(from, to); _canprint = is_month_ok_strict(_month); + + /* + if (is_month_ok_strict(_month)) + update_firm(_month); + */ + //modifica del 03/05/1995 + int need_refresh = FALSE; + for (int m = 1; m < _month; m++) + if (is_month_ok_strict(m) && (!look_lim(m) || !_lim->get_bool("B0"))) + { + need_refresh = TRUE; + break; + } + if (need_refresh) _recalc = ever; + + for (int mese = 1; mese < _month; mese++) // fino a 13 compreso + if (is_month_ok(mese, _month) || _recalc == ever) + update_firm(mese); + if (is_month_ok_strict(_month)) update_firm(_month); + //fine modifica + if (_isprint && _descr_arr.items() > 0) print(); TApplication::set_firm(__firm); diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 571c469bc..5588f5bcd 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -131,7 +131,11 @@ bool CG4400_application::mask_tipo_stampa(TMask_field& f, KEY k) { int tipo_stampa = m.get_int(TIPO_STAMPA); if (tipo_stampa == 3) //stampa su libro unico + { m.enable_page(1); + TMask_field& cc = f.mask().field(CODICE_LIB_UN); + cc.set_dirty(); + } else m.disable_page(1); } @@ -160,7 +164,7 @@ 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); + //TMask_field& cc = f.mask().field(CODICE_LIB_UN); //cc.set_dirty(); } if (id == FINO_A_MESE) @@ -174,8 +178,8 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k) { const short id = f.dlg(); if (id == MESE) - f.mask().send_key(K_TAB, CODICE_LIBRO_IVA); - } + f.mask().send_key(K_TAB, CODICE_LIBRO_IVA); + } return TRUE; } @@ -197,12 +201,16 @@ bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const TDate sca_vid = _tabreg->get_date("D1"); if (codlib != cod_lib_un) { - if (_selected[i]) message_box("Ditta %ld: il codice libro unico del registro non e' uguale al codice libro unico indicato", ditta); + if (_selected.ones() == 1L) + if (_selected[i]) + message_box("Ditta %ld: il codice libro unico del registro non e' uguale al codice libro unico indicato", ditta); return FALSE; } if (m < *umese) { - if (_selected[i]) message_box("Ditta %ld: il mese indicato e' inferiore al mese dell'ultima data di stampa del registro", ditta); + if (_selected.ones() == 1L) + if (_selected[i]) + message_box("Ditta %ld: il mese indicato e' inferiore al mese dell'ultima data di stampa del registro", ditta); return FALSE; } if (u_data.ok()) @@ -212,7 +220,9 @@ bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const if (sca_vid.ok()) if (sca_vid.month() < m) { - if (_selected[i]) message_box("Ditta %ld: la data scadenza di vidimazione del registro non deve essere inferiore al mese indicato", ditta); + if (_selected.ones() == 1L) + if (_selected[i]) + message_box("Ditta %ld: la data scadenza di vidimazione del registro non deve essere inferiore al mese indicato", ditta); return FALSE; } } @@ -251,13 +261,16 @@ bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, if (sca_vid.ok()) if (sca_vid.month() < m) continue; - if (u_data.ok()) - if (u_data.month() < m - 1) - { - app().set_firm(__firm); - *st = FALSE; - return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta); - } + int month; + if (!u_data.ok()) + month = 0; + else month = u_data.month(); + if (month < m - 1) + { + app().set_firm(__firm); + *st = FALSE; + return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta); + } ok = TRUE; } } @@ -274,7 +287,13 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k) { TString16 cod(f.mask().get(CODICE_LIBRO_IVA)); TString16 codlib(f.mask().get(CODICE_LIB_UN)); - + //modifica del 26/04/1995 + if (codlib.empty()) + { + app()._test = TRUE; + return f.error_box("Inserire il codice del libro unico"); + } + //fine modifica int fino_a_mese = f.mask().get_int(MESE); int anno = f.mask().get_int(ANNO); bool ok = FALSE; @@ -297,11 +316,12 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k) { //modifica del 21/04/1995 suggerita da Cinzia!!! if (app()._selected.ones() == 1L) //solo se ho selezionato 1 ditta devo dare il messaggio - //if (app()._selected[i]) f.message_box("Ditta %ld: il registro %s non soddisfa i parametri indicati", ditta, (const char*)cod); - f.message_box("Ditta %ld: il registro %s non soddisfa i parametri indicati", ditta, (const char*)cod); - else continue; + if (app()._selected[i]) + f.message_box("Ditta %ld: il registro %s non soddisfa i parametri indicati", ditta, (const char*)cod); + continue; } - if (mese != 0 && mese < fino_a_mese - 1) //indipendentemente se si tratta di una ditta selezionata oppure no + //if (mese != 0 && mese < fino_a_mese - 1) //indipendentemente se si tratta di una ditta selezionata oppure no + if (mese < fino_a_mese - 1) //indipendentemente se si tratta di una ditta selezionata oppure no { app().set_firm(app().__firm); can_print = FALSE; @@ -316,9 +336,9 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k) { if (!can_print) return FALSE; - //if ( app()._selected[i]) if (app()._selected.ones() == 1L) //solo se ho selezionato 1 ditta devo dare il messaggio - f.message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", ditta); + if (app()._selected[i]) + f.message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", ditta); continue; } } @@ -339,23 +359,15 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k) bool CG4400_application::mask_cod (TMask_field& f, KEY k) { - TTable TabLbu ("%LBU"); - TString codtab; - int anno; - - if (k == K_ENTER) - { - TString16 codlib(f.get()); - if (codlib.empty()) - return f.warning_box("Inserire il codice del libro unico"); - } - //if (k == K_TAB || f.focusdirty()) if (k == K_TAB) { - TString16 codlib(f.mask().get(CODICE_LIB_UN)); - anno = f.mask().get_int(ANNO); + TTable TabLbu ("%LBU"); + TString codtab; + int anno; + TString16 codlib(f.get()); + anno = f.mask().get_int(ANNO); TabLbu.zero(); codtab.format ("%04d%-3s", anno, (const char*)codlib); TabLbu.put ("CODTAB", codtab); @@ -366,6 +378,13 @@ bool CG4400_application::mask_cod (TMask_field& f, KEY k) f.mask().set(ULTIMA_PAGINA,TabLbu.get_long("I1")); app()._codice_vidi = TabLbu.get("S4"); } + //modifica del 26/04/1995 + if (app()._test) + { + f.mask().send_key(K_TAB, CODICE_LIBRO_IVA); + app()._test = FALSE; + } + //fine modifica } return TRUE; } @@ -643,16 +662,16 @@ void CG4400_application::build_nomiditte(TProgind* pnd) _nomiditte.add(d); } - if (pnd) pnd->addstatus(1); + //if (pnd) pnd->addstatus(1); //TApplication::set_firm(__firm); } bool CG4400_application::user_create() { - TProgind* pnd = NULL; + //TProgind* pnd = NULL; - pnd = new TProgind (2,"Preparazione archivi\nPrego attendere", - FALSE, TRUE, 30); + //pnd = new TProgind (2,"Preparazione archivi\nPrego attendere", + // FALSE, TRUE, 30); _com = new TLocalisamfile(LF_COMUNI); _anag = new TLocalisamfile(LF_ANAG); @@ -684,7 +703,7 @@ bool CG4400_application::user_create() _ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte", "@1|Cod.@5R|Ragione Sociale@50|Vers."); - if (pnd) pnd->addstatus(1); + //if (pnd) pnd->addstatus(1); _n_ditte = 0l; __firm = TApplication::get_firm(); @@ -692,16 +711,14 @@ bool CG4400_application::user_create() TDate oggi(TODAY); _annoes = oggi.year(); - build_nomiditte(pnd); + build_nomiditte(); build_ditte_sheet(); - //if (pnd) pnd->addstatus(1); - add_cursor(_cur); add_file(LF_MOV); add_file(LF_RMOVIVA); - delete pnd; + //delete pnd; return TRUE; } @@ -1165,9 +1182,9 @@ int CG4400_application::stampa_prospetto() { TTipodoc& doc = (TTipodoc&)_doc_array[j]; rr = r+j; - set_row(rr, "%2s", (const char*) doc._tipodoc); - set_row(rr, "@3g%s", (const char*) doc._descrdoc); - set_row(rr, "@54g%r", &doc._totdoc); + set_row(rr, "%2s", (const char*) doc._tipodoc); + set_row(rr, "@3g%s", (const char*) doc._descrdoc); + set_row(rr, "@54g%r", &doc._totdoc); } _doc_array.destroy(); } @@ -1861,40 +1878,6 @@ bool CG4400_application::preprocess_page(int file, int counter) _datareg = mov.get_date(MOV_DATAREG); - /* - if (_tipo_stampa != 3 && _liquidazione) - { - int da; - if (_tipo_stampa == 1) - da = _data_da.month(); - else da = 1; - int a = _datareg.month(); - for (int m = da; m < a; m++) - { - if (!_st_liq[m]) - if (stampo_liquidazione(m)) - { - _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione) - TFilename t; - t.temp("reg"); - if (_tipo_stampa == 1) - send_message('S', t, m); - else send_message('s', t, m); - TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); - if (fexist(nomef)) - { - _intesta_liq = TRUE; - merge_export_file(t,FALSE,TRUE); - printer().formfeed(); - _intesta_liq = FALSE; - reset_print(); - } - } - _st_liq[m] = TRUE; - } - } - */ - if (_tipo_stampa != 3 && _liquidazione) { int da; @@ -1932,6 +1915,7 @@ bool CG4400_application::preprocess_page(int file, int counter) printer().formfeed(); _intesta_liq = FALSE; reset_print(); + fremove(t); } } _st_liq[m] = TRUE; @@ -2433,17 +2417,28 @@ void CG4400_application::liq_b0_settato() printer().footerlen(0); merge_export_file(f,FALSE,TRUE); _intesta_liq = FALSE; + fremove(f); } } void CG4400_application::liq_other_case() { - if (_scelta == prosegui_cal_stampa) + 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 (stampo_liquidazione(_datareg.month())) + { + _t.temp("reg"); + if (_tipo_stampa == 1) + send_message('L', _t, _datareg.month()); + else send_message('l', _t, _datareg.month()); + } + else //se chiamo la liquidazione con L o l mi calcola anche i progressivi + if (_tipo_stampa != 1) + { + TFilename app; + app.temp(); + send_message('C', app, _datareg.month()); + } } if (_scelta == prosegui_stampa) { @@ -2454,11 +2449,14 @@ void CG4400_application::liq_other_case() send_message('S', _t, _datareg.month()); else send_message('s', _t, _datareg.month()); } - TFilename app; - app.temp(); - send_message('C', app, _datareg.month()); + if (_tipo_stampa != 1) //in stampa di prova i progressivi me li calcolo io!!! + { //Why??? + TFilename app; + app.temp(); + send_message('C', app, _datareg.month()); + } } - if (_scelta == no_liquidazione) + if (_scelta == no_liquidazione && _tipo_stampa != 1) { TFilename app; app.temp(); @@ -2488,8 +2486,9 @@ print_action CG4400_application::postprocess_page (int file, int counter) printer().footerlen(0); merge_export_file(_t,FALSE,TRUE); _intesta_liq = FALSE; + fremove(_t); } - _t = NULL; + //_t = NULL; Come ho potuto scrivere cio?! } } } @@ -2740,7 +2739,8 @@ void CG4400_application::no_movimenti() printer().footerlen(0); merge_export_file(f,FALSE,TRUE); printer().formfeed(); - _intesta_liq = FALSE; + _intesta_liq = FALSE; + fremove(f); } } } @@ -2878,7 +2878,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) _ok_vidi = FALSE; _stampa_mese = 13; _scelta = controlla_b0(); //sul registro non va stampata la liq. ma comunque - //va richiamata per il calcolo progressivi (a seconda di b0) + //va richiamata per il calcolo progressivi (a seconda di b0) + //se non e' stampa di prova ok = setta_mask(i); if (!ok) continue; @@ -2944,8 +2945,8 @@ void CG4400_application::stampa_liq_mesi_succ() TFilename t; t.temp("iva"); if (_tipo_stampa == 1) - send_message('S',t, m); - else send_message('s',t,m); + send_message('L',t, m); //prima era S ma non andava bene! + else send_message('l',t,m); //prima era s //TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); //if (fexist(nomef)) if (fexist(t)) @@ -2954,7 +2955,8 @@ void CG4400_application::stampa_liq_mesi_succ() if (m > da) printer().formfeed(); printer().footerlen(0); merge_export_file(t,FALSE,TRUE); - _intesta_liq = FALSE; + _intesta_liq = FALSE; + fremove(t); } } } diff --git a/cg/cg4400.h b/cg/cg4400.h index 733d83986..6ee87c826 100755 --- a/cg/cg4400.h +++ b/cg/cg4400.h @@ -23,7 +23,8 @@ #include #include #include -#include "cglib03.h" +#include "cglib03.h" +#include "cglib04.h" #include "conto.h" enum messaggio { @@ -47,7 +48,8 @@ class CG4400_application : public TPrintapp TBit_array _selected; TArray_sheet *_ditte; TArray _nomiditte; - bool _st_liq[13]; + bool _st_liq[13]; + bool _test; TRecnotype _nrec; bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf, _stampa; bool _corrispettivi, _liquidazione, _riep_liq, _stampa_ind_comp, _esiste_riga_iva, _stampa_cred_pre; @@ -146,7 +148,7 @@ public: virtual print_action postprocess_page (int, int); virtual void preprocess_header(); - CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100) {} + CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100), _test(FALSE) {} virtual ~CG4400_application() {} }; diff --git a/cg/cg4400a.uml b/cg/cg4400a.uml index 31ccdcf6b..ef5100501 100755 --- a/cg/cg4400a.uml +++ b/cg/cg4400a.uml @@ -78,7 +78,7 @@ END DATE DATA_STAMPA BEGIN - PROMPT 28 7 "Data stampa " + PROMPT 28 7 "Data stampa " FLAGS "A" CHECKTYPE REQUIRED WARNING "Inserire la data di stampa" @@ -169,7 +169,7 @@ LISTBOX MESE 10 BEGIN PROMPT 4 9 "Mese " HELP "Mese di cui eseguire la stampa" - FLAGS "M" + FLAGS "M" GROUP 2 END