diff --git a/cg/cg6700.cpp b/cg/cg6700.cpp index 39a44fd99..cc7928abe 100755 --- a/cg/cg6700.cpp +++ b/cg/cg6700.cpp @@ -117,10 +117,10 @@ public: virtual print_action postprocess_page(int,int); virtual print_action postprocess_print(int file, int counter); virtual void postclose_print(); - const char* look_sdt(); + char look_sdt(); const char* get_codiva_des(const char*); bool DescrConto(int,int,long); - bool check_archivi(TProgind*); + bool check_archivi(); bool look_pag(); bool errori_partita(int,int,long); bool controlla_mov(); @@ -182,10 +182,10 @@ _ric_auto(toupper(ric_auto)), _tipo_lista(toupper(tipo_lista)), _err(80) {} -const char* TRic_ListaMov::look_sdt() +char TRic_ListaMov::look_sdt() { TConfig conf(CONFIG_DITTA); - return conf.get("FlStTra"); + return conf.get("FlStTra")[0]; } bool TRic_ListaMov::look_pag() @@ -307,39 +307,28 @@ bool TRic_ListaMov::user_create() if (_ric_auto != 'A') { - TProgind* pnd = NULL; - pnd = new TProgind (3,TR("Controllo archivi\nPrego attendere"),FALSE, TRUE, 30); - - if (pnd) pnd->addstatus(1); - - if (!check_archivi(pnd)) - { - delete pnd; + TIndwin pnd(0,TR("Controllo archivi..."),FALSE, FALSE); + if (!check_archivi()) return FALSE; - } - - if (pnd) pnd->addstatus(1); - - delete pnd; } - TString80 tmpmov = "%"; + TFilename tmpmov = "%"; tmpmov << get_firm_dir(); - tmpmov << "\\" << TEMP_MOV; - TString80 tmprmov = "%"; + tmpmov << SLASH << TEMP_MOV; + TFilename tmprmov = "%"; tmprmov << get_firm_dir(); - tmprmov << "\\" << TEMP_RMOV; - TString80 tmprmoviva = "%"; + tmprmov << SLASH << TEMP_RMOV; + TFilename tmprmoviva = "%"; tmprmoviva << get_firm_dir(); - tmprmoviva << "\\" << TEMP_RMOVIVA; + tmprmoviva << SLASH << TEMP_RMOVIVA; _tmov = new TIsamtempfile(LF_MOV, tmpmov, 0); _trmov = new TIsamtempfile(LF_RMOV, tmprmov, 0); _is_iva = FALSE; - TString tmp = tmprmoviva.mid(1); + TFilename tmp = tmprmoviva.mid(1); tmp << ".dbf"; - if (fexist(tmp)) + if (tmp.exist()) { _tiva = new TIsamtempfile(LF_RMOVIVA, tmprmoviva, 0); _is_iva = TRUE; @@ -354,17 +343,13 @@ bool TRic_ListaMov::user_create() // ************************************************* // *** Parte riguardante il Saldaconto se esiste *** // ************************************************* - TString80 tmppart = "%"; + TFilename tmppart = "%"; tmppart << get_firm_dir(); - tmppart << "\\" << TEMP_PART; + tmppart << SLASH << TEMP_PART; - _is_salda = FALSE; tmp = tmppart.mid(1); tmp << ".dbf"; - if (fexist(tmp)) - { - _is_salda = TRUE; - } + _is_salda = tmp.exist(); _giornale = new TLibro_giornale(); @@ -392,24 +377,24 @@ void TRic_ListaMov::apri_file_SC() { TToken_string exp; TToken_string exp1; - TString tmp; + TFilename tmp; // ************************************************* // *** Parte riguardante il Saldaconto se esiste *** // ************************************************* - TString80 tmppart = "%"; + TFilename tmppart = "%"; tmppart << get_firm_dir(); tmppart << "\\" << TEMP_PART; - TString80 tmpscad = "%"; + TFilename tmpscad = "%"; tmpscad << get_firm_dir(); tmpscad << "\\" << TEMP_SCAD; - TString80 tmppagsca = "%"; + TFilename tmppagsca = "%"; tmppagsca << get_firm_dir(); tmppagsca << "\\" << TEMP_PAGSCA; - _is_salda = FALSE; tmp = tmppart.mid(1); tmp << ".dbf"; - if (fexist(tmp)) + _is_salda = tmp.exist(); + if (_is_salda) { _part = new TLocalisamfile (LF_PARTITE); _scad = new TLocalisamfile (LF_SCADENZE); @@ -418,7 +403,6 @@ void TRic_ListaMov::apri_file_SC() _tpart = new TIsamtempfile(LF_PARTITE, tmppart, 0); _tscad = new TIsamtempfile(LF_SCADENZE, tmpscad, 0); _tpagsca = new TIsamtempfile(LF_PAGSCA,tmppagsca, 0); - _is_salda = TRUE; _relSC = new TRelation(_tpart); exp.add("TIPOC=TIPOC"); @@ -440,9 +424,8 @@ void TRic_ListaMov::apri_file_SC() } } -bool TRic_ListaMov::check_archivi(TProgind* pnd) +bool TRic_ListaMov::check_archivi() { - TString80 nome; long ditta_ric = get_firm(); if (!prefix().exist(ditta_ric)) @@ -462,12 +445,11 @@ bool TRic_ListaMov::check_archivi(TProgind* pnd) else _record = tr.record(); - TString16 sd = look_sdt(); - - if (sd.not_empty()) - _sdt = sd[0]; - else return error_box(TR("Ricezione tabelle non effettuata: richiamare il programma relativo")); - + const char sd = look_sdt(); + if (sd <= ' ') + return error_box(TR("Ricezione tabelle non effettuata: richiamare il programma relativo")); + + _sdt = sd; if (_sdt == 'T') return error_box(TR("Ricezione tabelle non effettuata: richiamare il programma relativo")); @@ -493,8 +475,6 @@ bool TRic_ListaMov::check_archivi(TProgind* pnd) return warning_box(TR("Trasferimento interamente completato: proseguire per cancellare i file")); } - if (pnd) pnd->addstatus(1); - return TRUE; } @@ -2432,8 +2412,10 @@ print_action TRic_ListaMov::postprocess_page(int file,int count) { reset_print(); _err.reset(); - int n = 1; - if (_tot_dare != _tot_avere) + int n = 1; + + const TCurrency sbil(real(_tot_dare - _tot_avere)); + if (!sbil.is_zero()) { _errore_grave = TRUE; set_row(n++, FR("@8g*** Il movimento risulta sbilanciato. Totali rilevati:@99g%r@116g%r"), @@ -2478,52 +2460,52 @@ void TRic_ListaMov::postclose_print() if (esegui) { - if (_errore_grave_totale) - { - if (_ric_auto == 'A') - { - _risposta = TRUE; - _continua = yesno_box(TR("Rilevati ERRORI GRAVI durante il controllo movimenti: \n Controllare gli errori sulla lista dei movimenti stampata per eseguire le correzioni. \n Continuare ugualmente?")); - TTransfer_file& tr = trasfer(); - if (!_continua) - _record.overwrite(" ",240); //_record e' letto nella read_control_rec() + if (_errore_grave_totale) + { + if (_ric_auto == 'A') + { + _risposta = TRUE; + _continua = yesno_box(TR("Rilevati ERRORI GRAVI durante il controllo movimenti: \n Controllare gli errori sulla lista dei movimenti stampata per eseguire le correzioni. \n Continuare ugualmente?")); + TTransfer_file& tr = trasfer(); + if (!_continua) + _record.overwrite(" ",240); //_record e' letto nella read_control_rec() + else + { + TConfig conf (CONFIG_DITTA); + conf.set("FlStTra", "M"); + _record.overwrite("Z",240); + } + const int size = 1024; + tr.write_control_rec(_record, size); + tr.read_control_rec(); + } else { - TConfig conf (CONFIG_DITTA); - conf.set("FlStTra", "M"); - _record.overwrite("Z",240); + message_box(TR("Rilevati errori gravi durante il controllo movimenti:\n trasferimento interrotto")); + TTransfer_file& tr = trasfer(); + _record.overwrite(" ",240); //_record e' letto nella read_control_rec() + const int size = 1024; + tr.write_control_rec(_record, size); + tr.read_control_rec(); + chiudi_file_SC(); } - const int size = 1024; - tr.write_control_rec(_record, size); - tr.read_control_rec(); - } - else - { - message_box(TR("Rilevati errori gravi durante il controllo movimenti: \n trasferimento interrotto")); - TTransfer_file& tr = trasfer(); - _record.overwrite(" ",240); //_record e' letto nella read_control_rec() - const int size = 1024; - tr.write_control_rec(_record, size); - tr.read_control_rec(); - chiudi_file_SC(); - } - } - else - { - if (_ric_auto == 'A') - _risposta = TRUE; - else - message_box(TR("CONTROLLO MOVIMENTI terminato: \n proseguire con RICEZIONE movimenti")); - TConfig conf (CONFIG_DITTA); - conf.set("FlStTra", "M"); + } + else + { + if (_ric_auto == 'A') + _risposta = TRUE; + else + message_box(TR("CONTROLLO MOVIMENTI terminato: \n proseguire con RICEZIONE movimenti")); + TConfig conf (CONFIG_DITTA); + conf.set("FlStTra", "M"); - TTransfer_file& tr = trasfer(); - _record.overwrite("Z",240); //_record e' letto nella read_control_rec() - const int size = 1024; - tr.write_control_rec(_record, size); - tr.read_control_rec(); - chiudi_file_SC(); - } + TTransfer_file& tr = trasfer(); + _record.overwrite("Z",240); //_record e' letto nella read_control_rec() + const int size = 1024; + tr.write_control_rec(_record, size); + tr.read_control_rec(); + chiudi_file_SC(); + } } // if (esegui) } @@ -3039,8 +3021,6 @@ bool TRic_ListaMov::user_destroy() delete _giornale; delete _trasfer; delete _rel; -// delete _relSC; -// delete _cur; delete _tmov; delete _trmov; if (_is_iva) @@ -3070,9 +3050,10 @@ void TRic_ListaMov::chiudi_file_SC() if (_is_salda) { delete _relSC; _relSC = NULL; - delete _tpart; _tpart = NULL; - delete _tscad; _tscad = NULL; - delete _tpagsca; _tpagsca = NULL; + // Non cancellare: Gia' contenuti in _relSC + // delete _tpart; _tpart = NULL; + // delete _tscad; _tscad = NULL; + // delete _tpagsca; _tpagsca = NULL; delete _part; _part = NULL; delete _scad; _scad = NULL; @@ -3190,7 +3171,8 @@ bool TRic_ListaMov::set_print(int m) msk.set(F_NUMERO, tr.nultras()); msk.set(F_DATALIMITE, tr.dataultras()); - msk.set(F_SDT, look_sdt()); + const char sdt[2] = { look_sdt(), '\0' }; + msk.set(F_SDT, sdt); msk.set(F_SIGLA, tr.ult_file()); msk.set(F_CHIAVE, tr.key());