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