Corretti vari errori in cg3200 (stampa mastrini) e completato Ap/Ch conti
git-svn-id: svn://10.65.10.50/trunk@177 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
adcc68289d
commit
001e2c8a10
220
cg/cg3200.cpp
220
cg/cg3200.cpp
@ -60,9 +60,10 @@ class CG3200_application : public TPrintapp
|
|||||||
|
|
||||||
bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov;
|
bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov;
|
||||||
|
|
||||||
int _annomsk,_annoesmsk,_annomsksucc,_annoes;
|
long _annomsk,_annoesmsk,_sottoc,_numreg,_annoes;
|
||||||
long _numgio,_protiva,_sottoc,_numreg;
|
long _annomsksucc,_numgio,_protiva;
|
||||||
bool _stampa_progressivi_si,_competenza,_inizio_stampa,_puoi_stampare;
|
bool _stampa_progressivi_si,_competenza,_inizio_stampa,_puoi_stampare;
|
||||||
|
int _tipocf;
|
||||||
char _ricerca;
|
char _ricerca;
|
||||||
|
|
||||||
TDate _dataregrmov;
|
TDate _dataregrmov;
|
||||||
@ -197,7 +198,7 @@ void CG3200_application::saldi_zero()
|
|||||||
while (!rmov->eof())
|
while (!rmov->eof())
|
||||||
{
|
{
|
||||||
rmov->read();
|
rmov->read();
|
||||||
// char sezione = *(_rmov->curr().get(RMV_SEZIONE));
|
// char sezione = *(_rmov->curr().get(RMV_SEZIONE));
|
||||||
TString sezione = rmov->curr().get(RMV_SEZIONE);
|
TString sezione = rmov->curr().get(RMV_SEZIONE);
|
||||||
real importo = rmov->curr().get_real(RMV_IMPORTO);
|
real importo = rmov->curr().get_real(RMV_IMPORTO);
|
||||||
int gruppo = atoi(rmov->get(RMV_GRUPPO));
|
int gruppo = atoi(rmov->get(RMV_GRUPPO));
|
||||||
@ -228,12 +229,7 @@ void CG3200_application::fai_stampa132()
|
|||||||
set_row (1,"@19g#t", &_datadocs);
|
set_row (1,"@19g#t", &_datadocs);
|
||||||
set_row (1,"@30g#7t", &_numdoc);
|
set_row (1,"@30g#7t", &_numdoc);
|
||||||
set_row (1,"@38g#3t", &_codcaus);
|
set_row (1,"@38g#3t", &_codcaus);
|
||||||
set_row (1,"@42g#.18t", &_descrcaus);
|
|
||||||
_descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR);
|
|
||||||
if (_descrizione == "")
|
|
||||||
set_row (1,"@61g%.23s", (const char*) _descrizionemov);
|
|
||||||
else
|
|
||||||
set_row (1,"@61g%.23s", (const char*) _descrizione);
|
|
||||||
_sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
_sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
||||||
if (_sezione == "D")
|
if (_sezione == "D")
|
||||||
set_row (1,"@85g#t", &_importo_str);
|
set_row (1,"@85g#t", &_importo_str);
|
||||||
@ -262,20 +258,14 @@ void CG3200_application::fai_stampa198()
|
|||||||
set_row (1,"@19g#t", &_datadocs);
|
set_row (1,"@19g#t", &_datadocs);
|
||||||
set_row (1,"@30g#7t", &_numdoc);
|
set_row (1,"@30g#7t", &_numdoc);
|
||||||
set_row (1,"@38g#3t", &_codcaus);
|
set_row (1,"@38g#3t", &_codcaus);
|
||||||
set_row (1,"@42g#.25t", &_descrcaus);
|
|
||||||
|
|
||||||
_descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR);
|
|
||||||
if (_descrizione == "")
|
|
||||||
set_row (1,"@68g%.32s", (const char*) _descrizionemov);
|
|
||||||
else
|
|
||||||
set_row (1,"@68g%.32s", (const char*) _descrizione);
|
|
||||||
_sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
_sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
||||||
if (_sezione == "D")
|
if (_sezione == "D")
|
||||||
set_row (1,"@102g#t", &_importo_str);
|
set_row (1,"@102g#t", &_importo_str);
|
||||||
else if (_sezione == "A")
|
else if (_sezione == "A")
|
||||||
set_row (1,"@119g#t", &_importo_str);
|
set_row (1,"@119g#t", &_importo_str);
|
||||||
|
|
||||||
// Stampa saldo movimenti
|
// Stampa saldo movimenti
|
||||||
|
|
||||||
set_row (1,"@153g#t", &_saldo_movimenti_str);
|
set_row (1,"@153g#t", &_saldo_movimenti_str);
|
||||||
|
|
||||||
@ -289,7 +279,7 @@ void CG3200_application::fai_stampa198()
|
|||||||
_dataregrmov = current_cursor()->curr(LF_RMOV).get_date(RMV_DATAREG);
|
_dataregrmov = current_cursor()->curr(LF_RMOV).get_date(RMV_DATAREG);
|
||||||
dataregrmovstring=_dataregrmov.string();
|
dataregrmovstring=_dataregrmov.string();
|
||||||
|
|
||||||
//Gestire la stampa di saldo_progressivi nella postprocess_page di RMOV
|
//Gestire la stampa di saldo_progressivi nella postprocess_page di RMOV
|
||||||
|
|
||||||
rmov = current_cursor()->file(LF_RMOV);
|
rmov = current_cursor()->file(LF_RMOV);
|
||||||
rec = rmov->recno();
|
rec = rmov->recno();
|
||||||
@ -369,7 +359,7 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
|||||||
switch (file)
|
switch (file)
|
||||||
{
|
{
|
||||||
case LF_PCON:
|
case LF_PCON:
|
||||||
// Usati in crea_intestazione()
|
// Usati in crea_intestazione()
|
||||||
_gruppo = atoi(current_cursor()->curr(LF_PCON).get(PCN_GRUPPO));
|
_gruppo = atoi(current_cursor()->curr(LF_PCON).get(PCN_GRUPPO));
|
||||||
_conto = atoi(current_cursor()->curr(LF_PCON).get(PCN_CONTO));
|
_conto = atoi(current_cursor()->curr(LF_PCON).get(PCN_CONTO));
|
||||||
_sottoc = atol(current_cursor()->curr(LF_PCON).get(PCN_SOTTOCONTO));
|
_sottoc = atol(current_cursor()->curr(LF_PCON).get(PCN_SOTTOCONTO));
|
||||||
@ -436,7 +426,9 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
|||||||
_mov->curr().zero();
|
_mov->curr().zero();
|
||||||
_mov->curr().put(MOV_NUMREG,_numreg);
|
_mov->curr().put(MOV_NUMREG,_numreg);
|
||||||
_mov->read();
|
_mov->read();
|
||||||
_annoes = _mov->curr().get_int(MOV_ANNOES);
|
if (_mov->bad())
|
||||||
|
_mov->zero();
|
||||||
|
_annoes = atol(_mov->curr().get(MOV_ANNOES));
|
||||||
_regiva = _mov->curr().get(MOV_REG);
|
_regiva = _mov->curr().get(MOV_REG);
|
||||||
|
|
||||||
// Controlla se saldo e' diverso da 0
|
// Controlla se saldo e' diverso da 0
|
||||||
@ -467,6 +459,53 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
|||||||
descrizione_causale();
|
descrizione_causale();
|
||||||
_descrizionemov = _mov->curr().get(MOV_DESCR);
|
_descrizionemov = _mov->curr().get(MOV_DESCR);
|
||||||
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
|
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
|
||||||
|
|
||||||
|
_descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR);
|
||||||
|
|
||||||
|
if (_numcarat == 1) // Stampa 132 caratteri
|
||||||
|
{
|
||||||
|
if (_descrizione != "")
|
||||||
|
{
|
||||||
|
if (_descrizionemov != "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.18s", (const char*) _descrizionemov);
|
||||||
|
set_row (1,"@61g%.23s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
else if (_descrizionemov == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.18s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@61g%.23s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_descrizione == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.18s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@61g%.23s", (const char*) _descrizionemov);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (_numcarat == 2) // Stampa 198 caratteri
|
||||||
|
{
|
||||||
|
if (_descrizione != "")
|
||||||
|
{
|
||||||
|
if (_descrizionemov != "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.25s", (const char*) _descrizionemov);
|
||||||
|
set_row (1,"@68g%.32s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
else if (_descrizionemov == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.25s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@68g%.32s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_descrizione == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.25s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@68g%.32s", (const char*) _descrizionemov);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_sezione == "D")
|
if (_sezione == "D")
|
||||||
{
|
{
|
||||||
_totale_periodo_dare += _importo;
|
_totale_periodo_dare += _importo;
|
||||||
@ -522,7 +561,7 @@ bool CG3200_application::preprocess_clifo(int file, int counter)
|
|||||||
switch (file)
|
switch (file)
|
||||||
{
|
{
|
||||||
case LF_CLIFO:
|
case LF_CLIFO:
|
||||||
// Usati in crea_intestazione()
|
// Usati in crea_intestazione()
|
||||||
_gruppo = atoi(current_cursor()->curr(LF_CLIFO).get(CLI_GRUPPO));
|
_gruppo = atoi(current_cursor()->curr(LF_CLIFO).get(CLI_GRUPPO));
|
||||||
_conto = atoi(current_cursor()->curr(LF_CLIFO).get(CLI_CONTO));
|
_conto = atoi(current_cursor()->curr(LF_CLIFO).get(CLI_CONTO));
|
||||||
_sottoc = atol(current_cursor()->curr(LF_CLIFO).get(CLI_CODCF));
|
_sottoc = atol(current_cursor()->curr(LF_CLIFO).get(CLI_CODCF));
|
||||||
@ -590,7 +629,9 @@ bool CG3200_application::preprocess_clifo(int file, int counter)
|
|||||||
_mov->curr().zero();
|
_mov->curr().zero();
|
||||||
_mov->curr().put(MOV_NUMREG,_numreg);
|
_mov->curr().put(MOV_NUMREG,_numreg);
|
||||||
_mov->read();
|
_mov->read();
|
||||||
_annoes = _mov->curr().get_int(MOV_ANNOES);
|
if (_mov->bad())
|
||||||
|
_mov->zero();
|
||||||
|
_annoes = atol(_mov->curr().get(MOV_ANNOES));
|
||||||
_regiva = _mov->curr().get(MOV_REG);
|
_regiva = _mov->curr().get(MOV_REG);
|
||||||
|
|
||||||
// Controlla se saldo e' diverso da 0
|
// Controlla se saldo e' diverso da 0
|
||||||
@ -621,6 +662,53 @@ bool CG3200_application::preprocess_clifo(int file, int counter)
|
|||||||
descrizione_causale();
|
descrizione_causale();
|
||||||
_descrizionemov = _mov->curr().get(MOV_DESCR);
|
_descrizionemov = _mov->curr().get(MOV_DESCR);
|
||||||
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
|
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
|
||||||
|
|
||||||
|
_descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR);
|
||||||
|
|
||||||
|
if (_numcarat == 1) // Stampa 132 caratteri
|
||||||
|
{
|
||||||
|
if (_descrizione != "")
|
||||||
|
{
|
||||||
|
if (_descrizionemov != "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.18s", (const char*) _descrizionemov);
|
||||||
|
set_row (1,"@61g%.23s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
else if (_descrizionemov == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.18s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@61g%.23s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_descrizione == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.18s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@61g%.23s", (const char*) _descrizionemov);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (_numcarat == 2) // Stampa 198 caratteri
|
||||||
|
{
|
||||||
|
if (_descrizione != "")
|
||||||
|
{
|
||||||
|
if (_descrizionemov != "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.25s", (const char*) _descrizionemov);
|
||||||
|
set_row (1,"@68g%.32s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
else if (_descrizionemov == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.25s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@68g%.32s", (const char*) _descrizione);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_descrizione == "")
|
||||||
|
{
|
||||||
|
set_row (1,"@42g%.25s", (const char*) _descrcaus);
|
||||||
|
set_row (1,"@68g%.32s", (const char*) _descrizionemov);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_sezione == "D")
|
if (_sezione == "D")
|
||||||
{
|
{
|
||||||
_totale_periodo_dare += _importo;
|
_totale_periodo_dare += _importo;
|
||||||
@ -886,7 +974,7 @@ void CG3200_application::descrizione_causale()
|
|||||||
void CG3200_application::documenti_iva()
|
void CG3200_application::documenti_iva()
|
||||||
{
|
{
|
||||||
TString dep;
|
TString dep;
|
||||||
// _tipodoc = _mov->curr().get(MOV_TIPODOC);
|
// _tipodoc = _mov->curr().get(MOV_TIPODOC);
|
||||||
|
|
||||||
_tabtpd->curr().zero();
|
_tabtpd->curr().zero();
|
||||||
dep << format ("%2s",(const char*) _tipodoc);
|
dep << format ("%2s",(const char*) _tipodoc);
|
||||||
@ -901,7 +989,8 @@ void CG3200_application::ricerca_regiva()
|
|||||||
TString dep;
|
TString dep;
|
||||||
|
|
||||||
_tabreg->curr().zero();
|
_tabreg->curr().zero();
|
||||||
dep << format("%04d%3s", _annoes, (const char*) _regiva);
|
dep << format("%04d", _annoes);
|
||||||
|
dep << format("%3s" , (const char*) _regiva);
|
||||||
_tabreg->curr().put("CODTAB", (const char*) dep);
|
_tabreg->curr().put("CODTAB", (const char*) dep);
|
||||||
_tabreg->read();
|
_tabreg->read();
|
||||||
_tipo = atoi(_tabreg->curr().get("I0"));
|
_tipo = atoi(_tabreg->curr().get("I0"));
|
||||||
@ -927,7 +1016,7 @@ bool CG3200_application::set_print(int)
|
|||||||
_data_ini = (_msk->get(F_DATAINI));
|
_data_ini = (_msk->get(F_DATAINI));
|
||||||
_data_fine = (_msk->get(F_DATAFINE));
|
_data_fine = (_msk->get(F_DATAFINE));
|
||||||
|
|
||||||
_annomsk = _msk->get_int(F_ANNO);
|
_annomsk = atol(_msk->get(F_ANNO));
|
||||||
|
|
||||||
if (_annomsk == 0)
|
if (_annomsk == 0)
|
||||||
if (_data_fine == botime) //Se data_fine e' vuota
|
if (_data_fine == botime) //Se data_fine e' vuota
|
||||||
@ -966,7 +1055,7 @@ bool CG3200_application::set_print(int)
|
|||||||
|
|
||||||
ricerca_dati_ditta();
|
ricerca_dati_ditta();
|
||||||
|
|
||||||
// Scelta del formato e del numero di mastrini per pagina 1 o 2
|
// Scelta del formato e del numero di mastrini per pagina 1 o 2
|
||||||
|
|
||||||
if (nummast == 1)
|
if (nummast == 1)
|
||||||
crt = formato;
|
crt = formato;
|
||||||
@ -975,7 +1064,7 @@ bool CG3200_application::set_print(int)
|
|||||||
|
|
||||||
printer().formlen(crt);
|
printer().formlen(crt);
|
||||||
|
|
||||||
//Crea il cursore su gruppo, conto e sottoconto del file RMOV
|
//Crea il cursore su gruppo, conto e sottoconto del file RMOV
|
||||||
if (_ricerca == 'P')
|
if (_ricerca == 'P')
|
||||||
{
|
{
|
||||||
reset_files(); //resetta l'albero di stampa
|
reset_files(); //resetta l'albero di stampa
|
||||||
@ -1064,7 +1153,7 @@ bool CG3200_application::set_print(int)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,7 +1203,7 @@ void CG3200_application::ricerca_dati_ditta()
|
|||||||
long app;
|
long app;
|
||||||
|
|
||||||
_nditte->setkey(1);
|
_nditte->setkey(1);
|
||||||
// _codice_ditta << get_firm();
|
// _codice_ditta << get_firm();
|
||||||
_nditte->curr().zero();
|
_nditte->curr().zero();
|
||||||
_nditte->curr().put(NDT_CODDITTA,_codice_ditta);
|
_nditte->curr().put(NDT_CODDITTA,_codice_ditta);
|
||||||
_nditte->read();
|
_nditte->read();
|
||||||
@ -1176,12 +1265,23 @@ void CG3200_application::crea_intestazione()
|
|||||||
set_header (3, "@16g%d", _conto);
|
set_header (3, "@16g%d", _conto);
|
||||||
set_header (3, "@20g%d", _sottoc);
|
set_header (3, "@20g%d", _sottoc);
|
||||||
|
|
||||||
const char tipocf = toupper(_msk->get(F_RICERCA)[0]);
|
TString tipocf = (_msk->get(F_RICERCA));
|
||||||
|
if (tipocf == "C")
|
||||||
if (tipocf == 'P')
|
_tipocf = 1;
|
||||||
ricerca_gruppo();
|
else if (tipocf == "F")
|
||||||
else
|
_tipocf = 2;
|
||||||
ricerca_clifo();
|
else if (tipocf == "P")
|
||||||
|
_tipocf = 3;
|
||||||
|
switch (_tipocf)
|
||||||
|
{
|
||||||
|
case 1: ricerca_clifo();
|
||||||
|
break;
|
||||||
|
case 2: ricerca_clifo();
|
||||||
|
break;
|
||||||
|
case 3: ricerca_gruppo();
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
if (_numcarat == 1)
|
if (_numcarat == 1)
|
||||||
{
|
{
|
||||||
@ -1294,8 +1394,8 @@ void CG3200_application::calcola_progressivi()
|
|||||||
paveresca = 0.00;
|
paveresca = 0.00;
|
||||||
pdarescap = 0.00;
|
pdarescap = 0.00;
|
||||||
paverescap = 0.00;
|
paverescap = 0.00;
|
||||||
// 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
|
||||||
|
|
||||||
record.zero();
|
record.zero();
|
||||||
record.put(SLD_GRUPPO, _gruppo);
|
record.put(SLD_GRUPPO, _gruppo);
|
||||||
@ -1333,7 +1433,7 @@ void CG3200_application::calcola_progressivi()
|
|||||||
{
|
{
|
||||||
long annoes_saldi = saldi.curr().get_long(SLD_ANNOES);
|
long annoes_saldi = saldi.curr().get_long(SLD_ANNOES);
|
||||||
|
|
||||||
//Calcola i progressivi dell'esercizio attuale
|
//Calcola i progressivi dell'esercizio attuale
|
||||||
|
|
||||||
if (annoes_saldi == _annomsk)
|
if (annoes_saldi == _annomsk)
|
||||||
{
|
{
|
||||||
@ -1343,7 +1443,7 @@ void CG3200_application::calcola_progressivi()
|
|||||||
salini = saldi.curr().get(SLD_FLAGSALINI)[0];
|
salini = saldi.curr().get(SLD_FLAGSALINI)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calcola i progressivi dell'esercizio precedente
|
//Calcola i progressivi dell'esercizio precedente
|
||||||
|
|
||||||
if (annoes_saldi == _annoesmsk)
|
if (annoes_saldi == _annoesmsk)
|
||||||
{
|
{
|
||||||
@ -1352,11 +1452,11 @@ void CG3200_application::calcola_progressivi()
|
|||||||
paverescap = saldi.curr().get_real(SLD_PAVERESCA);
|
paverescap = saldi.curr().get_real(SLD_PAVERESCA);
|
||||||
paverep = saldi.curr().get_real(SLD_PAVERE);
|
paverep = saldi.curr().get_real(SLD_PAVERE);
|
||||||
|
|
||||||
// Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che
|
// Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che
|
||||||
// quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere
|
// quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere
|
||||||
// i progressivi dell'esercizio precedente devo a questo punto sommare i
|
// i progressivi dell'esercizio precedente devo a questo punto sommare i
|
||||||
// progressivi dell'esercizio e i progressivi di quelli scaricati, tenendo
|
// progressivi dell'esercizio e i progressivi di quelli scaricati, tenendo
|
||||||
// conto del flag salini per sapere se il saldo e' dare oppure avere.
|
// conto del flag salini per sapere se il saldo e' dare oppure avere.
|
||||||
|
|
||||||
if (saldo != 0)
|
if (saldo != 0)
|
||||||
{
|
{
|
||||||
@ -1374,8 +1474,8 @@ void CG3200_application::calcola_progressivi()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
//Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo
|
//Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo
|
||||||
// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil
|
// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil
|
||||||
|
|
||||||
if ((indbil == 1) || (indbil == 2) || (indbil == 5))
|
if ((indbil == 1) || (indbil == 2) || (indbil == 5))
|
||||||
{
|
{
|
||||||
@ -1395,10 +1495,10 @@ void CG3200_application::calcola_progressivi()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov
|
//Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov
|
||||||
//che hanno la data di registrazione inferiore alla data di inizio stampa,
|
//che hanno la data di registrazione inferiore alla data di inizio stampa,
|
||||||
//dei progressivi dell'anno esercizio precedente, e dei progressivi dei
|
//dei progressivi dell'anno esercizio precedente, e dei progressivi dei
|
||||||
//movimenti scaricati dell'esercizio attuale.
|
//movimenti scaricati dell'esercizio attuale.
|
||||||
|
|
||||||
calcola_progressivi_al();
|
calcola_progressivi_al();
|
||||||
|
|
||||||
@ -1424,12 +1524,12 @@ void CG3200_application::calcola_progressivi()
|
|||||||
string = _progreavere.string("###############");
|
string = _progreavere.string("###############");
|
||||||
set_header (10,"@119g%15s",(const char*) string);
|
set_header (10,"@119g%15s",(const char*) string);
|
||||||
}
|
}
|
||||||
//Calcolo dei progressivi al <ultima data registrazione>
|
//Calcolo dei progressivi al <ultima data registrazione>
|
||||||
|
|
||||||
|
|
||||||
//Se sulla maschera e' stato selezionato il controllo competenza esercizio
|
//Se sulla maschera e' stato selezionato il controllo competenza esercizio
|
||||||
//Sommo i progressivi dell'esercizio precedente e quelli dell'esercizio attuale
|
//Sommo i progressivi dell'esercizio precedente e quelli dell'esercizio attuale
|
||||||
//altrimenti solo quelli dell'esercizio attuale
|
//altrimenti solo quelli dell'esercizio attuale
|
||||||
|
|
||||||
if (_competenza)
|
if (_competenza)
|
||||||
{
|
{
|
||||||
@ -1450,6 +1550,7 @@ void CG3200_application::ricerca_clifo()
|
|||||||
TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep;
|
TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep;
|
||||||
TLocalisamfile pconti(LF_PCON);
|
TLocalisamfile pconti(LF_PCON);
|
||||||
TString dataini,datafine;
|
TString dataini,datafine;
|
||||||
|
int numrivd;
|
||||||
|
|
||||||
ragsoc = (current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC));
|
ragsoc = (current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC));
|
||||||
paiv = (current_cursor()->curr(LF_CLIFO).get(CLI_PAIV));
|
paiv = (current_cursor()->curr(LF_CLIFO).get(CLI_PAIV));
|
||||||
@ -1477,13 +1578,16 @@ void CG3200_application::ricerca_clifo()
|
|||||||
pconti.read();
|
pconti.read();
|
||||||
_sezivd = pconti.curr().get(PCN_SEZIVD);
|
_sezivd = pconti.curr().get(PCN_SEZIVD);
|
||||||
_lettivd = pconti.curr().get(PCN_LETTIVD);
|
_lettivd = pconti.curr().get(PCN_LETTIVD);
|
||||||
_numrivd = atoi(pconti.curr().get(PCN_NUMRIVD));
|
numrivd = atoi(pconti.curr().get(PCN_NUMRIVD));
|
||||||
|
_numrivd = itor(numrivd);
|
||||||
_numivd = atoi(pconti.curr().get(PCN_NUMIVD));
|
_numivd = atoi(pconti.curr().get(PCN_NUMIVD));
|
||||||
|
|
||||||
_tabivd->curr().zero();
|
_tabivd->curr().zero();
|
||||||
dep << format ("%1s%1s%8d%2d",(const char*)_sezivd,(const char*)_lettivd,(const char*)_numrivd,_numivd);
|
dep << format ("%1s%1s%-8d%2d",(const char*)_sezivd,(const char*)_lettivd,numrivd,_numivd);
|
||||||
_tabivd->curr().put("CODTAB", (const char*) dep);
|
_tabivd->curr().put("CODTAB", (const char*) dep);
|
||||||
_tabivd->read();
|
_tabivd->read();
|
||||||
|
if (_tabivd->bad())
|
||||||
|
_tabivd->zero();
|
||||||
TString descriz = _tabivd->curr().get("S0");
|
TString descriz = _tabivd->curr().get("S0");
|
||||||
|
|
||||||
if (_ricerca == 'P')
|
if (_ricerca == 'P')
|
||||||
@ -1500,6 +1604,7 @@ void CG3200_application::ricerca_clifo()
|
|||||||
set_header(3, "@91g%-30s",(const char*) ragsoc);
|
set_header(3, "@91g%-30s",(const char*) ragsoc);
|
||||||
set_header(4, "@1gClasse@8g%1s",(const char*) _lettivd);
|
set_header(4, "@1gClasse@8g%1s",(const char*) _lettivd);
|
||||||
set_header(4, "@10g%8s",(const char*) _numrivd);
|
set_header(4, "@10g%8s",(const char*) _numrivd);
|
||||||
|
if (_numivd != 0)
|
||||||
set_header(4, "@19g%2d", _numivd);
|
set_header(4, "@19g%2d", _numivd);
|
||||||
set_header(4,"@23g%-50s",(const char*) descriz);
|
set_header(4,"@23g%-50s",(const char*) descriz);
|
||||||
|
|
||||||
@ -1541,9 +1646,11 @@ void CG3200_application::ricerca_gruppo()
|
|||||||
_numivd = atoi(current_cursor()->curr(LF_PCON).get(PCN_NUMIVD));
|
_numivd = atoi(current_cursor()->curr(LF_PCON).get(PCN_NUMIVD));
|
||||||
|
|
||||||
_tabivd->curr().zero();
|
_tabivd->curr().zero();
|
||||||
dep << format ("%1s%1s%8d%2d",(const char*)_sezivd,(const char*)_lettivd,(const char*)_numrivd,_numivd);
|
dep << format ("%1s%1s%-8d%2d",(const char*)_sezivd,(const char*)_lettivd, numrivd,_numivd);
|
||||||
_tabivd->curr().put("CODTAB", (const char*) dep);
|
_tabivd->curr().put("CODTAB", (const char*) dep);
|
||||||
_tabivd->read();
|
_tabivd->read();
|
||||||
|
if (_tabivd->bad())
|
||||||
|
_tabivd->zero();
|
||||||
descriz = _tabivd->curr().get("S0");
|
descriz = _tabivd->curr().get("S0");
|
||||||
|
|
||||||
if (_ricerca == 'P')
|
if (_ricerca == 'P')
|
||||||
@ -1561,6 +1668,7 @@ void CG3200_application::ricerca_gruppo()
|
|||||||
set_header(3,"@91g%-30s",(const char*) descr);
|
set_header(3,"@91g%-30s",(const char*) descr);
|
||||||
set_header(4, "@0gClasse@12g%1s",(const char*) _lettivd);
|
set_header(4, "@0gClasse@12g%1s",(const char*) _lettivd);
|
||||||
set_header(4, "@14g%8s",(const char*) _numrivd);
|
set_header(4, "@14g%8s",(const char*) _numrivd);
|
||||||
|
if (_numivd != 0)
|
||||||
set_header(4, "@23g%d", _numivd);
|
set_header(4, "@23g%d", _numivd);
|
||||||
set_header(4,"@27g%-50s",(const char*) descriz);
|
set_header(4,"@27g%-50s",(const char*) descriz);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI CONTO
|
OUTPUT F_CONTOINI CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI CODCF
|
OUTPUT F_SOTTOCONTOINI CODCF
|
||||||
OUTPUT F_DESCRINI RAGSOC
|
OUTPUT F_DESCRINI RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI CONTO
|
OUTPUT F_CONTOINI CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI CODCF
|
OUTPUT F_SOTTOCONTOINI CODCF
|
||||||
OUTPUT F_DESCRINI RAGSOC
|
OUTPUT F_DESCRINI RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI CONTO
|
OUTPUT F_CONTOINI CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI CODCF
|
OUTPUT F_SOTTOCONTOINI CODCF
|
||||||
OUTPUT F_DESCRINI RAGSOC
|
OUTPUT F_DESCRINI RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE CONTO
|
OUTPUT F_CONTOFINE CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE CODCF
|
OUTPUT F_SOTTOCONTOFINE CODCF
|
||||||
OUTPUT F_DESCRFINE RAGSOC
|
OUTPUT F_DESCRFINE RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE CONTO
|
OUTPUT F_CONTOFINE CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE CODCF
|
OUTPUT F_SOTTOCONTOFINE CODCF
|
||||||
OUTPUT F_DESCRFINE RAGSOC
|
OUTPUT F_DESCRFINE RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE CONTO
|
OUTPUT F_CONTOFINE CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE CODCF
|
OUTPUT F_SOTTOCONTOFINE CODCF
|
||||||
OUTPUT F_DESCRFINE RAGSOC
|
OUTPUT F_DESCRFINE RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI2 CONTO
|
OUTPUT F_CONTOINI2 CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI2 CODCF
|
OUTPUT F_SOTTOCONTOINI2 CODCF
|
||||||
OUTPUT F_DESCRINI2 RAGSOC
|
OUTPUT F_DESCRINI2 RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
MESSAGE COPY,F_GRUPPOINI
|
MESSAGE COPY,F_GRUPPOINI
|
||||||
END
|
END
|
||||||
@ -214,7 +214,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI2 CONTO
|
OUTPUT F_CONTOINI2 CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI2 CODCF
|
OUTPUT F_SOTTOCONTOINI2 CODCF
|
||||||
OUTPUT F_DESCRINI2 RAGSOC
|
OUTPUT F_DESCRINI2 RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
MESSAGE COPY,F_CONTOINI
|
MESSAGE COPY,F_CONTOINI
|
||||||
END
|
END
|
||||||
@ -236,7 +236,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI2 CONTO
|
OUTPUT F_CONTOINI2 CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI2 CODCF
|
OUTPUT F_SOTTOCONTOINI2 CODCF
|
||||||
OUTPUT F_DESCRINI2 RAGSOC
|
OUTPUT F_DESCRINI2 RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
MESSAGE COPY,F_SOTTOCONTOINI
|
MESSAGE COPY,F_SOTTOCONTOINI
|
||||||
END
|
END
|
||||||
@ -263,7 +263,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE2 CONTO
|
OUTPUT F_CONTOFINE2 CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE2 CODCF
|
OUTPUT F_SOTTOCONTOFINE2 CODCF
|
||||||
OUTPUT F_DESCRFINE2 RAGSOC
|
OUTPUT F_DESCRFINE2 RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
MESSAGE COPY,F_GRUPPOFINE
|
MESSAGE COPY,F_GRUPPOFINE
|
||||||
END
|
END
|
||||||
@ -284,7 +284,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE2 CONTO
|
OUTPUT F_CONTOFINE2 CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE2 CODCF
|
OUTPUT F_SOTTOCONTOFINE2 CODCF
|
||||||
OUTPUT F_DESCRFINE2 RAGSOC
|
OUTPUT F_DESCRFINE2 RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
MESSAGE COPY,F_CONTOFINE
|
MESSAGE COPY,F_CONTOFINE
|
||||||
END
|
END
|
||||||
@ -306,7 +306,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE2 CONTO
|
OUTPUT F_CONTOFINE2 CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE2 CODCF
|
OUTPUT F_SOTTOCONTOFINE2 CODCF
|
||||||
OUTPUT F_DESCRFINE2 RAGSOC
|
OUTPUT F_DESCRFINE2 RAGSOC
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
MESSAGE COPY,F_SOTTOCONTOFINE
|
MESSAGE COPY,F_SOTTOCONTOFINE
|
||||||
END
|
END
|
||||||
@ -332,7 +332,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI3 CONTO
|
OUTPUT F_CONTOINI3 CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI3 SOTTOCONTO
|
OUTPUT F_SOTTOCONTOINI3 SOTTOCONTO
|
||||||
OUTPUT F_DESCRINI3 DESCR
|
OUTPUT F_DESCRINI3 DESCR
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 3
|
GROUP 3
|
||||||
MESSAGE COPY,F_GRUPPOINI
|
MESSAGE COPY,F_GRUPPOINI
|
||||||
END
|
END
|
||||||
@ -352,7 +352,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI3 CONTO
|
OUTPUT F_CONTOINI3 CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI3 SOTTOCONTO
|
OUTPUT F_SOTTOCONTOINI3 SOTTOCONTO
|
||||||
OUTPUT F_DESCRINI3 DESCR
|
OUTPUT F_DESCRINI3 DESCR
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 3
|
GROUP 3
|
||||||
MESSAGE COPY,F_CONTOINI
|
MESSAGE COPY,F_CONTOINI
|
||||||
END
|
END
|
||||||
@ -373,7 +373,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOINI3 CONTO
|
OUTPUT F_CONTOINI3 CONTO
|
||||||
OUTPUT F_SOTTOCONTOINI3 SOTTOCONTO
|
OUTPUT F_SOTTOCONTOINI3 SOTTOCONTO
|
||||||
OUTPUT F_DESCRINI3 DESCR
|
OUTPUT F_DESCRINI3 DESCR
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 3
|
GROUP 3
|
||||||
MESSAGE COPY,F_SOTTOCONTOINI
|
MESSAGE COPY,F_SOTTOCONTOINI
|
||||||
END
|
END
|
||||||
@ -399,7 +399,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE3 CONTO
|
OUTPUT F_CONTOFINE3 CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE3 SOTTOCONTO
|
OUTPUT F_SOTTOCONTOFINE3 SOTTOCONTO
|
||||||
OUTPUT F_DESCRFINE3 DESCR
|
OUTPUT F_DESCRFINE3 DESCR
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 3
|
GROUP 3
|
||||||
MESSAGE COPY,F_GRUPPOFINE
|
MESSAGE COPY,F_GRUPPOFINE
|
||||||
END
|
END
|
||||||
@ -419,7 +419,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE3 CONTO
|
OUTPUT F_CONTOFINE3 CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE3 SOTTOCONTO
|
OUTPUT F_SOTTOCONTOFINE3 SOTTOCONTO
|
||||||
OUTPUT F_DESCRFINE3 DESCR
|
OUTPUT F_DESCRFINE3 DESCR
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 3
|
GROUP 3
|
||||||
MESSAGE COPY,F_CONTOFINE
|
MESSAGE COPY,F_CONTOFINE
|
||||||
END
|
END
|
||||||
@ -440,7 +440,7 @@ BEGIN
|
|||||||
OUTPUT F_CONTOFINE3 CONTO
|
OUTPUT F_CONTOFINE3 CONTO
|
||||||
OUTPUT F_SOTTOCONTOFINE3 SOTTOCONTO
|
OUTPUT F_SOTTOCONTOFINE3 SOTTOCONTO
|
||||||
OUTPUT F_DESCRFINE3 DESCR
|
OUTPUT F_DESCRFINE3 DESCR
|
||||||
FLAGS "RZ"
|
FLAGS "R"
|
||||||
GROUP 3
|
GROUP 3
|
||||||
MESSAGE COPY,F_SOTTOCONTOFINE
|
MESSAGE COPY,F_SOTTOCONTOFINE
|
||||||
END
|
END
|
||||||
|
146
cg/cg4600.cpp
146
cg/cg4600.cpp
@ -47,7 +47,7 @@ class CG4600_application : public TApplication
|
|||||||
int _annoesch, _annoesap;
|
int _annoesch, _annoesap;
|
||||||
long _numreg;
|
long _numreg;
|
||||||
TDate _dataregap, _dataregch;
|
TDate _dataregap, _dataregch;
|
||||||
TString _codcausap, _codcausch, _annoeseprec;
|
TString _codcausap, _codcausch;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
@ -57,9 +57,8 @@ public:
|
|||||||
void ricavi();
|
void ricavi();
|
||||||
void attivita();
|
void attivita();
|
||||||
void passivita();
|
void passivita();
|
||||||
void rmov_proper (int, long, TRectype&, TConto&, real&, bool);
|
void rmov_proper (int, long, TDate&, TRectype&, TConto&, real&, bool);
|
||||||
void ultima_registrazione();
|
void ultima_registrazione();
|
||||||
void anno_ese_precedente();
|
|
||||||
void compila_testata(int,TDate&,TString&);
|
void compila_testata(int,TDate&,TString&);
|
||||||
void chiusura_conto_economico();
|
void chiusura_conto_economico();
|
||||||
void chiusura_conto_patrimoniale();
|
void chiusura_conto_patrimoniale();
|
||||||
@ -69,7 +68,7 @@ public:
|
|||||||
CG4600_application() {}
|
CG4600_application() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
CG4600_application* app() { return (CG4600_application *) MainApp(); }
|
HIDDEN CG4600_application* app() { return (CG4600_application *) MainApp(); }
|
||||||
|
|
||||||
bool mask_datac (TMask_field& f, KEY k)
|
bool mask_datac (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
@ -288,23 +287,6 @@ bool CG4600_application::destroy()
|
|||||||
return TApplication::destroy();
|
return TApplication::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG4600_application::anno_ese_precedente()
|
|
||||||
{
|
|
||||||
TTable tabesc ("ESC");
|
|
||||||
TString16 chiave;
|
|
||||||
int err = NOERR;
|
|
||||||
|
|
||||||
tabesc.zero();
|
|
||||||
chiave << _annoesch;
|
|
||||||
tabesc.put("CODTAB", chiave);
|
|
||||||
err = tabesc.read();
|
|
||||||
if (err == NOERR)
|
|
||||||
{
|
|
||||||
tabesc.prev();
|
|
||||||
_annoeseprec = tabesc.get("CODTAB");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CG4600_application::ultima_registrazione()
|
void CG4600_application::ultima_registrazione()
|
||||||
{
|
{
|
||||||
long numregmov;
|
long numregmov;
|
||||||
@ -411,26 +393,25 @@ bool CG4600_application::set()
|
|||||||
ultima_registrazione();
|
ultima_registrazione();
|
||||||
// anno_ese_precedente();
|
// anno_ese_precedente();
|
||||||
|
|
||||||
// (*_cur) = 0L;
|
(*_cur) = 0L;
|
||||||
|
|
||||||
_sld->set_anno_es(_annoesch);
|
_sld->set_anno_es(_annoesch);
|
||||||
_sld->set_movprovv(FALSE);
|
_sld->set_movprovv(FALSE);
|
||||||
_sld->set_movap(FALSE);
|
_sld->set_movap(FALSE);
|
||||||
|
|
||||||
// costi ();
|
costi ();
|
||||||
|
|
||||||
// _sld->reset(); //Azzera la tabella dei conti dell'oggetto TSaldo_agg
|
_sld->reset(); //Azzera la tabella dei conti dell'oggetto TSaldo_agg
|
||||||
// _pn->destroy_rows(); //Azzero l'oggetto pn.
|
_pn->destroy_rows(); //Azzero l'oggetto pn.
|
||||||
// ultima_registrazione();
|
ultima_registrazione();
|
||||||
// *_cur = 0l;
|
*_cur = 0l;
|
||||||
|
|
||||||
// ricavi();
|
ricavi();
|
||||||
// _sld->reset();
|
_sld->reset();
|
||||||
|
|
||||||
|
chiusura_conto_economico();
|
||||||
// chiusura_conto_economico();
|
|
||||||
_totale_saldo = ZERO;
|
_totale_saldo = ZERO;
|
||||||
// _sld->reset();
|
_sld->reset();
|
||||||
|
|
||||||
_pn->destroy_rows(); //Azzero l'oggetto pn.
|
_pn->destroy_rows(); //Azzero l'oggetto pn.
|
||||||
ultima_registrazione();
|
ultima_registrazione();
|
||||||
@ -461,7 +442,7 @@ void CG4600_application::compila_testata(int annoes,TDate& datareg,
|
|||||||
_pn->lfile()->put(MOV_NUMREG, _numreg);
|
_pn->lfile()->put(MOV_NUMREG, _numreg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG4600_application::rmov_proper(int anno,long numrig,TRectype& rmov, TConto& tc,real& tot_saldo, bool sezione_opposta)
|
void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectype& rmov, TConto& tc,real& tot_saldo, bool sezione_opposta)
|
||||||
{
|
{
|
||||||
char sez_rmov = ' ';
|
char sez_rmov = ' ';
|
||||||
char sezione = ' ';
|
char sezione = ' ';
|
||||||
@ -471,7 +452,7 @@ void CG4600_application::rmov_proper(int anno,long numrig,TRectype& rmov,
|
|||||||
rmov.put(RMV_ANNOES, anno);
|
rmov.put(RMV_ANNOES, anno);
|
||||||
rmov.put(RMV_NUMREG, _numreg);
|
rmov.put(RMV_NUMREG, _numreg);
|
||||||
rmov.put(RMV_NUMRIG, numrig);
|
rmov.put(RMV_NUMRIG, numrig);
|
||||||
rmov.put(RMV_DATAREG, _dataregch);
|
rmov.put(RMV_DATAREG, datareg);
|
||||||
rmov.put(RMV_GRUPPO, tc.gruppo());
|
rmov.put(RMV_GRUPPO, tc.gruppo());
|
||||||
rmov.put(RMV_CONTO, tc.conto());
|
rmov.put(RMV_CONTO, tc.conto());
|
||||||
rmov.put(RMV_SOTTOCONTO, tc.sottoconto());
|
rmov.put(RMV_SOTTOCONTO, tc.sottoconto());
|
||||||
@ -556,7 +537,7 @@ void CG4600_application::costi()
|
|||||||
if (j >= 1)
|
if (j >= 1)
|
||||||
{
|
{
|
||||||
numrig++;
|
numrig++;
|
||||||
rmov_proper(_annoesch,numrig,rmov,_tcproper,tot_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov,_tcproper,tot_saldo,FALSE);
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -565,7 +546,6 @@ void CG4600_application::costi()
|
|||||||
|
|
||||||
numrig++;
|
numrig++;
|
||||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||||
// int annoeseprec = atoi(_annoeseprec);
|
|
||||||
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||||
_saldo = sale.saldo();
|
_saldo = sale.saldo();
|
||||||
|
|
||||||
@ -601,7 +581,7 @@ void CG4600_application::costi()
|
|||||||
// con una sezione opposta al risultato (della somma).
|
// con una sezione opposta al risultato (della somma).
|
||||||
|
|
||||||
// numrig++;
|
// numrig++;
|
||||||
rmov_proper (_annoesch,numrig,rmov,_tcproper,tot_saldo,FALSE);
|
rmov_proper (_annoesch,numrig,_dataregch,rmov,_tcproper,tot_saldo,FALSE);
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -687,7 +667,7 @@ void CG4600_application::ricavi()
|
|||||||
if (j >= 1)
|
if (j >= 1)
|
||||||
{
|
{
|
||||||
numrig++;
|
numrig++;
|
||||||
rmov_proper(_annoesch,numrig,rmov,_tcproper,tot_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov,_tcproper,tot_saldo,FALSE);
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -696,7 +676,6 @@ void CG4600_application::ricavi()
|
|||||||
|
|
||||||
numrig++;
|
numrig++;
|
||||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||||
// int annoeseprec = atoi(_annoeseprec);
|
|
||||||
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||||
_saldo = sale.saldo();
|
_saldo = sale.saldo();
|
||||||
|
|
||||||
@ -732,7 +711,7 @@ void CG4600_application::ricavi()
|
|||||||
// con una sezione opposta al risultato (della somma).
|
// con una sezione opposta al risultato (della somma).
|
||||||
|
|
||||||
// numrig++;
|
// numrig++;
|
||||||
rmov_proper (_annoesch,numrig,rmov,_tcproper,tot_saldo,FALSE);
|
rmov_proper (_annoesch,numrig,_dataregch,rmov,_tcproper,tot_saldo,FALSE);
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -769,27 +748,28 @@ void CG4600_application::ricavi()
|
|||||||
|
|
||||||
void CG4600_application::chiusura_conto_economico()
|
void CG4600_application::chiusura_conto_economico()
|
||||||
{
|
{
|
||||||
if (_totale_saldo.sign() > 0)
|
if (_totale_saldo > ZERO)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
//Compilo la testata per perdite di es. c.economico a Profitti e Perdite
|
//Compilo la testata per perdite di es. c.economico a Profitti e Perdite
|
||||||
//Chiusura conto economico
|
//Chiusura conto economico
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
ultima_registrazione();
|
ultima_registrazione();
|
||||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 3
|
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 3
|
||||||
|
|
||||||
TRectype& rmov1 = _pn->cg(j);
|
TRectype& rmov1 = _pn->cg(j);
|
||||||
long numrig = 1;
|
long numrig = 1;
|
||||||
rmov_proper(_annoesch,numrig,rmov1,_tcproper,_totale_saldo,TRUE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov1,_tcproper,_totale_saldo,TRUE);
|
||||||
numrig++;
|
numrig++;
|
||||||
j++;
|
j++;
|
||||||
TRectype& rmov2 = _pn->cg(j);
|
TRectype& rmov2 = _pn->cg(j);
|
||||||
rmov_proper(_annoesch,numrig,rmov2,_tcperde,_totale_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov2,_tcperde,_totale_saldo,FALSE);
|
||||||
|
|
||||||
_pn->write();
|
_pn->write();
|
||||||
_sld->registra();
|
_sld->registra();
|
||||||
|
_sld->reset();
|
||||||
|
|
||||||
//Compilo la testata per perdite di es. c.patrimon. a Perdita di es. c. econom.
|
//Compilo la testata per perdite di es. c.patrimon. a Perdita di es. c. econom.
|
||||||
//Chiusura capitale netto
|
//Chiusura capitale netto
|
||||||
@ -802,19 +782,40 @@ void CG4600_application::chiusura_conto_economico()
|
|||||||
|
|
||||||
TRectype& rmov3 = _pn->cg(j);
|
TRectype& rmov3 = _pn->cg(j);
|
||||||
numrig = 1;
|
numrig = 1;
|
||||||
rmov_proper(_annoesch,numrig,rmov3,_tcperde,_totale_saldo,TRUE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov3,_tcperde,_totale_saldo,TRUE);
|
||||||
numrig++;
|
numrig++;
|
||||||
j++;
|
j++;
|
||||||
TRectype& rmov4 = _pn->cg(j);
|
TRectype& rmov4 = _pn->cg(j);
|
||||||
rmov_proper(_annoesch,numrig,rmov4,_tcperdp,_totale_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov4,_tcperdp,_totale_saldo,FALSE);
|
||||||
|
|
||||||
_pn->write();
|
_pn->write();
|
||||||
_sld->registra();
|
_sld->registra();
|
||||||
|
_sld->reset();
|
||||||
|
|
||||||
|
//Compilo la testata per Perdita es. c/to patrimoniale a Bilancio di apertura
|
||||||
|
//Apertura capitale netto
|
||||||
|
|
||||||
|
_sld->set_anno_es(_annoesap);
|
||||||
|
_pn->destroy_rows(); //Azzero l'oggetto pn.
|
||||||
|
j = 0;
|
||||||
|
ultima_registrazione();
|
||||||
|
|
||||||
|
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10
|
||||||
|
|
||||||
|
TRectype& rmov5 = _pn->cg(j);
|
||||||
|
numrig = 1;
|
||||||
|
rmov_proper(_annoesap,numrig,_dataregap,rmov5,_tcbilap,_totale_saldo,TRUE);
|
||||||
|
numrig++;
|
||||||
|
j++;
|
||||||
|
TRectype& rmov6 = _pn->cg(j);
|
||||||
|
rmov_proper(_annoesap,numrig,_dataregap,rmov6,_tcperdp,_totale_saldo,FALSE);
|
||||||
|
|
||||||
|
_pn->write();
|
||||||
|
_sld->registra();
|
||||||
|
_sld->set_anno_es(_annoesch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (_totale_saldo.sign() < 0)
|
if (_totale_saldo < ZERO)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
@ -828,14 +829,15 @@ void CG4600_application::chiusura_conto_economico()
|
|||||||
|
|
||||||
TRectype& rmov1 = _pn->cg(j);
|
TRectype& rmov1 = _pn->cg(j);
|
||||||
long numrig = 1;
|
long numrig = 1;
|
||||||
rmov_proper(_annoesch,numrig,rmov1,_tcutile,_totale_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov1,_tcutile,_totale_saldo,FALSE);
|
||||||
numrig++;
|
numrig++;
|
||||||
j++;
|
j++;
|
||||||
TRectype& rmov2 = _pn->cg(j);
|
TRectype& rmov2 = _pn->cg(j);
|
||||||
rmov_proper(_annoesch,numrig,rmov2,_tcproper,_totale_saldo,TRUE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov2,_tcproper,_totale_saldo,TRUE);
|
||||||
|
|
||||||
_pn ->write();
|
_pn ->write();
|
||||||
_sld->registra();
|
_sld->registra();
|
||||||
|
_sld->reset();
|
||||||
|
|
||||||
//Compilo la testata per Utile di es. c.economico a Utile di es. c.patrimoniale
|
//Compilo la testata per Utile di es. c.economico a Utile di es. c.patrimoniale
|
||||||
//Chiusura capitale netto
|
//Chiusura capitale netto
|
||||||
@ -847,14 +849,38 @@ void CG4600_application::chiusura_conto_economico()
|
|||||||
|
|
||||||
TRectype& rmov3 = _pn->cg(j);
|
TRectype& rmov3 = _pn->cg(j);
|
||||||
numrig = 1;
|
numrig = 1;
|
||||||
rmov_proper(_annoesch,numrig,rmov3,_tcutilp,_totale_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov3,_tcutilp,_totale_saldo,FALSE);
|
||||||
numrig++;
|
numrig++;
|
||||||
j++;
|
j++;
|
||||||
TRectype& rmov4 = _pn->cg(j);
|
TRectype& rmov4 = _pn->cg(j);
|
||||||
rmov_proper(_annoesch,numrig,rmov4,_tcutile,_totale_saldo,TRUE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov4,_tcutile,_totale_saldo,TRUE);
|
||||||
|
|
||||||
_pn ->write();
|
_pn ->write();
|
||||||
_sld->registra();
|
_sld->registra();
|
||||||
|
_sld->reset();
|
||||||
|
|
||||||
|
//Compilo la testata per Bilancio di apertura a Utile es. c/to patrimoniale
|
||||||
|
//Apertura capitale netto
|
||||||
|
|
||||||
|
_sld->set_anno_es(_annoesap);
|
||||||
|
_pn->destroy_rows(); //Azzero l'oggetto pn.
|
||||||
|
j = 0;
|
||||||
|
ultima_registrazione();
|
||||||
|
|
||||||
|
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10
|
||||||
|
|
||||||
|
TRectype& rmov5 = _pn->cg(j);
|
||||||
|
numrig = 1;
|
||||||
|
rmov_proper(_annoesap,numrig,_dataregap,rmov5,_tcbilap,_totale_saldo,TRUE);
|
||||||
|
numrig++;
|
||||||
|
j++;
|
||||||
|
TRectype& rmov6 = _pn->cg(j);
|
||||||
|
rmov_proper(_annoesap,numrig,_dataregap,rmov6,_tcutilp,_totale_saldo,FALSE);
|
||||||
|
|
||||||
|
_pn->write();
|
||||||
|
_sld->registra();
|
||||||
|
_sld->set_anno_es(_annoesch);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -876,11 +902,11 @@ void CG4600_application::chiusura_conto_patrimoniale()
|
|||||||
|
|
||||||
TRectype& rmov1 = _pn->cg(j);
|
TRectype& rmov1 = _pn->cg(j);
|
||||||
numrig = 1;
|
numrig = 1;
|
||||||
rmov_proper(_annoesch,numrig,rmov1,_tcutilp,_totale_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov1,_tcutilp,_totale_saldo,FALSE);
|
||||||
numrig++;
|
numrig++;
|
||||||
j++;
|
j++;
|
||||||
TRectype& rmov2 = _pn->cg(j);
|
TRectype& rmov2 = _pn->cg(j);
|
||||||
rmov_proper(_annoesch,numrig,rmov2,_tcbilch,_totale_saldo,TRUE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov2,_tcbilch,_totale_saldo,TRUE);
|
||||||
|
|
||||||
_pn->write();
|
_pn->write();
|
||||||
_sld->registra();
|
_sld->registra();
|
||||||
@ -899,11 +925,11 @@ void CG4600_application::chiusura_conto_patrimoniale()
|
|||||||
|
|
||||||
TRectype& rmov1 = _pn->cg(j);
|
TRectype& rmov1 = _pn->cg(j);
|
||||||
numrig = 1;
|
numrig = 1;
|
||||||
rmov_proper(_annoesch,numrig,rmov1,_tcbilch,_totale_saldo,TRUE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov1,_tcbilch,_totale_saldo,TRUE);
|
||||||
numrig++;
|
numrig++;
|
||||||
j++;
|
j++;
|
||||||
TRectype& rmov2 = _pn->cg(j);
|
TRectype& rmov2 = _pn->cg(j);
|
||||||
rmov_proper(_annoesch,numrig,rmov2,_tcperdp,_totale_saldo,FALSE);
|
rmov_proper(_annoesch,numrig,_dataregch,rmov2,_tcperdp,_totale_saldo,FALSE);
|
||||||
|
|
||||||
_pn ->write();
|
_pn ->write();
|
||||||
_sld->registra();
|
_sld->registra();
|
||||||
@ -962,7 +988,7 @@ void CG4600_application::attivita()
|
|||||||
if (j >= 1)
|
if (j >= 1)
|
||||||
{
|
{
|
||||||
numrig++;
|
numrig++;
|
||||||
rmov_proper(_annoesch,numrig,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
rmov_proper(_annoesch,numrig,_dataregch,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -971,7 +997,6 @@ void CG4600_application::attivita()
|
|||||||
|
|
||||||
numrig++;
|
numrig++;
|
||||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||||
// int annoeseprec = atoi(_annoeseprec);
|
|
||||||
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||||
_saldo = sale.saldo();
|
_saldo = sale.saldo();
|
||||||
|
|
||||||
@ -1007,7 +1032,7 @@ void CG4600_application::attivita()
|
|||||||
// con una sezione opposta al risultato (della somma).
|
// con una sezione opposta al risultato (della somma).
|
||||||
|
|
||||||
// numrig++;
|
// numrig++;
|
||||||
rmov_proper (_annoesch,numrig,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
rmov_proper (_annoesch,numrig,_dataregch,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -1148,7 +1173,7 @@ void CG4600_application::passivita()
|
|||||||
if (j >= 1)
|
if (j >= 1)
|
||||||
{
|
{
|
||||||
numrig++;
|
numrig++;
|
||||||
rmov_proper(_annoesch,numrig,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
rmov_proper(_annoesch,numrig,_dataregch,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
@ -1157,7 +1182,6 @@ void CG4600_application::passivita()
|
|||||||
|
|
||||||
numrig++;
|
numrig++;
|
||||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||||
// int annoeseprec = atoi(_annoeseprec);
|
|
||||||
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||||
_saldo = sale.saldo();
|
_saldo = sale.saldo();
|
||||||
|
|
||||||
@ -1193,7 +1217,7 @@ void CG4600_application::passivita()
|
|||||||
// con una sezione opposta al risultato (della somma).
|
// con una sezione opposta al risultato (della somma).
|
||||||
|
|
||||||
// numrig++;
|
// numrig++;
|
||||||
rmov_proper (_annoesch,numrig,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
rmov_proper (_annoesch,numrig,_dataregch,rmov,_tcbilch,tot_saldo,FALSE); //Chiusura
|
||||||
|
|
||||||
tot_saldo = ZERO;
|
tot_saldo = ZERO;
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,4 @@
|
|||||||
#define F_ANNO 128
|
#define F_ANNO 128
|
||||||
#define F_ANNOCH 129
|
#define F_ANNOCH 129
|
||||||
|
|
||||||
|
|
||||||
#endif // __CG4600_H
|
#endif // __CG4600_H
|
||||||
|
@ -15,11 +15,6 @@ BEGIN
|
|||||||
OUTPUT F_RAGSOC RAGSOC
|
OUTPUT F_RAGSOC RAGSOC
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ANNO 4
|
|
||||||
BEGIN
|
|
||||||
PROMPT 42 1 "Anno esercizio "
|
|
||||||
FLAGS "D"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_RAGSOC 50
|
STRING F_RAGSOC 50
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -49,16 +44,29 @@ END
|
|||||||
|
|
||||||
DATE F_DATAC
|
DATE F_DATAC
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 4 "Data chiusura "
|
PROMPT 36 4 "Data/Anno chiusura "
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE F_DATAAP
|
DATE F_DATAAP
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 5 "Data apertura "
|
PROMPT 36 5 "Data/Anno apertura "
|
||||||
WARNING "Inserire una data non inferiore alla data di chiusura"
|
WARNING "Inserire una data non inferiore alla data di chiusura"
|
||||||
VALIDATE DATE_CMP_FUNC >= F_DATAC
|
VALIDATE DATE_CMP_FUNC >= F_DATAC
|
||||||
END
|
END
|
||||||
|
|
||||||
|
NUMBER F_ANNOCH 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 69 4 ""
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_ANNO 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 69 5 ""
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 60 10
|
GROUPBOX DLG_NULL 60 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 7 "Codici sottoconto"
|
PROMPT 2 7 "Codici sottoconto"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user