diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index b76f44496..d4ad1fa84 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -119,11 +119,11 @@ public: bool segnala_errori_primariga(); bool segnala_errori_ogniriga(); bool segnala_errori_iva(); - bool contropartita(); + bool contropartita(int, int, long, char); void stampa_errori_rmov(); void stampa_errori_mov(); void stampa_errori_iva(int*,const char*,const int,const int); - void stampa_errori_contropartita(); + void stampa_errori_contropartita(int, int, long, char); void stampa_intestazione(); void incrementa_totali(); void compila_clifo(); @@ -595,11 +595,15 @@ void TListaMov_application::stampa_errori_rmov() TRectype rec (current_cursor()->file(LF_RMOV).curr()); int gruppo = rec.get_int(RMV_GRUPPO); int conto = rec.get_int(RMV_CONTO); - long sottoconto = rec.get_long(RMV_SOTTOCONTO); - int anno = rec.get_int(RMV_ANNOES); - TDate datareg = rec.get_date(RMV_DATAREG); - char sez = rec.get_char(RMV_SEZIONE); - char tipo = rec.get_char(RMV_TIPOC); + long sottoconto = rec.get_long(RMV_SOTTOCONTO); + int anno = rec.get_int(RMV_ANNOES); + TDate datareg = rec.get_date(RMV_DATAREG); + char sez = rec.get_char(RMV_SEZIONE); + char tipo = rec.get_char(RMV_TIPOC); + int gruppoc = rec.get_int(RMV_GRUPPOC); + int contoc = rec.get_int(RMV_CONTOC); + long sottocontoc = rec.get_long(RMV_SOTTOCONTOC); + char tipoc = rec.get_char(RMV_TIPOCC); bool g = FALSE; char t; @@ -679,19 +683,20 @@ void TListaMov_application::stampa_errori_rmov() set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente in Saldi p.d.c."); //TRecnotype numrec = current_cursor()->file(LF_RMOV).recno(); - //stampa_errori_contropartita(); + if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l) + stampa_errori_contropartita(gruppoc, contoc, sottocontoc, tipoc); //current_cursor()->file(LF_RMOV).readat(numrec); } -void TListaMov_application::stampa_errori_contropartita() +void TListaMov_application::stampa_errori_contropartita(int gruppo, int conto, long sottoconto, char t) { - TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); - char t; - int gruppo = rmov.get_int (RMV_GRUPPOC); - int conto = rmov.get_int (RMV_CONTOC); - long sottoconto = rmov.get_long(RMV_SOTTOCONTOC); - + //TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); + //int gruppo = rmov.get_int (RMV_GRUPPOC); + //int conto = rmov.get_int (RMV_CONTOC); + //long sottoconto = rmov.get_long(RMV_SOTTOCONTOC); + //char t; bool g = FALSE; + TConto tc; TRectype pc (_pcon->curr()); tc.set(gruppo,0,0l); @@ -702,7 +707,7 @@ void TListaMov_application::stampa_errori_contropartita() set_row(_nr++, "@11gCodice gruppo/conto/sottoconto di contropartita non presente in Piano dei Conti"); else { - t = pc.get_char(PCN_TMCF); + //t = pc.get_char(PCN_TMCF); tc.set(gruppo,conto,sottoconto); if (t != 'C' && t != 'F') { @@ -715,7 +720,7 @@ void TListaMov_application::stampa_errori_contropartita() set_row(_nr++, "@11gCodice gruppo/conto/sottoconto di contropartita sospeso in Piano dei Conti"); } } - else + else if (sottoconto != 0l) { TLocalisamfile clifo(LF_CLIFO); clifo.setkey(1); @@ -1687,13 +1692,13 @@ else _err.set(3); } //controlli sulla contropartita -bool TListaMov_application::contropartita() +bool TListaMov_application::contropartita(int gruppo, int conto, long sottoconto, char t) { - char t; - TLocalisamfile rmov(LF_RMOV,FALSE); - int gruppo = rmov.get_int (RMV_GRUPPOC); - int conto = rmov.get_int (RMV_CONTOC); - long sottoconto = rmov.get_long(RMV_SOTTOCONTOC); + //char t; + //TLocalisamfile rmov(LF_RMOV,FALSE); + //int gruppo = rmov.get_int (RMV_GRUPPOC); + //int conto = rmov.get_int (RMV_CONTOC); + //long sottoconto = rmov.get_long(RMV_SOTTOCONTOC); TConto tc; TRectype pc (_pcon->curr()); @@ -1703,7 +1708,7 @@ bool TListaMov_application::contropartita() tc.set(gruppo,conto,0l); if (!tc.read(pc)) return TRUE; - else t = pc.get_char(PCN_TMCF); + //else t = pc.get_char(PCN_TMCF); tc.set(gruppo,conto,sottoconto); if (t != 'C' && t != 'F') { @@ -1716,7 +1721,7 @@ bool TListaMov_application::contropartita() return TRUE; } } - else + else if (sottoconto != 0l) { TLocalisamfile clifo(LF_CLIFO); clifo.setkey(1); @@ -1739,10 +1744,10 @@ bool TListaMov_application::contropartita() bool TListaMov_application::segnala_errori_ogniriga() { TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); - int gruppo, conto, anno; - long sottoconto; + int gruppo, conto, anno, gruppoc, contoc; + long sottoconto, sottocontoc; TDate datareg; - char sez, tipo, t; + char sez, tipo, t, tipoc; if (current_cursor()->is_first_match(LF_RMOV)) { @@ -1758,6 +1763,10 @@ bool TListaMov_application::segnala_errori_ogniriga() gruppo = rec.get_int(RMV_GRUPPO); conto = rec.get_int(RMV_CONTO); sottoconto = rec.get_long(RMV_SOTTOCONTO); + gruppoc = rec.get_int(RMV_GRUPPOC); + contoc = rec.get_int(RMV_CONTOC); + sottocontoc = rec.get_long(RMV_SOTTOCONTOC); + tipoc = rec.get_char(RMV_TIPOCC); anno = rec.get_int(RMV_ANNOES); datareg = rec.get_date(RMV_DATAREG); sez = rec.get_char(RMV_SEZIONE); @@ -1765,15 +1774,14 @@ bool TListaMov_application::segnala_errori_ogniriga() TConto tc (gruppo,conto,sottoconto); - /* - TRecnotype numerorec = rmov.recno(); - if (contropartita()) - { - rmov.readat(nrec); - return TRUE; - } - rmov.readat(numerorec); - */ + // TRecnotype numerorec = rmov.recno(); + if (contropartita(gruppoc, contoc, sottocontoc, tipoc)) + // { + // rmov.readat(nrec); + return TRUE; + // } + // rmov.readat(numerorec); + if (anno != _annoeser || datareg != _datareg) { rmov.readat(nrec); @@ -2227,8 +2235,10 @@ void TListaMov_application::init_print(const TMask& msk) set_real_picture("###.###.###.###"); TDate data (msk.get(F_DATASTAMPA)); + printer().setdate(data); - + printer().footerlen(5); + switch (_tipo_lista) { case movimenti: diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index c0b92de09..41a7e32f4 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -22,11 +22,12 @@ bool CG4400_application::filter_func (const TRelation * r) if ( (datareg < app()._data_da || datareg > app()._data_a ) || (!datareg.ok()) ) return FALSE; - //if (app()._tipo_stampa == 2 || app()._tipo_stampa == 4) //stampa di bollato if (app()._tipo_stampa != 1) //stampa di bollato if (regst) //il movimento e' gia' stato stampato in forma definitiva return FALSE; - + + if (datareg.month() < app()._stampa_mese) + app()._stampa_mese = datareg.month(); return TRUE; } @@ -826,7 +827,6 @@ int CG4400_application::riga_rmoviva() int tipodet, tipocr, tipoatt; bool intra; - //_cur->save_status(); TLocalisamfile& rmoviva = _cur->file(LF_RMOVIVA); bool ok = _cur->is_first_match(LF_RMOVIVA); int nrec = 0; @@ -865,7 +865,6 @@ int CG4400_application::riga_rmoviva() ok = _cur->next_match(LF_RMOVIVA); } - //_cur->restore_status(); rmoviva.readat(nr); return nrec; @@ -926,7 +925,7 @@ bool CG4400_application::controlla_liquidazione() if (lim.read() != NOERR) { mesi_cal << itom(i) << "\n"; - _st_liq[i] = TRUE; + _st_liq[i] = TRUE; } } } @@ -968,11 +967,9 @@ bool CG4400_application::controlla_mov() { TLocalisamfile mov (LF_MOV); bool ok = TRUE; - bool first = TRUE; byte tipo; TString16 ditta = ""; TRecnotype rec = _tabreg->recno(); - _stampa_mese = 0; for (mov.first(); !mov.eof(); mov.next()) { TString16 reg = mov.get(MOV_REG); @@ -990,12 +987,6 @@ bool CG4400_application::controlla_mov() if (!stampato) ok = FALSE; } - if ( datareg.year() == _annoes && first) - if (!stampato) - { - _stampa_mese = datareg.month(); - first = FALSE; - } } } _tabreg->readat(rec); @@ -1333,7 +1324,6 @@ void CG4400_application::set_page_tot_reg() rr = stampa_prospetto(); - //if (_nrec > 0) //numero di records di rmoviva if (_esiste_riga_iva && _stampa) { real tot_imponib, tot_imposta, tot_lordo, tot_imponibp, tot_impostap, tot_lordop; @@ -1603,7 +1593,15 @@ bool CG4400_application::compila_reg(const TMask& m) codtab << _annoes << _codreg; _tabreg->zero(); _tabreg->put("CODTAB", codtab); - if (_tabreg->read() == NOERR) + if (_tabreg->read() != NOERR) + { + if (_tipo_stampa != 3) + { + warning_box("Il registro IVA specificato non esiste nella \n Ditta %ld", _ditta); + return FALSE; + } + } + else { _tipo_reg = _tabreg->get_int("I0"); if (_tipo_reg == 1 || _tipo_reg == 2) //registro iva @@ -1611,13 +1609,7 @@ bool CG4400_application::compila_reg(const TMask& m) cod_lib_un = _tabreg->get("S6"); sca_vid = _tabreg->get_date("D0"); if (_tipo_stampa != 1) - { _u_data = _tabreg->get_date ("D3"); - /* - if (!_u_data.ok()) - _u_data = format("01/01/%4d", _annoes); - */ - } if ( _tipo_stampa == 2 || _tipo_stampa == 4 ) { if (_u_data.ok()) @@ -1664,12 +1656,8 @@ bool CG4400_application::compila_reg(const TMask& m) _tipoatt = tipo_attivita(); _attivita = desc_attivita(); _desc_lib = _tabreg->get ("S0"); - } - } - else if (_tipo_stampa != 3) - { - warning_box("Il registro IVA specificato non esiste nella \n Ditta %ld", _ditta); - return FALSE; + } + else return FALSE; } } return TRUE; @@ -2008,8 +1996,6 @@ void CG4400_application::aggiorna_reg() TTable Tabreg ("REG"); TTable TabInl ("%INL"); int mese; - //long pag; - //long stampate; word ultimast = get_page_number(); if (_stampa_tutti_i_registri) //ho fatto un salto pagina dopo avere stampato un registro @@ -2088,18 +2074,14 @@ void CG4400_application::aggiorna_reg() TString16 numero_riga = cod_inl.mid(7,6); cod << codtab << numero_riga; } - //long numini = _pagine_stampate + 1; nuovo.put("CODTAB", cod); nuovo.put("I0", (long)_annoes); nuovo.put("I1", (long)_fino_a_mese); // su libro unico ho un solo mese in gioco! nuovo.put("I2", (long)(_primast + 1)); // numero iniziale pagina libro unico - //nuovo.put("I3", (long)(_primast + ultimast)); // numero finale pagina libro unico nuovo.put("I3", (long)(_u_stampata)); // numero finale pagina libro unico nuovo.put("I4", get_firm()); nuovo.put("S0", _codreg); nuovo.put("S1", _codice_vidi); - //nuovo.put("I5", (long)numini); //numero iniziale pagina registro utente - //nuovo.put("I6", (long)(numini + ultimast - 1)); //numero finale pagina registro utente nuovo.put("I5", (long)(_numini + 1)); nuovo.put("I6", (long)_pagine_stampate); @@ -2108,7 +2090,6 @@ void CG4400_application::aggiorna_reg() else TabInl.write(nuovo); - //_u_stampata += ultimast; //ultima pagina stampata sul libro unico aggiorna_lib(); } } @@ -2346,7 +2327,6 @@ bool CG4400_application::set_print(int n) _rif_vid = m.get_bool(RIF_VID); _primast = _u_stampata; _data_da = format("01/%02d/%04d", _fino_a_mese, _annoes); - //set_page_number(_u_stampata + 1); } if (_fino_a_mese == 12) { @@ -2406,7 +2386,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) bool msg = TRUE; _ditta = _ditte->row(i).get_long(1); _frequiva = _ditte->row(i).get_char(3); - _intesta_liq = FALSE; + _intesta_liq = FALSE; + _stampa_mese = 13; TApplication::set_firm(_ditta); look_lia(); ok = compila_reg(m); @@ -2427,204 +2408,47 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) ok = controlla_liquidazione(); if (!ok) continue; } - (*_cur) = 0L; + (*_cur) = 0L; //la filter function viene chiamata quando posiziono il cursore + if (_stampa_mese == 13) _stampa_mese = 0; const long item = _cur->items(); - if (item > 0) //cioe' se ci sono dei movimenti da stampare + 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 == 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 (_tipo_stampa != 1) { TFilename t; t.temp(); send_message('C',t, _fino_a_mese); - } + } + print(); 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); - _intesta_liq = FALSE; - } - } - printer().close(); - } - } -} -if (_tipo_stampa == 3 && _rif_vid) -{ - _intesta_vidi = TRUE; - stampa_vidi(); //stampa riferimenti vidimazione -} -} -else //stampa tutti i registri -{ - TString16 codtab, cod_lib_un; - int anno; - TDate sca_vid; - for (_tabreg->first(); !_tabreg->eof(); _tabreg->next()) - { - _tipo_reg = _tabreg->get_int("I0"); - codtab = _tabreg->get("CODTAB"); - anno = atoi(codtab.mid(0,4)); - if (anno > _annoes) - break; - if (anno == _annoes) - if ( _tipo_reg == 1 || _tipo_reg == 2 ) //registro iva - { - _codreg = codtab.mid(4,3); - cod_lib_un = _tabreg->get("S6"); - sca_vid = _tabreg->get_date("D0"); - if (_tipo_stampa != 1) - _u_data = _tabreg->get_date("D3"); - if (_tipo_stampa == 2 || _tipo_stampa == 4) + else //non ci sono movimenti da stampare nel periodo richiesto! { - if (_u_data.ok()) - if (_data_a < _u_data) - { - message_box("Ditta %ld: Il registro %s e' gia' stato stampato come bollato di %s", _ditta, (const char*) _codreg, itom(_fino_a_mese)); - continue; - } - if (cod_lib_un.not_empty()) - continue; - if (sca_vid.ok()) - if (sca_vid.month() < _fino_a_mese) - continue; - } - if (_tipo_stampa == 4) //stampa con riferimenti al libro giornale - { - TString16 d; - TRecnotype rec = _tabreg->recno(); - bool trovato = cerca_libro_gio(d); - _tabreg->readat(rec); - if (!trovato) - continue; - } - if (_tipo_stampa == 3) //stampa su libro unico - { - if (cod_lib_un != _codlib) - continue; - if (_u_data.ok()) - if (_fino_a_mese < _u_data.month()) - continue; - if (sca_vid.ok()) - if (sca_vid.month() < _fino_a_mese) - 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"); - _cur->set_filterfunction(NULL); - _cur->set_filterfunction(filter_func); - - // Vado a vedere se ci sono movimenti - (*_cur) = 0L; - const long items = _cur->items(); - if (items > 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) continue; - } - 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 (_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) + _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; @@ -2632,48 +2456,212 @@ else //stampa tutti i registri da = _data_da.month(); if (_tipo_stampa == 1) a = _data_a.month(); - else a = _fino_a_mese; + else a = _fino_a_mese; for (int m = da; m <= a; m++) { - if (!printer().isopen()) + 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(); + 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(); + //if (m > da) printer().formfeed(); merge_export_file(t,FALSE,TRUE); + printer().formfeed(); _intesta_liq = FALSE; - } - } - printer().close(); + } + } } - } - } + if (printer().isopen()) printer().close(); + } + } if (_tipo_stampa == 3 && _rif_vid) { _intesta_vidi = TRUE; stampa_vidi(); //stampa riferimenti vidimazione - } + } } - } //for - if (msg) - message_box("Ditta %ld: Nessun registro soddisfa i parametri indicati", _ditta); -} -} -} -TApplication::set_firm(__firm); -return TRUE; + else //stampa tutti i registri + { + TString16 codtab, cod_lib_un; + int anno; + TDate sca_vid; + for (_tabreg->first(); !_tabreg->eof(); _tabreg->next()) + { + _tipo_reg = _tabreg->get_int("I0"); + codtab = _tabreg->get("CODTAB"); + anno = atoi(codtab.mid(0,4)); + if (anno > _annoes) + break; + if (anno == _annoes) + if ( _tipo_reg == 1 || _tipo_reg == 2 ) //registro iva + { + _codreg = codtab.mid(4,3); + cod_lib_un = _tabreg->get("S6"); + sca_vid = _tabreg->get_date("D0"); + if (_tipo_stampa != 1) + _u_data = _tabreg->get_date("D3"); + if (_tipo_stampa == 2 || _tipo_stampa == 4) + { + if (_u_data.ok()) + if (_data_a < _u_data) + { + message_box("Ditta %ld: Il registro %s e' gia' stato stampato come bollato di %s", _ditta, (const char*) _codreg, itom(_fino_a_mese)); + continue; + } + if (cod_lib_un.not_empty()) + continue; + if (sca_vid.ok()) + if (sca_vid.month() < _fino_a_mese) + continue; + } + if (_tipo_stampa == 4) //stampa con riferimenti al libro giornale + { + TString16 d; + TRecnotype rec = _tabreg->recno(); + bool trovato = cerca_libro_gio(d); + _tabreg->readat(rec); + if (!trovato) + continue; + } + if (_tipo_stampa == 3) //stampa su libro unico + { + if (cod_lib_un != _codlib) + continue; + if (_u_data.ok()) + if (_fino_a_mese < _u_data.month()) + continue; + if (sca_vid.ok()) + if (sca_vid.month() < _fino_a_mese) + 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"); + + _stampa_mese = 13; + + _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 (_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(); + } + } + if (_tipo_stampa == 3 && _rif_vid) + { + _intesta_vidi = TRUE; + stampa_vidi(); //stampa riferimenti vidimazione + } + } + } //for + if (msg) + message_box("Ditta %ld: Nessun registro soddisfa i parametri indicati", _ditta); + } + } + } + TApplication::set_firm(__firm); + return TRUE; } @@ -2702,8 +2690,8 @@ void CG4400_application::stampa_liq_mesi_succ() _intesta_liq = FALSE; } } - printer().close(); } + if (printer().isopen()) printer().close(); } void CG4400_application::send_message(char tipo, const TFilename& nome, int mese) diff --git a/cg/cg4400.h b/cg/cg4400.h index 1dd00c111..f2757484a 100755 --- a/cg/cg4400.h +++ b/cg/cg4400.h @@ -13,9 +13,7 @@ #include #include #include - -#include "conto.h" // CI VOGLIONO LE VIRGOLETTE! CAPITELA! - +#include "conto.h" #include #include #include diff --git a/cg/cg4400b.uml b/cg/cg4400b.uml index 8257e35db..439a60293 100755 --- a/cg/cg4400b.uml +++ b/cg/cg4400b.uml @@ -27,8 +27,9 @@ END LISTBOX U_MESE 10 BEGIN - PROMPT 3 5 "Stampa mese " - FLAGS "MD" + PROMPT 3 5 "Stampa mese " + FLAGS "MD" + ITEM "00|Nessuno" END NUMBER U_PAGINA 4