Corretta memorizzazione scelte

git-svn-id: svn://10.65.10.50/trunk@4273 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-04-11 12:55:31 +00:00
parent a68a6c40c4
commit 6a04320fab

View File

@ -1,8 +1,3 @@
//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 <execp.h> #include <execp.h>
#include <mailbox.h> #include <mailbox.h>
#include <msksheet.h> #include <msksheet.h>
@ -299,11 +294,6 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
return TRUE; 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) bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key)
{ {
const short id = f.dlg(); const short id = f.dlg();
@ -559,10 +549,6 @@ bool TMastrini_application::contof_hnd (TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
/////////////////////////////////////////////////////////////////////////////
// FINE MODIFICA DEL 02-05-95 //
/////////////////////////////////////////////////////////////////////////////
bool TMastrini_application::check_ordine(TMask_field& f, KEY k) bool TMastrini_application::check_ordine(TMask_field& f, KEY k)
{ {
const int gruppof = f.mask().get_int(F_GRUPPOFINE); const int gruppof = f.mask().get_int(F_GRUPPOFINE);
@ -654,7 +640,6 @@ bool TMastrini_application::almeno_un_record()
if (_annomsk == 0) if (_annomsk == 0)
datareg = rmov.get_date(RMV_DATAREG); datareg = rmov.get_date(RMV_DATAREG);
else else
if (_annomsk != 0)
datareg = datacomp; datareg = datacomp;
gruppo = rmov.get_int(RMV_GRUPPO); gruppo = rmov.get_int(RMV_GRUPPO);
@ -775,7 +760,7 @@ void TMastrini_application::saldi_zero()
real saldo_dare, saldo_avere; real saldo_dare, saldo_avere;
long record; long record;
saldo_dare = saldo_avere = 0; saldo_dare = saldo_avere = 0.0;
if (current_cursor()->is_first_match(LF_RMOV)) if (current_cursor()->is_first_match(LF_RMOV))
{ {
@ -790,20 +775,20 @@ void TMastrini_application::saldi_zero()
_mov->read(); _mov->read();
if (_mov->bad()) if (_mov->bad())
_mov->zero(); _mov->zero();
TString provvis (_mov->curr().get(MOV_PROVVIS)); int provvis (_mov->curr().get_int(MOV_PROVVIS));
int gruppo = atoi(rmov.get(RMV_GRUPPO)); int gruppo = atoi(rmov.get(RMV_GRUPPO));
int conto = atoi(rmov.get(RMV_CONTO)); int conto = atoi(rmov.get(RMV_CONTO));
long sottoc = atol(rmov.get(RMV_SOTTOCONTO)); long sottoc = atol(rmov.get(RMV_SOTTOCONTO));
if ((gruppo == _gruppo)&&(conto == _conto)&&(sottoc == _sottoc)) if ((gruppo == _gruppo)&&(conto == _conto)&&(sottoc == _sottoc))
{ {
if (_stampa_mov_prov || provvis.trim().empty()) if (_stampa_mov_prov || provvis == 0)
{ {
char sezione = rmov.curr().get(RMV_SEZIONE)[0]; char sezione = rmov.curr().get(RMV_SEZIONE)[0];
real importo = rmov.curr().get_real(RMV_IMPORTO); real importo = rmov.curr().get_real(RMV_IMPORTO);
if (sezione == 'D') if (sezione == 'D')
saldo_dare += importo; saldo_dare += importo;
else if (sezione == 'A') else
saldo_avere += importo; saldo_avere += importo;
} }
} }
@ -1440,11 +1425,11 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_tipostampa == 2) if (_tipostampa == 2)
saldi_zero(); saldi_zero();
else else
_totale_saldo = 1; _totale_saldo = 1.0;
if ((_tipostampa == 1) || (_tipostampa == 2)) if ((_tipostampa == 1) || (_tipostampa == 2))
{ {
if ((almeno_un_record() && _totale_saldo != ZERO ) || (_totale_saldo != ZERO && _tipostampa == 2)) if (_totale_saldo != ZERO && (_tipostampa == 2 || almeno_un_record()))
{ {
_puoi_stampare = TRUE; _puoi_stampare = TRUE;
@ -1540,7 +1525,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
// Controlla se saldo e' diverso da 0 // Controlla se saldo e' diverso da 0
if (((_annoes == _annomsk) || (_annomsk == 0)) && (_totale_saldo != 0)) if (((_annoes == _annomsk) || (_annomsk == 0)) && (_totale_saldo != 0.0))
{ {
_sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE); _sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
@ -2123,7 +2108,7 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
else if (_tipostampa == 2) else if (_tipostampa == 2)
{ {
reset_print(); reset_print();
if ((_totale_saldo != 0) && (_puoi_stampare)) if ((_totale_saldo != 0.0) && (_puoi_stampare))
if (_numcarat == 1) if (_numcarat == 1)
stampa_totali132(); stampa_totali132();
else if (_numcarat == 2) else if (_numcarat == 2)
@ -2166,7 +2151,7 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
else if (_tipostampa == 2) else if (_tipostampa == 2)
{ {
reset_print(); reset_print();
if ((_totale_saldo != 0) && (_puoi_stampare)) if ((_totale_saldo != 0.0) && (_puoi_stampare))
if (_numcarat == 1) if (_numcarat == 1)
stampa_totali132_II(); stampa_totali132_II();
else if (_numcarat == 2) else if (_numcarat == 2)
@ -2367,6 +2352,7 @@ bool TMastrini_application::set_print(int)
// Controlla se esistono impostazioni di stampa in coda // Controlla se esistono impostazioni di stampa in coda
if (sheet2mask()) if (sheet2mask())
{ {
// Simula l'immediata pressione del tasto stampa senza nemmeno lanciare la maschera
tasto = K_ENTER; tasto = K_ENTER;
} }
else else
@ -2374,8 +2360,12 @@ bool TMastrini_application::set_print(int)
tasto = _msk->run(); tasto = _msk->run();
if (tasto == K_ENTER) if (tasto == K_ENTER)
{ {
mask2sheet(); // Forza la maschera corrente in coda // Se lo sheet e' vuoto allora usa solo la maschera corrente per la stampa,
sheet2mask(); // Estrae la prima dalla coda // altrimenti estrae il primo elemento sovrascrivendo la maschera corrente.
// Questa figata cerca di correggere gli errori MI6185 e MI3592 in una botta
TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
if (sht.items() != 0)
sheet2mask(); // Estrae la prima riga dalla coda di stampa
} }
} }
@ -2401,21 +2391,28 @@ bool TMastrini_application::set_print(int)
_nummast = _msk->get_int(F_NUMMAST); _nummast = _msk->get_int(F_NUMMAST);
_data_ini = _msk->get_date(F_DATAINI); _data_ini = _msk->get_date(F_DATAINI);
_data_fine = _msk->get_date(F_DATAFINE); _data_fine = _msk->get_date(F_DATAFINE);
if (!_data_ini.ok()) _data_ini = _data_inizioese;
if (!_data_fine.ok()) _data_fine = _data_finese;
int formato = _msk->get_int(F_FORMATO); // Molto scenografico!
ricerca_dati_ditta(); TEsercizi_contabili esc;
if (_annomsk != 0) if (_annomsk != 0)
_anno_corrente = _annomsk; _anno_corrente = _annomsk;
else else
if (_annomsk == 0) {
_anno_ghost = esc.date2esc(_data_ini);
_anno_corrente = _anno_ghost; _anno_corrente = _anno_ghost;
_inizioes = esc[_anno_ghost].inizio();
}
data_fine_esercizio(_anno_corrente); // Ricalcola _data_inizioese e _data_finese
if (!_data_ini.ok()) _data_ini = _data_inizioese;
if (!_data_fine.ok()) _data_fine = _data_finese;
TEsercizi_contabili esc;
_anno_precedente = esc.pred(_anno_corrente); _anno_precedente = esc.pred(_anno_corrente);
ricerca_dati_ditta();
int formato = _msk->get_int(F_FORMATO); // Molto scenografico!
if (_nummast == 1 || _nummast == 3) if (_nummast == 1 || _nummast == 3)
printer().footerlen(4); printer().footerlen(4);
else else
@ -2456,11 +2453,11 @@ bool TMastrini_application::set_print(int)
switch (_tipostampa) switch (_tipostampa)
{ {
case 1: _totale_saldo = 1; case 1: _totale_saldo = 1.0;
break; break;
case 2: _totale_saldo = 0; case 2: _totale_saldo = 0.0;
break; break;
case 3: _totale_saldo = 1; case 3: _totale_saldo = 1.0;
break; break;
default: break; default: break;
} }
@ -2478,8 +2475,8 @@ bool TMastrini_application::set_print(int)
void TMastrini_application::data_fine_esercizio(int anno) void TMastrini_application::data_fine_esercizio(int anno)
{ {
TEsercizi_contabili esc; TEsercizi_contabili esc;
_data_finese = esc[anno].fine();
_data_inizioese = esc[anno].inizio(); _data_inizioese = esc[anno].inizio();
_data_finese = esc[anno].fine();
} }
void TMastrini_application::preprocess_header() void TMastrini_application::preprocess_header()
@ -2491,7 +2488,7 @@ void TMastrini_application::preprocess_header()
else else
if (_tipostampa == 2) if (_tipostampa == 2)
{ {
if ((_totale_saldo != 0) && (_puoi_stampare)) if ((_totale_saldo != 0.0) && (_puoi_stampare))
crea_intestazione(); crea_intestazione();
} }
else if (_tipostampa == 1) else if (_tipostampa == 1)
@ -2506,7 +2503,7 @@ void TMastrini_application::preprocess_header()
else else
if (_tipostampa == 2) if (_tipostampa == 2)
{ {
if ((_totale_saldo != 0) && (_puoi_stampare)) if ((_totale_saldo != 0.0) && (_puoi_stampare))
crea_intestazione(); crea_intestazione();
} }
else if (_tipostampa == 1) else if (_tipostampa == 1)
@ -3117,7 +3114,6 @@ void TMastrini_application::calcola_progressivi_al()
data = _inizioes; data = _inizioes;
} }
else else
if (_annomsk != 0)
{ {
datareg = datacomp; datareg = datacomp;
data = _data_inizioese; data = _data_inizioese;
@ -3131,7 +3127,7 @@ void TMastrini_application::calcola_progressivi_al()
else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale
if (sezione == 'D') if (sezione == 'D')
_totale_prima_dare += importo; _totale_prima_dare += importo;
else if (sezione == 'A') else
_totale_prima_avere += importo; _totale_prima_avere += importo;
} // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty())))
} }
@ -3157,7 +3153,6 @@ void TMastrini_application::calcola_progressivi()
// Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto // Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto
// uguali a quelli di rmov per il calcolo dei progressivi precedenti // uguali a quelli di rmov per il calcolo dei progressivi precedenti
saldi.setkey(2); saldi.setkey(2);
saldi.zero(); saldi.zero();
saldi.put(SLD_GRUPPO, _gruppo); saldi.put(SLD_GRUPPO, _gruppo);
@ -3921,7 +3916,7 @@ bool TMastrini_application::mask2sheet()
{ {
TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE); TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
TString_array& rows = sht.rows_array(); TString_array& rows = sht.rows_array();
ok = rows.find(row) < 0 && rows.items() == 0; // Aggiunge solo se nello sheet non c'e' nulla ok = rows.find(row) < 0; // Aggiunge solo se non c'e' gia'
if (ok) if (ok)
{ {
rows.add(row); rows.add(row);