invio e ricezione apertura e chiusura conti liquidazione acconti 30-11-95
git-svn-id: svn://10.65.10.50/trunk@2218 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0f5a6567f0
commit
10d774c3ae
653
cg/cg1500.cpp
653
cg/cg1500.cpp
@ -100,7 +100,8 @@ class CG1500_application : public TPrintapp
|
||||
bool _cambiato_conto_1, _cambiato_conto_2, _add_file_avere;
|
||||
bool _add_file_dare, _prima_volta, _seconda_volta, _totali, _codici, _saldo;
|
||||
bool _add_dare, _add_avere, _controlla, _salto_pagina, _flag, _stampato;
|
||||
bool _sottoc_dare, _sottoc_avere, _salto_pagina1, _livello_conto;
|
||||
bool _sottoc_dare, _sottoc_avere, _salto_pagina1, _livello_conto;
|
||||
bool _mov_ap;
|
||||
int _stampa_mov_prov;
|
||||
//TString _causale_ap, _causale_chi;
|
||||
TArray _clienti, _fornitori;
|
||||
@ -1224,11 +1225,21 @@ bool CG1500_application::bil_verifica()
|
||||
if (_verifica == 2)
|
||||
if (!((_stampav == 2) && (saldo_conto == 0)))
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app < ZERO)
|
||||
_saldo_ini_gruppo_avere += app;
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_saldo_ini_gruppo_dare += _saldo_ini_conto_dare;
|
||||
_saldo_ini_gruppo_avere += _saldo_ini_conto_avere;
|
||||
}
|
||||
else
|
||||
_saldo_ini_gruppo_dare += app;
|
||||
//fine
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app < ZERO)
|
||||
_saldo_ini_gruppo_avere += app;
|
||||
else
|
||||
_saldo_ini_gruppo_dare += app;
|
||||
}
|
||||
mov_gruppo_dare += mov_conto_dare;
|
||||
mov_gruppo_avere += mov_conto_avere;
|
||||
prg_gruppo_dare += prg_conto_dare;
|
||||
@ -1302,11 +1313,21 @@ bool CG1500_application::bil_verifica()
|
||||
{
|
||||
if (_verifica == 2)
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app < ZERO)
|
||||
_saldo_ini_gruppo_avere += app;
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_saldo_ini_gruppo_dare += _saldo_ini_conto_dare;
|
||||
_saldo_ini_gruppo_avere += _saldo_ini_conto_avere;
|
||||
}
|
||||
else
|
||||
_saldo_ini_gruppo_dare += app;
|
||||
//fine
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app < ZERO)
|
||||
_saldo_ini_gruppo_avere += app;
|
||||
else
|
||||
_saldo_ini_gruppo_dare += app;
|
||||
}
|
||||
mov_gruppo_dare += mov_conto_dare;
|
||||
mov_gruppo_avere += mov_conto_avere;
|
||||
prg_gruppo_dare += prg_conto_dare;
|
||||
@ -1331,36 +1352,55 @@ bool CG1500_application::bil_verifica()
|
||||
continue;
|
||||
}
|
||||
|
||||
saldo_finale = ZERO; //saldo finale relativo a ciascun sottoconto
|
||||
saldo_finale = saldo_iniziale = ZERO; //saldi relativi a ciascun sottoconto
|
||||
_indbil = indbil_conto;
|
||||
if (_tipo_stampa1 == 1) //bil. di verifica per data limite
|
||||
{
|
||||
//modifica del 21/11/95
|
||||
_mov_ap = FALSE;
|
||||
//modifica del 19/06/95
|
||||
movimentato = calcola(g,c,s);
|
||||
if (_stampa_mov_prov != 3)
|
||||
{
|
||||
if (movimentato)
|
||||
{
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
TLocalisamfile saldi(LF_SALDI);
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
saldi.put(SLD_SOTTOCONTO,s);
|
||||
if (saldi.read() == NOERR)
|
||||
//modifica del 21/11/95
|
||||
if (_mov_ap)
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
else //discorso flag "movimentato" (video)
|
||||
{
|
||||
TLocalisamfile saldi(LF_SALDI);
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
saldi.put(SLD_SOTTOCONTO,s);
|
||||
if (saldi.read() == NOERR)
|
||||
{
|
||||
real ss = saldi.get_real(SLD_SALDO);
|
||||
if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)
|
||||
if (ss == ZERO && _annoes != 0)
|
||||
{
|
||||
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s);
|
||||
}
|
||||
//modifica del 21/11/95
|
||||
if (saldo_iniziale > ZERO)
|
||||
_saldo_ini_dare = saldo_iniziale;
|
||||
else _saldo_ini_avere = -saldo_iniziale;
|
||||
//fine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!movimentato)
|
||||
if (!movimentato) //_mov_ap e' di sicuro FALSE
|
||||
if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)
|
||||
if (_annoes != 0)
|
||||
{
|
||||
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
|
||||
//modifica del 21/11/95
|
||||
if (saldo_iniziale > ZERO)
|
||||
_saldo_ini_dare = saldo_iniziale;
|
||||
else _saldo_ini_avere = -saldo_iniziale;
|
||||
//fine
|
||||
if (_stampav == 1 && sld.significativo())
|
||||
movimentato = TRUE;
|
||||
}
|
||||
@ -1376,6 +1416,8 @@ bool CG1500_application::bil_verifica()
|
||||
|
||||
_nuovo_tot_saldo_d += _mov_periodo_dare;
|
||||
_nuovo_tot_saldo_a += _mov_periodo_avere;
|
||||
//modifica del 21/11/1995
|
||||
/*
|
||||
if (saldo_iniziale > ZERO)
|
||||
_nuovo_tot_saldo_d += saldo_iniziale;
|
||||
else
|
||||
@ -1383,6 +1425,10 @@ bool CG1500_application::bil_verifica()
|
||||
real app = -saldo_iniziale;
|
||||
_nuovo_tot_saldo_a += app;
|
||||
}
|
||||
*/
|
||||
_nuovo_tot_saldo_d += _saldo_ini_dare;
|
||||
_nuovo_tot_saldo_a += _saldo_ini_avere;
|
||||
//fine
|
||||
|
||||
if (_datada == _dataini)
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
@ -1429,7 +1475,7 @@ else
|
||||
_prg_prec_dare = ZERO;
|
||||
_prg_prec_avere = ZERO;
|
||||
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1450,13 +1496,28 @@ if (movimentato || _stampav != 1)
|
||||
{
|
||||
nuovo = -nuovo;
|
||||
_nuovo_tot_saldo_a += nuovo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//modifica del 21/11/1995
|
||||
/*
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
*/
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_saldo_ini_conto_dare += _saldo_ini_dare;
|
||||
_saldo_ini_conto_avere += _saldo_ini_avere;
|
||||
}
|
||||
else //_tipo_stampa1 == 1 || _tipo_stampa1 == 2
|
||||
{
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
}
|
||||
|
||||
mov_conto_dare += _mov_periodo_dare;
|
||||
mov_conto_avere += _mov_periodo_avere;
|
||||
prg_conto_dare += _prg_prec_dare;
|
||||
@ -1471,8 +1532,17 @@ if (movimentato || _stampav != 1)
|
||||
_tmp_saldi_att->put(SLD_CONTO,c);
|
||||
_tmp_saldi_att->put(SLD_SOTTOCONTO,s);
|
||||
_tmp_saldi_att->put(SLD_FLAGSALINI,tipo_conto);
|
||||
|
||||
if ( (_datada == _dataini) || (_tipo_stampa1 != 1) )
|
||||
{
|
||||
//modifica del 21/11/1995
|
||||
if (_datada == _dataini && _tipo_stampa1 == 1)
|
||||
{
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,_saldo_ini_dare);
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,_saldo_ini_avere);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (saldo_iniziale > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,saldo_iniziale);
|
||||
else if (saldo_iniziale < ZERO)
|
||||
@ -1480,6 +1550,7 @@ if (movimentato || _stampav != 1)
|
||||
saldo_iniziale = -saldo_iniziale;
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,saldo_iniziale);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
@ -1502,11 +1573,21 @@ if (_pcn->eof())
|
||||
{
|
||||
if ( (_verifica == 2) && esiste_conto )
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app < ZERO)
|
||||
_saldo_ini_gruppo_avere += app;
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_saldo_ini_gruppo_dare += _saldo_ini_conto_dare;
|
||||
_saldo_ini_gruppo_avere += _saldo_ini_conto_avere;
|
||||
}
|
||||
else
|
||||
_saldo_ini_gruppo_dare += app;
|
||||
//fine
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app < ZERO)
|
||||
_saldo_ini_gruppo_avere += app;
|
||||
else
|
||||
_saldo_ini_gruppo_dare += app;
|
||||
}
|
||||
mov_gruppo_dare += mov_conto_dare;
|
||||
mov_gruppo_avere += mov_conto_avere;
|
||||
prg_gruppo_dare += prg_conto_dare;
|
||||
@ -1607,20 +1688,6 @@ bool CG1500_application::calcola(int g, int c, long s)
|
||||
if (importo == 0)
|
||||
continue;
|
||||
|
||||
//calcolo i movimenti del periodo
|
||||
/*
|
||||
if ( data_reg >= _datada && data_reg <= _dataa)
|
||||
if ((codcaus == causale_apertura() && _dataini != _datada) ||
|
||||
(codcaus != causale_apertura()))
|
||||
{
|
||||
conto_mov = TRUE;
|
||||
if (sezione == 'D')
|
||||
_mov_periodo_dare += importo;
|
||||
else _mov_periodo_avere += importo;
|
||||
_u_max = fnc_max(_u_max, data);
|
||||
}
|
||||
*/
|
||||
// Modifica del 03-03-95
|
||||
//calcolo i movimenti del periodo
|
||||
if ( data_reg >= _datada && data_reg <= _dataa)
|
||||
if ((cau.apertura() && _dataini != _datada) ||
|
||||
@ -1643,7 +1710,7 @@ bool CG1500_application::calcola(int g, int c, long s)
|
||||
_saldo_ini_dare += importo;
|
||||
else _saldo_ini_avere += importo;
|
||||
_u_max = fnc_max(_u_max, data);
|
||||
conto_mov = TRUE;
|
||||
conto_mov = _mov_ap = TRUE;
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini) //calcolo i progressivi precedenti
|
||||
@ -1681,7 +1748,7 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
|
||||
s = r->get_long(SLD_SOTTOCONTO);
|
||||
|
||||
saldo_finale = ZERO; //saldo finale relativo a ciascun sottoconto
|
||||
saldo_finale = saldo_iniziale = ZERO; //saldi relativi a ciascun sottoconto
|
||||
|
||||
if (_tipo_stampa1 == 1) //bil. di verifica per data limite
|
||||
{
|
||||
@ -1689,8 +1756,9 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
if ( !calcola(g,c,s) ) //il conto non e' movimentato
|
||||
if (_stampav == 1 || _stampav == 3) //per i C/F anche se seleziono -tutti i conti, voglio solo quelli movimentati
|
||||
continue;
|
||||
*/
|
||||
|
||||
*/
|
||||
//modifica del 21/11/1995
|
||||
_mov_ap = FALSE;
|
||||
//modifica del 19/06. Vedi appunti per capire
|
||||
bool movimentato = calcola(g,c,s);
|
||||
|
||||
@ -1698,7 +1766,11 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
{
|
||||
if (movimentato)
|
||||
{
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
//modifica del 21/11/1995
|
||||
if (_mov_ap)
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
else
|
||||
{
|
||||
TLocalisamfile saldi(LF_SALDI);
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
@ -1712,14 +1784,27 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
real ss = saldi.get_real(SLD_SALDO);
|
||||
if (ib == 1 || ib == 2 || ib == 5)
|
||||
if (ss == ZERO && _annoes != 0) //competenza!!!
|
||||
{
|
||||
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s);
|
||||
}
|
||||
//modifica del 21/11/1995
|
||||
if (saldo_iniziale > ZERO)
|
||||
_saldo_ini_dare = saldo_iniziale;
|
||||
else _saldo_ini_avere = saldo_iniziale;
|
||||
//fine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!movimentato)
|
||||
if (ib == 1 || ib == 2 || ib == 5)
|
||||
if (_annoes != 0) //cioe' se sto ragionando per competenza
|
||||
{
|
||||
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
|
||||
//modifica del 21/11/1995
|
||||
if (saldo_iniziale > ZERO)
|
||||
_saldo_ini_dare = saldo_iniziale;
|
||||
else _saldo_ini_avere = -saldo_iniziale;
|
||||
//fine
|
||||
movimentato = sld.significativo();
|
||||
}
|
||||
}
|
||||
@ -1730,14 +1815,20 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
|
||||
_nuovo_tot_saldo_d += _mov_periodo_dare;
|
||||
_nuovo_tot_saldo_a += _mov_periodo_avere;
|
||||
//modifica del 21/11/1995
|
||||
/*
|
||||
if (saldo_iniziale > ZERO)
|
||||
_nuovo_tot_saldo_d += saldo_iniziale;
|
||||
else
|
||||
{
|
||||
real app = -saldo_iniziale;
|
||||
_nuovo_tot_saldo_a += app;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
_nuovo_tot_saldo_d += _saldo_ini_dare;
|
||||
_nuovo_tot_saldo_a += _saldo_ini_avere;
|
||||
//fine
|
||||
|
||||
if (_datada == _dataini)
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
else if (_datada > _dataini)
|
||||
@ -1809,10 +1900,21 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
|
||||
esiste_sc = TRUE;
|
||||
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_saldo_ini_conto_dare += _saldo_ini_dare;
|
||||
_saldo_ini_conto_avere += _saldo_ini_avere;
|
||||
}
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
//fine
|
||||
{
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
}
|
||||
|
||||
mov_conto_dare += _mov_periodo_dare;
|
||||
mov_conto_avere += _mov_periodo_avere;
|
||||
prg_conto_dare += _prg_prec_dare;
|
||||
@ -1829,12 +1931,21 @@ bool CG1500_application::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_
|
||||
_tmp_saldi_att->put(SLD_FLAGSALINI,tipocf);
|
||||
if ( (_datada == _dataini) || (_tipo_stampa1 != 1) )
|
||||
{
|
||||
if (saldo_iniziale > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,saldo_iniziale);
|
||||
else if (saldo_iniziale < ZERO)
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,_saldo_ini_dare);
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,_saldo_ini_avere);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (saldo_iniziale > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,saldo_iniziale);
|
||||
else if (saldo_iniziale < ZERO)
|
||||
{
|
||||
saldo_iniziale = -saldo_iniziale;
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,saldo_iniziale);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
@ -1862,14 +1973,23 @@ void CG1500_application::scrivi_record_gruppo(const real& prg_da,
|
||||
_tmp_saldi_att->put(SLD_SOTTOCONTO,0L);
|
||||
if ( (_datada == _dataini) || (_tipo_stampa1 != 1) )
|
||||
{
|
||||
real app = _saldo_ini_gruppo_dare + _saldo_ini_gruppo_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,app);
|
||||
else if (app < ZERO)
|
||||
{
|
||||
//modifica del 21/11/1995
|
||||
if (_datada == _dataini && _tipo_stampa1 == 1)
|
||||
{
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,_saldo_ini_gruppo_dare);
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,_saldo_ini_gruppo_avere);
|
||||
}
|
||||
else
|
||||
{
|
||||
real app = _saldo_ini_gruppo_dare + _saldo_ini_gruppo_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,app);
|
||||
else if (app < ZERO)
|
||||
{
|
||||
app = -app;
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,app);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
@ -1891,14 +2011,23 @@ void CG1500_application::scrivi_record_conto(const real& prg_da,
|
||||
_tmp_saldi_att->put(SLD_SOTTOCONTO,0L);
|
||||
if ( (_datada == _dataini) || (_tipo_stampa1 != 1) )
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,app);
|
||||
else if (app < ZERO)
|
||||
{
|
||||
//modifica del 21/11/1995
|
||||
if (_datada == _dataini && _tipo_stampa1 == 1)
|
||||
{
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,_saldo_ini_conto_dare);
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,_saldo_ini_conto_avere);
|
||||
}
|
||||
else
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
_tmp_saldi_att->put(SLD_PDARESCA,app);
|
||||
else if (app < ZERO)
|
||||
{
|
||||
app = -app;
|
||||
_tmp_saldi_att->put(SLD_PAVERESCA,app);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
@ -1947,18 +2076,28 @@ void CG1500_application::riempi_record(char t,int g,int c,long s,
|
||||
{
|
||||
if ( (_datada == _dataini)||(_tipo_stampa1 != 1) )
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_cf->saldodare = _saldo_ini_conto_dare;
|
||||
_cf->saldoavere = _saldo_ini_conto_avere;
|
||||
}
|
||||
else
|
||||
//fine
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
{
|
||||
_cf->saldoavere = ZERO;
|
||||
_cf->saldodare = app;
|
||||
}
|
||||
else if (app < ZERO)
|
||||
{
|
||||
}
|
||||
else if (app < ZERO)
|
||||
{
|
||||
app = -app;
|
||||
_cf->saldodare = ZERO;
|
||||
_cf->saldoavere = app;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
@ -1978,249 +2117,6 @@ void CG1500_application::riempi_record(char t,int g,int c,long s,
|
||||
_sort->sort((const char*)_cf);
|
||||
}
|
||||
|
||||
/*
|
||||
void CG1500_application::crea_sort_clifo()
|
||||
{
|
||||
TSaldo sld;
|
||||
TLocalisamfile saldi(LF_SALDI, FALSE);
|
||||
int g=0, c=0;
|
||||
long codcf=0l;
|
||||
TString80 ragsoc;
|
||||
char tipocf,tipocfp,tipoa;
|
||||
real saldo_finale, saldo_conto, saldo_iniziale, saldodare, saldoavere,
|
||||
movdare, movavere;
|
||||
real mov_conto_dare, mov_conto_avere, prg_conto_dare, prg_conto_avere;
|
||||
bool esiste_sc = FALSE, movimentato = FALSE;
|
||||
TArray gccf;
|
||||
TRecnotype items = _cur->items();
|
||||
|
||||
_gp=-1;
|
||||
_cp=-1;
|
||||
tipocfp = ' ';
|
||||
|
||||
_saldo_ini_conto_dare = ZERO;
|
||||
_saldo_ini_conto_avere = ZERO;
|
||||
saldo_conto = ZERO;
|
||||
mov_conto_dare = ZERO;
|
||||
mov_conto_avere = ZERO;
|
||||
prg_conto_dare = ZERO;
|
||||
prg_conto_avere = ZERO;
|
||||
_u_max = 0l;
|
||||
|
||||
init_sort();
|
||||
|
||||
int anno;
|
||||
|
||||
if (_tipo_stampa1 == 1)
|
||||
anno = _annoapp;
|
||||
else anno = _annoes;
|
||||
|
||||
*_cur = 0l;
|
||||
|
||||
for (int i = 0; i < items; i++,++(*_cur))
|
||||
{
|
||||
_prog->addstatus(1);
|
||||
codcf = _cur->curr().get_long(CLI_CODCF);
|
||||
tipocf = _cur->curr().get(CLI_TIPOCF)[0];
|
||||
ragsoc = _cur->curr().get(CLI_RAGSOC);
|
||||
tipoa = _cur->curr().get_char(CLI_TIPOAPER);
|
||||
if (tipoa == 'F') //persona fisica
|
||||
{
|
||||
TString80 cognome, nome;
|
||||
cognome = ragsoc.mid(0,30);
|
||||
nome = ragsoc.mid(30,20);
|
||||
cognome.trim(); nome.trim();
|
||||
ragsoc = cognome;
|
||||
ragsoc << " " << nome;
|
||||
}
|
||||
|
||||
if (tipocf == 'C')
|
||||
gccf = _clienti;
|
||||
else
|
||||
if (tipocf == 'F')
|
||||
gccf = _fornitori;
|
||||
|
||||
for (int i=0; i < gccf.items(); i++)
|
||||
{
|
||||
int g = ((TToken_string&)gccf[i]).get_int(0);
|
||||
int c = ((TToken_string&)gccf[i]).get_int(1);
|
||||
|
||||
int aprec = EsePre(anno);
|
||||
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES, anno);
|
||||
saldi.put(SLD_GRUPPO, g);
|
||||
saldi.put(SLD_CONTO, c);
|
||||
saldi.put(SLD_SOTTOCONTO, codcf);
|
||||
|
||||
if (saldi.read() != NOERR)
|
||||
if (_tipo_stampa1 == 1) //bilancio per data limite
|
||||
continue;
|
||||
else if (_stampac == 2) //se sono richiesti i conti movimentati
|
||||
{ //esco, se no...
|
||||
_indbil = cerca_indbil(g,c);
|
||||
if (_indbil == 1 || _indbil == 2 || _indbil == 5)
|
||||
{
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES, aprec);
|
||||
saldi.put(SLD_GRUPPO, g);
|
||||
saldi.put(SLD_CONTO, c);
|
||||
saldi.put(SLD_SOTTOCONTO, codcf);
|
||||
if (saldi.read() != NOERR)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (((_cp != -1) && (c != _cp)) || ((_gp != -1) && (g != _gp))) &&
|
||||
esiste_sc )
|
||||
{
|
||||
//scrivo il record del conto;
|
||||
riempi_record(tipocfp,_gp,_cp,999999L,"zzzz",prg_conto_dare,
|
||||
prg_conto_avere,mov_conto_dare,mov_conto_avere,saldo_conto);
|
||||
tipocfp = tipocf;
|
||||
_cp = c;
|
||||
esiste_sc = FALSE;
|
||||
_saldo_ini_conto_dare = ZERO;
|
||||
_saldo_ini_conto_avere = ZERO;
|
||||
saldo_conto = ZERO;
|
||||
mov_conto_dare = ZERO;
|
||||
mov_conto_avere = ZERO;
|
||||
prg_conto_dare = ZERO;
|
||||
prg_conto_avere = ZERO;
|
||||
}
|
||||
|
||||
saldo_finale = ZERO;
|
||||
saldodare = ZERO;
|
||||
saldoavere = ZERO;
|
||||
movdare = ZERO;
|
||||
movavere = ZERO;
|
||||
|
||||
if (_tipo_stampa1 == 1) //bilancio di verifica per data limite
|
||||
{
|
||||
//modifica del 19/06/95
|
||||
_indbil = cerca_indbil(g,c);
|
||||
movimentato = calcola(g,c,codcf);
|
||||
if (_stampa_mov_prov != 3)
|
||||
if (!movimentato && _stampac!=1)
|
||||
if (_indbil == 1 || _indbil == 2 || _indbil == 5)
|
||||
if (_annoes != 0) //cioe' se sto ragionando per competenza
|
||||
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,codcf);
|
||||
|
||||
if (movimentato)
|
||||
{
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
TLocalisamfile saldi(LF_SALDI);
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
saldi.put(SLD_SOTTOCONTO,codcf);
|
||||
if (saldi.read() == NOERR)
|
||||
{
|
||||
real s = saldi.get_real(SLD_SALDO);
|
||||
if (_stampa_mov_prov != 3)
|
||||
if (_indbil == 1 || _indbil == 2 || _indbil == 5)
|
||||
if (s == ZERO && _annoes != 0) //competenza!!!
|
||||
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,codcf);
|
||||
}
|
||||
}
|
||||
//fine modifica
|
||||
//movimentato = calcola(g,c,codcf);
|
||||
if (movimentato || _stampac != 1)
|
||||
{
|
||||
if (_datada == _dataini)
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
//modifica del 19/06
|
||||
if (saldo_iniziale > 0)
|
||||
_prg_prec_dare += saldo_iniziale;
|
||||
else _prg_prec_avere -= saldo_iniziale;
|
||||
//fine modifica
|
||||
saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare
|
||||
-_mov_periodo_avere;
|
||||
}
|
||||
}
|
||||
//if (saldo_finale == ZERO)
|
||||
// if (_stampac == 2)
|
||||
// continue;
|
||||
|
||||
//se saldo_finale < 0 verra' stampato con una A, se no con una D
|
||||
}
|
||||
else //bilancio di verifica all'ultima immissione
|
||||
{
|
||||
_indbil = cerca_indbil(g,c);
|
||||
movimentato = sld.ultima_immissione_verifica(anno,g,c,codcf,_indbil,_stampa_mov_prov);
|
||||
|
||||
if (_stampa_mov_prov != 3)
|
||||
if (!movimentato && _stampac!=1)
|
||||
if (_indbil == 1 || _indbil == 2 || _indbil == 5)
|
||||
saldo_iniziale = sld.saldofin_esprec(anno,g,c,codcf);
|
||||
|
||||
if (movimentato)
|
||||
saldo_iniziale = sld.saldoini();
|
||||
|
||||
if (movimentato || _stampac != 1)
|
||||
{
|
||||
_mov_periodo_dare = sld.prgdare();
|
||||
_mov_periodo_avere = sld.prgavere();
|
||||
_prg_prec_dare = ZERO;
|
||||
_prg_prec_avere = ZERO;
|
||||
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
}
|
||||
//if (saldo_finale == ZERO)
|
||||
// if (_stampac == 2)
|
||||
// continue;
|
||||
}
|
||||
if (movimentato || _stampac != 1)
|
||||
if (!(saldo_finale == ZERO && _stampac == 2))
|
||||
{
|
||||
esiste_sc = TRUE;
|
||||
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
mov_conto_dare += _mov_periodo_dare;
|
||||
mov_conto_avere += _mov_periodo_avere;
|
||||
prg_conto_dare += _prg_prec_dare;
|
||||
prg_conto_avere += _prg_prec_avere;
|
||||
saldo_conto += saldo_finale; // somma algebrica!!!
|
||||
|
||||
if ( (_datada == _dataini)||(_tipo_stampa1 != 1) )
|
||||
{
|
||||
if (saldo_iniziale > ZERO) //va stampato in Dare
|
||||
saldodare = saldo_iniziale;
|
||||
else if (saldo_iniziale < ZERO)
|
||||
{
|
||||
saldo_iniziale = -saldo_iniziale;
|
||||
saldoavere = saldo_iniziale;
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
saldodare = _prg_prec_dare;
|
||||
saldoavere = _prg_prec_avere;
|
||||
}
|
||||
|
||||
movdare = _mov_periodo_dare;
|
||||
movavere = _mov_periodo_avere;
|
||||
|
||||
riempi_record(tipocf,g,c,codcf,ragsoc,saldodare,saldoavere,movdare,
|
||||
movavere,saldo_finale);
|
||||
tipocfp = tipocf;
|
||||
_gp = g;
|
||||
_cp = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (esiste_sc)
|
||||
riempi_record(tipocfp,_gp,_cp,999999L,"zzzz",prg_conto_dare,prg_conto_avere,
|
||||
mov_conto_dare,mov_conto_avere,saldo_conto);
|
||||
}
|
||||
*/
|
||||
|
||||
void CG1500_application::leggi_clifo(const TArray& gccf)
|
||||
{
|
||||
TSaldo sld;
|
||||
@ -2321,10 +2217,14 @@ void CG1500_application::leggi_clifo(const TArray& gccf)
|
||||
saldodare = ZERO;
|
||||
saldoavere = ZERO;
|
||||
movdare = ZERO;
|
||||
movavere = ZERO;
|
||||
movavere = ZERO;
|
||||
saldo_iniziale = ZERO;
|
||||
|
||||
if (_tipo_stampa1 == 1) //bilancio di verifica per data limite
|
||||
{
|
||||
//modifica del 21/11/1995
|
||||
_mov_ap = FALSE;
|
||||
|
||||
//modifica del 19/06/95
|
||||
_indbil = cerca_indbil(g,c);
|
||||
movimentato = calcola(g,c,codcf);
|
||||
@ -2336,23 +2236,35 @@ void CG1500_application::leggi_clifo(const TArray& gccf)
|
||||
|
||||
if (movimentato)
|
||||
{
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
TLocalisamfile saldi(LF_SALDI);
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
saldi.put(SLD_SOTTOCONTO,codcf);
|
||||
if (saldi.read() == NOERR)
|
||||
//modifica del 21/11/1995
|
||||
if (_mov_ap)
|
||||
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
|
||||
else
|
||||
{
|
||||
TLocalisamfile saldi(LF_SALDI);
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
saldi.put(SLD_SOTTOCONTO,codcf);
|
||||
if (saldi.read() == NOERR)
|
||||
{
|
||||
real s = saldi.get_real(SLD_SALDO);
|
||||
if (_stampa_mov_prov != 3)
|
||||
if (_indbil == 1 || _indbil == 2 || _indbil == 5)
|
||||
if (s == ZERO && _annoes != 0) //competenza!!!
|
||||
{
|
||||
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,codcf);
|
||||
//modifica del 21/11/1995
|
||||
if (saldo_iniziale > ZERO)
|
||||
_saldo_ini_dare = saldo_iniziale;
|
||||
else _saldo_ini_avere = -saldo_iniziale;
|
||||
//fine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//fine modifica
|
||||
//fine modifica del 19/06/95
|
||||
//movimentato = calcola(g,c,codcf);
|
||||
if (movimentato || _stampac != 1)
|
||||
{
|
||||
@ -2406,10 +2318,21 @@ void CG1500_application::leggi_clifo(const TArray& gccf)
|
||||
{
|
||||
esiste_sc = TRUE;
|
||||
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_saldo_ini_conto_dare += _saldo_ini_dare;
|
||||
_saldo_ini_conto_avere += _saldo_ini_avere;
|
||||
}
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
{
|
||||
if (saldo_iniziale < ZERO)
|
||||
_saldo_ini_conto_avere += saldo_iniziale;
|
||||
else
|
||||
_saldo_ini_conto_dare += saldo_iniziale;
|
||||
}
|
||||
//fine
|
||||
|
||||
mov_conto_dare += _mov_periodo_dare;
|
||||
mov_conto_avere += _mov_periodo_avere;
|
||||
prg_conto_dare += _prg_prec_dare;
|
||||
@ -2418,12 +2341,22 @@ void CG1500_application::leggi_clifo(const TArray& gccf)
|
||||
|
||||
if ( (_datada == _dataini)||(_tipo_stampa1 != 1) )
|
||||
{
|
||||
if (saldo_iniziale > ZERO) //va stampato in Dare
|
||||
saldodare = saldo_iniziale;
|
||||
else if (saldo_iniziale < ZERO)
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
saldodare = _saldo_ini_dare;
|
||||
saldoavere = _saldo_ini_avere;
|
||||
}
|
||||
else
|
||||
//
|
||||
{
|
||||
if (saldo_iniziale > ZERO) //va stampato in Dare
|
||||
saldodare = saldo_iniziale;
|
||||
else if (saldo_iniziale < ZERO)
|
||||
{
|
||||
saldo_iniziale = -saldo_iniziale;
|
||||
saldoavere = saldo_iniziale;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
@ -3143,7 +3076,9 @@ void CG1500_application::stampa_riga_totali(int r)
|
||||
app = 'A';
|
||||
}
|
||||
|
||||
if (_datada == _dataini) //colonna saldo iniziale
|
||||
//modifica del 21/11/1995
|
||||
//if (_datada == _dataini) //colonna saldo iniziale
|
||||
if (_tipo_stampa1 == 2)
|
||||
{
|
||||
real r = _saldo_dare_tot - _saldo_avere_tot;
|
||||
if (r > ZERO)
|
||||
@ -3156,10 +3091,6 @@ void CG1500_application::stampa_riga_totali(int r)
|
||||
_saldo_avere_tot = -r;
|
||||
_saldo_dare_tot = ZERO;
|
||||
}
|
||||
/*
|
||||
if (_tipo_stampa1 == 1)
|
||||
_nuovo_tot_saldo_a = -_nuovo_tot_saldo_a;
|
||||
*/
|
||||
}
|
||||
if (_stampa_width == 148)
|
||||
{
|
||||
@ -3241,9 +3172,20 @@ void CG1500_application::stampa_riga_totali(int r)
|
||||
{
|
||||
if (!_nuovo_tot_saldo_d.is_zero()) ntsd = _nuovo_tot_saldo_d.string("#############");
|
||||
if (!_nuovo_tot_saldo_a.is_zero()) ntsa = _nuovo_tot_saldo_a.string("#############");
|
||||
set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@85g%s@101g%s@114g!",(const char*)ntsd,(const char*)ntsa);
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 2)
|
||||
set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@85g%s@101g%s@114g!",(const char*)ntsd,(const char*)ntsa);
|
||||
else set_row(r,"@1g****** ********@18gTOTALE CON MOVIM. DI APERTURA@49g!@82g!@85g%s@101g%s@114g!",(const char*)ntsd,(const char*)ntsa);
|
||||
//fine
|
||||
}
|
||||
else set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@83g%r@99g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
else
|
||||
{
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 2)
|
||||
set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@83g%r@99g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
else set_row(r,"@1g****** ********@18gTOTALE CON MOVIM. DI APERTURA@49g!@82g!@83g%r@99g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
//fine
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3277,9 +3219,16 @@ void CG1500_application::stampa_riga_totali(int r)
|
||||
{
|
||||
if (!_nuovo_tot_saldo_d.is_zero()) ntsd = _nuovo_tot_saldo_d.string("#############");
|
||||
if (!_nuovo_tot_saldo_a.is_zero()) ntsa = _nuovo_tot_saldo_a.string("#############");
|
||||
set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@85g%s@102g%s@115g!@148g!",(const char*)ntsd,(const char*)ntsa);
|
||||
if (_tipo_stampa1 == 2)
|
||||
set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@85g%s@102g%s@115g!@148g!",(const char*)ntsd,(const char*)ntsa);
|
||||
else set_row(r,"@1g****** ********@18gTOTALE CON MOVIM. DI APERTURA@49g!@82g!@85g%s@102g%s@115g!@148g!",(const char*)ntsd,(const char*)ntsa);
|
||||
}
|
||||
else set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@83g%r@100g%r@115g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
else
|
||||
{
|
||||
if (_tipo_stampa1 == 2)
|
||||
set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@83g%r@100g%r@115g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
else set_row(r,"@1g****** ********@18gTOTALE CON MOVIM. DI APERTURA@49g!@82g!@83g%r@100g%r@115g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3825,7 +3774,7 @@ bool CG1500_application::set_print(int)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TRectype& look_com (const char * cod, TLocalisamfile *comuni)
|
||||
TRectype& look_com (const char* cod, TLocalisamfile *comuni)
|
||||
{
|
||||
comuni->zero();
|
||||
comuni->put(COM_COM, cod);
|
||||
@ -4000,14 +3949,30 @@ void CG1500_application::preprocess_header()
|
||||
riga.fill('-');
|
||||
set_header(r, (const char*)riga);
|
||||
r++;
|
||||
|
||||
if ( ((_datada == _dataini)&&(_tipo_stampa1 == 1))||(_tipo_stampa1 != 1) )
|
||||
{
|
||||
//modifica del 21/11/1995
|
||||
/*
|
||||
if ( (_verifica == 1)||(_verifica == 3) )
|
||||
set_header(r,"@7g!@16g!@49g!@58gSALDO INIZIALE@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
else
|
||||
set_header(r,"@7g!@49g!@58gSALDO INIZIALE@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
}
|
||||
*/
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
if ( (_verifica == 1)||(_verifica == 3) )
|
||||
set_header(r,"@7g!@16g!@49g!@55gMOVIMENTI DI APERTURA@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
else
|
||||
set_header(r,"@7g!@49g!@55gMOVIMENTI DI APERTURA@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (_verifica == 1)||(_verifica == 3) )
|
||||
set_header(r,"@7g!@16g!@49g!@58gSALDO INIZIALE@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
else
|
||||
set_header(r,"@7g!@49g!@58gSALDO INIZIALE@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
}
|
||||
}
|
||||
else if (_tipo_stampa1 == 1)
|
||||
if ( (_verifica == 1)||(_verifica == 3) )
|
||||
set_header(r,"@7g!@16g!@49g!@55gPROGRESSIVI PRECEDENTI@82g!@88gMOVIMENTI DEL PERIODO");
|
||||
|
143
cg/cg1600.cpp
143
cg/cg1600.cpp
@ -1526,10 +1526,11 @@ void CG1600_application::crea_sort_piano_conti_verifica()
|
||||
mov_avere = _mov_periodo_avere;
|
||||
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
||||
|
||||
//modifica del 05/04/1995
|
||||
real app = sld_prg_dare - sld_prg_avere;
|
||||
//modifica del 27/11/1995
|
||||
//real app = sld_prg_dare - sld_prg_avere;
|
||||
_nuovo_tot_saldo_d += mov_dare;
|
||||
_nuovo_tot_saldo_a += mov_avere;
|
||||
/*
|
||||
if (app > ZERO)
|
||||
_nuovo_tot_saldo_d += app;
|
||||
else
|
||||
@ -1537,6 +1538,9 @@ void CG1600_application::crea_sort_piano_conti_verifica()
|
||||
app = -app;
|
||||
_nuovo_tot_saldo_a += app;
|
||||
}
|
||||
*/
|
||||
_nuovo_tot_saldo_d += sld_prg_dare;
|
||||
_nuovo_tot_saldo_a += sld_prg_avere;
|
||||
//fine modifica
|
||||
}
|
||||
else if (_dataini > _data_ini_ese)
|
||||
@ -1689,17 +1693,21 @@ void CG1600_application::sottoc_clifo_verifica(int g,int c,int anno,char tipocf,
|
||||
mov_avere = _mov_periodo_avere;
|
||||
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
||||
|
||||
//modifica 05/04/1994
|
||||
real app = sld_prg_dare - sld_prg_avere;
|
||||
//modifica 27/11/1995
|
||||
//real app = sld_prg_dare - sld_prg_avere;
|
||||
_nuovo_tot_saldo_d += mov_dare;
|
||||
_nuovo_tot_saldo_a += mov_avere;
|
||||
/*
|
||||
if (app > ZERO)
|
||||
_nuovo_tot_saldo_d += app;
|
||||
else
|
||||
{
|
||||
app = -app;
|
||||
_nuovo_tot_saldo_a += app;
|
||||
}
|
||||
}
|
||||
*/
|
||||
_nuovo_tot_saldo_d += sld_prg_dare;
|
||||
_nuovo_tot_saldo_a += sld_prg_avere;
|
||||
//fine modifica
|
||||
}
|
||||
else if (_dataini > _data_ini_ese)
|
||||
@ -3987,9 +3995,18 @@ bool CG1600_application::preprocess_stampa_verifica(int counter)
|
||||
{
|
||||
TString ntsd (_nuovo_tot_saldo_d.string("#############"));
|
||||
TString ntsa (_nuovo_tot_saldo_a.string("#############"));
|
||||
set_row(_i,"@0g****** ******** TOTALE CON SALDI INIZIALI@48g!@81g!@84g%s@100g%s@114g!",(const char*)ntsd,(const char*)ntsa);
|
||||
if (_tipo_stampa == 1 && _dataini == _data_ini_ese)
|
||||
set_row(_i,"****** ******** TOTALE CON MOVIM. DI APERTURA@48g!@81g!@84g%s@100g%s@114g!",(const char*)ntsd,(const char*)ntsa);
|
||||
else
|
||||
set_row(_i,"****** ******** TOTALE CON SALDI INIZIALI@48g!@81g!@84g%s@100g%s@114g!",(const char*)ntsd,(const char*)ntsa);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_tipo_stampa == 1 && _dataini == _data_ini_ese)
|
||||
set_row(_i,"****** ******** TOTALE CON MOVIM. DI APERTURA@48g!@81g!@82g%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
else
|
||||
set_row(_i,"****** ******** TOTALE CON SALDI INIZIALI@48g!@81g!@82g%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
}
|
||||
else set_row(_i,"@0g****** ******** TOTALE CON SALDI INIZIALI@48g!@81g!@82g%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
|
||||
}
|
||||
//fine modifica
|
||||
|
||||
@ -4133,41 +4150,54 @@ bool CG1600_application::preprocess_stampa_verifica(int counter)
|
||||
|
||||
if (_dataini == _data_ini_ese)
|
||||
{
|
||||
real saldo_num = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_num > ZERO)
|
||||
_tot_num_prg_d += saldo_num;
|
||||
else
|
||||
//modifica del 27/11/1995
|
||||
if (_tipo_stampa == 2)
|
||||
{
|
||||
real saldo_num = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_num > ZERO)
|
||||
_tot_num_prg_d += saldo_num;
|
||||
else
|
||||
{
|
||||
saldo_num = -saldo_num;
|
||||
_tot_num_prg_a += saldo_num;
|
||||
}
|
||||
|
||||
real saldo_numr = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_numr > ZERO)
|
||||
_tot_numr_prg_d += saldo_numr;
|
||||
else
|
||||
{
|
||||
}
|
||||
real saldo_numr = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_numr > ZERO)
|
||||
_tot_numr_prg_d += saldo_numr;
|
||||
else
|
||||
{
|
||||
saldo_numr = -saldo_numr;
|
||||
_tot_numr_prg_a += saldo_numr;
|
||||
}
|
||||
|
||||
real saldo_let = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_let > ZERO)
|
||||
_tot_let_prg_d += saldo_let;
|
||||
else
|
||||
{
|
||||
}
|
||||
real saldo_let = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_let > ZERO)
|
||||
_tot_let_prg_d += saldo_let;
|
||||
else
|
||||
{
|
||||
saldo_let = -saldo_let;
|
||||
_tot_let_prg_a += saldo_let;
|
||||
}
|
||||
|
||||
real saldo_gen = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_gen > ZERO)
|
||||
_tot_gen_prg_d += saldo_gen;
|
||||
else
|
||||
{
|
||||
}
|
||||
real saldo_gen = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldo_gen > ZERO)
|
||||
_tot_gen_prg_d += saldo_gen;
|
||||
else
|
||||
{
|
||||
saldo_gen = -saldo_gen;
|
||||
_tot_gen_prg_a += saldo_gen;
|
||||
}
|
||||
}
|
||||
else if (_tipo_stampa == 1)
|
||||
{
|
||||
_tot_num_prg_d += _sld_prg_dare;
|
||||
_tot_num_prg_a += _sld_prg_avere;
|
||||
_tot_numr_prg_d += _sld_prg_dare;
|
||||
_tot_numr_prg_a += _sld_prg_avere;
|
||||
_tot_let_prg_d += _sld_prg_dare;
|
||||
_tot_let_prg_a += _sld_prg_avere;
|
||||
_tot_gen_prg_d += _sld_prg_dare;
|
||||
_tot_gen_prg_a += _sld_prg_avere;
|
||||
}
|
||||
//fine
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4684,16 +4714,25 @@ void CG1600_application::setta_righe_verifica()
|
||||
|
||||
if (_dataini == _data_ini_ese)
|
||||
{
|
||||
real saldoini = _sld_prg_dare - _sld_prg_avere;
|
||||
|
||||
if (saldoini >= ZERO)
|
||||
set_row(_i,"@49g%r", &saldoini);
|
||||
else
|
||||
{
|
||||
//modifica del 27/11/1995
|
||||
if (_tipo_stampa == 2) //all'ultima immissione
|
||||
{
|
||||
real saldoini = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldoini >= ZERO)
|
||||
set_row(_i,"@49g%r", &saldoini);
|
||||
else
|
||||
{
|
||||
saldoini = -saldoini;
|
||||
set_row(_i,"@65g%r", &saldoini);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_tipo_stampa == 1) //per date limiti
|
||||
{
|
||||
set_row(_i,"@49g%r", &_sld_prg_dare);
|
||||
set_row(_i,"@65g%r", &_sld_prg_avere);
|
||||
}
|
||||
//fine
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row (_i,"@49g%r", &_sld_prg_dare);
|
||||
@ -4741,19 +4780,28 @@ void CG1600_application::setta_righe_verifica()
|
||||
{
|
||||
//set_row (_i,"@2g%s", (const char*) descr_sottoc);
|
||||
set_row (_i,"@2g#a", _d);
|
||||
|
||||
|
||||
if (_dataini == _data_ini_ese)
|
||||
{
|
||||
real saldoini = _sld_prg_dare - _sld_prg_avere;
|
||||
|
||||
if (saldoini >= ZERO)
|
||||
set_row(_i,"@49g%r", &saldoini);
|
||||
else
|
||||
//modifica del 27/11/1995
|
||||
if (_tipo_stampa == 2)
|
||||
{
|
||||
real saldoini = _sld_prg_dare - _sld_prg_avere;
|
||||
if (saldoini >= ZERO)
|
||||
set_row(_i,"@49g%r", &saldoini);
|
||||
else
|
||||
{
|
||||
saldoini = -saldoini;
|
||||
set_row(_i,"@65g%r", &saldoini);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_tipo_stampa == 1)
|
||||
{
|
||||
set_row(_i,"@49g%r", &_sld_prg_dare);
|
||||
set_row(_i,"@65g%r", &_sld_prg_avere);
|
||||
}
|
||||
//fine
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row (_i,"@49g%r", &_sld_prg_dare);
|
||||
@ -5036,7 +5084,8 @@ void CG1600_application::intesta_verifica_fissa()
|
||||
if (_tipo_stampa == 1)
|
||||
{
|
||||
if (_dataini == _data_ini_ese)
|
||||
set_header(5,"@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO");
|
||||
//set_header(5,"@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO");
|
||||
set_header(5,"@54gMOVIMENTI DI APERTURA@87gMOVIMENTI DEL PERIODO");
|
||||
else if (_dataini > _data_ini_ese)
|
||||
set_header(5,"@54gPROGRESSIVI PRECEDENTI@87gMOVIMENTI DEL PERIODO");
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ bool TLiquidazione_app::set_print(int)
|
||||
break;
|
||||
case 2: // estrazione deleghe
|
||||
_isprint = FALSE;
|
||||
build_ditte_sheet(all);
|
||||
//build_ditte_sheet(all);
|
||||
while (set_deleghe())
|
||||
{
|
||||
if (_calcall || _selected.ones() > 0l)
|
||||
@ -399,7 +399,7 @@ bool TLiquidazione_app::set_print(int)
|
||||
case 3: // calcolo acconto
|
||||
_isprint = TRUE;
|
||||
_month = 12;
|
||||
build_ditte_sheet(all);
|
||||
//build_ditte_sheet(all);
|
||||
real inf; real ina; // cotale obbrobrio non fu da me cercato, ne' mai condiviso
|
||||
while (set_acconto(inf, ina))
|
||||
{
|
||||
@ -598,9 +598,12 @@ bool TLiquidazione_app::what_freq_handler(TMask_field& f, KEY key)
|
||||
void TLiquidazione_app::reset_choices(TMask& m)
|
||||
{
|
||||
_selected.reset();
|
||||
m.reset(CG43_FLD_SELECTED);
|
||||
m.reset(CG43_FLD_DFR);
|
||||
m.reset(CG43_FLD_DTO);
|
||||
if (m.source_file() == "cg4300a.msk")
|
||||
{
|
||||
m.reset(CG43_FLD_SELECTED);
|
||||
m.reset(CG43_FLD_DFR);
|
||||
m.reset(CG43_FLD_DTO);
|
||||
}
|
||||
_ditte->check(-1, FALSE);
|
||||
}
|
||||
|
||||
@ -727,12 +730,14 @@ int cg4300(int argc, char* argv[])
|
||||
switch (mode)
|
||||
{
|
||||
case 'A':
|
||||
title = "Calcolo acconti";
|
||||
menu = 3;
|
||||
break;
|
||||
case 'C':
|
||||
title = "Ricalcolo progressivi IVA";
|
||||
break;
|
||||
case 'D':
|
||||
case 'D':
|
||||
title = "Estrazione versamenti";
|
||||
menu = 2;
|
||||
break;
|
||||
case 'S':
|
||||
|
@ -4,15 +4,15 @@ PAGE "Estrazione deleghe" -1 -1 45 10
|
||||
|
||||
NUMBER FLD_CGB_YEAR 4
|
||||
BEGIN
|
||||
PROMPT 2 1 "Anno estrazione "
|
||||
HELP "Anno d'esercizio da cui effettuare le estrazioni"
|
||||
FLAGS "A"
|
||||
PROMPT 2 1 "Anno estrazione "
|
||||
HELP "Anno per cui si desidera effettuare le estrazioni"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
LIST FLD_CGB_MONTH 10
|
||||
BEGIN
|
||||
PROMPT 2 2 "Mese estrazione "
|
||||
HELP "Mese da cui effettuare le estrazioni"
|
||||
HELP "Mese per cui si desidera effettuare le estrazioni"
|
||||
FLAGS "AM"
|
||||
//ITEM "13|Annuale"
|
||||
END
|
||||
@ -30,14 +30,14 @@ END
|
||||
BUTTON DLG_SELECT 10 2
|
||||
BEGIN
|
||||
PROMPT -12 5 "Scegli"
|
||||
HELP "Selezionare le ditte di cui estrarre le deleghe"
|
||||
HELP "Selezionare le ditte di cui estrarre le deleghe"
|
||||
MESSAGE EXIT,DLG_SELECT
|
||||
END
|
||||
|
||||
BUTTON BUT_CGB_ALL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 5 "Tutte"
|
||||
HELP "Selezionare tutte le ditte di cui estrarre le deleghe"
|
||||
HELP "Selezionare tutte le ditte di cui estrarre le deleghe"
|
||||
MESSAGE EXIT,BUT_CGB_ALL
|
||||
END
|
||||
|
||||
|
@ -30,8 +30,8 @@ END
|
||||
NUMBER FLD_CGC_YEAR 4
|
||||
BEGIN
|
||||
PROMPT 3 5 "Anno da elaborare "
|
||||
HELP "Anno di cui si vuole il calcolo acconto"
|
||||
FLAGS "A"
|
||||
HELP "Anno di cui si desidera il calcolo acconto"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 52 4
|
||||
|
@ -21,8 +21,9 @@ bool TLiquidazione_app::set_deleghe()
|
||||
{
|
||||
TMask m("cg4300b.msk");
|
||||
|
||||
m.field(FLD_CGB_YEAR).set(_year);
|
||||
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
||||
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
||||
|
||||
m.field(FLD_CGB_YEAR).set(_year);
|
||||
m.field(CHK_CGB_PRINT).set(_isprint ? "X" : "");
|
||||
|
||||
int k = 0;
|
||||
@ -300,8 +301,11 @@ bool TLiquidazione_app::video_conferma(const real& newimp, const real& intr,
|
||||
bool TLiquidazione_app::set_acconto(real& inf, real& ina)
|
||||
{
|
||||
TMask m("cg4300c.msk");
|
||||
|
||||
m.set(CHK_CGC_PRINT,"X");
|
||||
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
|
||||
m.field(FLD_CGC_YEAR).set(_year);
|
||||
|
||||
int k = 0; long j;
|
||||
|
||||
_calcall = FALSE;
|
||||
|
@ -48,7 +48,7 @@ class CG4600_application : public TApplication
|
||||
real _saldo, _totale_saldo, _capitale_netto;
|
||||
int _annoesch, _annoesap;
|
||||
long _numreg;
|
||||
TDate _dataregap, _dataregch;
|
||||
TDate _dataregap, _dataregch, _datacompch, _datacompap;
|
||||
TString _codcausap, _codcausch;
|
||||
|
||||
public:
|
||||
@ -67,12 +67,13 @@ public:
|
||||
void apri_conti_ordine();
|
||||
void rmov_proper (int, long, TDate&, TRectype&, TConto&, real&, bool);
|
||||
void ultima_registrazione();
|
||||
void compila_testata(int,TDate&,TString&);
|
||||
void compila_testata(int anno,TDate& datareg,TString& codcaus,TDate& datacomp);
|
||||
void chiusura_conto_economico();
|
||||
void chiusura_conto_patrimoniale();
|
||||
void apertura_capitale_netto();
|
||||
bool set();
|
||||
// bool epilogo_conti();
|
||||
// bool epilogo_conti();
|
||||
void data_competenza(int anno,TDate& datacomp);
|
||||
|
||||
CG4600_application() {}
|
||||
};
|
||||
@ -481,6 +482,16 @@ void CG4600_application::ultima_registrazione()
|
||||
//sicuramente non esistente.
|
||||
}
|
||||
|
||||
void CG4600_application::data_competenza(int anno, TDate& datacomp)
|
||||
{
|
||||
TString16 dep (format("%04d", anno));
|
||||
|
||||
_esc->zero();
|
||||
_esc->put("CODTAB", dep);
|
||||
if (_esc->read() == NOERR)
|
||||
datacomp = _esc->get_date("D1");
|
||||
}
|
||||
|
||||
bool CG4600_application::set()
|
||||
{
|
||||
TTable TabEs ("ESC");
|
||||
@ -547,7 +558,9 @@ bool CG4600_application::set()
|
||||
_dataregch = m.get (F_DATAC);
|
||||
_codcausch = m.get (F_CHIUSURA);
|
||||
_dataregap = m.get (F_DATAAP);
|
||||
_codcausap = m.get (F_APERTURA);
|
||||
_codcausap = m.get (F_APERTURA);
|
||||
data_competenza(_annoesch,_datacompch); // Modifica del 28-11-95 per la data
|
||||
// data_competenza(_annoesap,_datacompap); // di competenza
|
||||
gbilch = m.get_int (F_BILCHG);
|
||||
cbilch = m.get_int (F_BILCHC);
|
||||
sbilch = m.get_long(F_BILCHS);
|
||||
@ -631,6 +644,7 @@ bool CG4600_application::set()
|
||||
|
||||
_sld->set_anno_es(_annoesap);
|
||||
_sld->set_movap(TRUE);
|
||||
_sld->set_movimentato(TRUE);
|
||||
// _pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
|
||||
*_cur = 0l;
|
||||
|
||||
@ -659,14 +673,14 @@ bool CG4600_application::set()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CG4600_application::compila_testata(int annoes,TDate& datareg,TString& codcaus)
|
||||
void CG4600_application::compila_testata(int annoes,TDate& datareg,TString& codcaus,TDate& datacomp)
|
||||
{
|
||||
_pn->lfile().zero();
|
||||
_pn->lfile().put(MOV_ANNOES, annoes); //Viene generato un movimento
|
||||
_pn->lfile().put(MOV_DATAREG, datareg); //a rottura di conto
|
||||
_pn->lfile().put(MOV_CODCAUS, codcaus);
|
||||
_pn->lfile().put(MOV_NUMREG, _numreg);
|
||||
_pn->lfile().put(MOV_DATACOMP, datareg);
|
||||
_pn->lfile().put(MOV_DATACOMP, datacomp);
|
||||
}
|
||||
|
||||
void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectype& rmov,
|
||||
@ -776,7 +790,7 @@ void CG4600_application::costi()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 1 Chiusura Costi
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 1 Chiusura Costi
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -805,7 +819,7 @@ void CG4600_application::costi()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 1 Chiusura Costi
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 1 Chiusura Costi
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -928,7 +942,7 @@ void CG4600_application::ricavi()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 2 Chiusura Ricavi
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 2 Chiusura Ricavi
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -957,7 +971,7 @@ void CG4600_application::ricavi()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 2 Chiusura Ricavi
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 2 Chiusura Ricavi
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -1031,7 +1045,7 @@ void CG4600_application::chiusura_conto_economico()
|
||||
|
||||
j = 0;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 3 Chiusura Conto Economico
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 3 Chiusura Conto Economico
|
||||
|
||||
TRectype& rmov1 = _pn->cg(j);
|
||||
long numrig = 1;
|
||||
@ -1052,7 +1066,7 @@ void CG4600_application::chiusura_conto_economico()
|
||||
j = 0;
|
||||
ultima_registrazione();
|
||||
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 4 Chiusura Capitale netto
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 4 Chiusura Capitale netto
|
||||
|
||||
TRectype& rmov3 = _pn->cg(j);
|
||||
numrig = 1;
|
||||
@ -1075,7 +1089,7 @@ void CG4600_application::chiusura_conto_economico()
|
||||
|
||||
j = 0;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 3 Chiusura Conto Economico
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 3 Chiusura Conto Economico
|
||||
|
||||
TRectype& rmov1 = _pn->cg(j);
|
||||
long numrig = 1;
|
||||
@ -1095,7 +1109,7 @@ void CG4600_application::chiusura_conto_economico()
|
||||
|
||||
j = 0;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 4 Chiusura Capitale netto
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 4 Chiusura Capitale netto
|
||||
|
||||
TRectype& rmov3 = _pn->cg(j);
|
||||
numrig = 1;
|
||||
@ -1171,7 +1185,7 @@ void CG4600_application::chiudi_attivita()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 5 Chiusura Attivita'
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 5 Chiusura Attivita'
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -1204,7 +1218,7 @@ void CG4600_application::chiudi_attivita()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 5 Chiusura Attivita'
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 5 Chiusura Attivita'
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -1327,7 +1341,7 @@ void CG4600_application::chiudi_passivita()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 6 Chiusura Passivita'
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 6 Chiusura Passivita'
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -1356,7 +1370,7 @@ void CG4600_application::chiudi_passivita()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 6 Chiusura Passivita'
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 6 Chiusura Passivita'
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -1480,7 +1494,7 @@ void CG4600_application::chiudi_conti_ordine()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch);
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch);
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -1508,7 +1522,7 @@ void CG4600_application::chiudi_conti_ordine()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 5 Chiusura Attivita'
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 5 Chiusura Attivita'
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -1581,7 +1595,7 @@ void CG4600_application::chiusura_conto_patrimoniale()
|
||||
|
||||
j = 0;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 7 Chiusura Conto Patrimoniale
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 7 Chiusura Conto Patrimoniale
|
||||
|
||||
TRectype& rmov1 = _pn->cg(j);
|
||||
numrig = 1;
|
||||
@ -1604,7 +1618,7 @@ else
|
||||
|
||||
j = 0;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 7 Chiusura Conto Patrimoniale
|
||||
compila_testata(_annoesch,_dataregch,_codcausch,_datacompch); //Reg. 7 Chiusura Conto Patrimoniale
|
||||
|
||||
TRectype& rmov1 = _pn->cg(j);
|
||||
numrig = 1;
|
||||
@ -1680,7 +1694,7 @@ void CG4600_application::apri_attivita()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 8 Apertura Attivita'
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 8 Apertura Attivita'
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -1707,7 +1721,7 @@ void CG4600_application::apri_attivita()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 8 Apertura Attivita'
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 8 Apertura Attivita'
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -1826,7 +1840,7 @@ void CG4600_application::apri_passivita()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 9 Apertura Passivita'
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 9 Apertura Passivita'
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -1853,7 +1867,7 @@ void CG4600_application::apri_passivita()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 9 Apertura Passivita'
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 9 Apertura Passivita'
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -1972,7 +1986,7 @@ void CG4600_application::apri_conti_ordine()
|
||||
if (compila_mov)
|
||||
{
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 8 Apertura Attivita'
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 8 Apertura Attivita'
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
@ -1999,7 +2013,7 @@ void CG4600_application::apri_conti_ordine()
|
||||
j = 0;
|
||||
numrig = 1;
|
||||
ultima_registrazione();
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 8 Apertura Attivita'
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 8 Apertura Attivita'
|
||||
compila_mov = FALSE;
|
||||
tot_saldo = ZERO;
|
||||
}
|
||||
@ -2070,7 +2084,7 @@ void CG4600_application::apertura_capitale_netto()
|
||||
int j = 0;
|
||||
ultima_registrazione();
|
||||
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10 Apertura Capitale netto
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 10 Apertura Capitale netto
|
||||
|
||||
TRectype& rmov1 = _pn->cg(j);
|
||||
numrig = 1;
|
||||
@ -2092,7 +2106,7 @@ void CG4600_application::apertura_capitale_netto()
|
||||
int j = 0;
|
||||
ultima_registrazione();
|
||||
|
||||
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10 Apertura Capitale netto
|
||||
compila_testata(_annoesap,_dataregap,_codcausap,_dataregap); //Reg. 10 Apertura Capitale netto
|
||||
|
||||
TRectype& rmov1 = _pn->cg(j);
|
||||
numrig = 1;
|
||||
|
@ -32,7 +32,8 @@ class TRic_archivi : public TApplication
|
||||
TLocalisamfile* _mov;
|
||||
TLocalisamfile* _rmov;
|
||||
TLocalisamfile* _rmoviva;
|
||||
TLocalisamfile* _occas;
|
||||
TLocalisamfile* _occas;
|
||||
TLocalisamfile* _tab;
|
||||
TArchive _arc;
|
||||
|
||||
TString80 TEMP;
|
||||
@ -101,6 +102,7 @@ bool TRic_archivi::create()
|
||||
_rmov = new TLocalisamfile (LF_RMOV);
|
||||
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||
_occas = new TLocalisamfile (LF_OCCAS);
|
||||
_tab = new TLocalisamfile (LF_TAB);
|
||||
|
||||
_numdisk = 1;
|
||||
_prima_volta = TRUE;
|
||||
@ -126,6 +128,7 @@ bool TRic_archivi::destroy()
|
||||
delete _rmov;
|
||||
delete _rmoviva;
|
||||
delete _occas;
|
||||
delete _tab;
|
||||
|
||||
return TApplication::destroy();
|
||||
}
|
||||
@ -217,7 +220,7 @@ bool TRic_archivi::leggi_marker()
|
||||
_totrectras = atol(buffer.sub(23,29));
|
||||
_numinv = atoi(buffer.sub(14,17));
|
||||
tmp = buffer.sub(17,23);
|
||||
_datatras = converti(tmp);
|
||||
_datatras = converti(tmp,FALSE);
|
||||
|
||||
if (_numdisk > 1) //Va fatto solo dal disco 2 in poi
|
||||
if (_nomeid != _nomeidp || _dittainv != _dittainvp || _totrectras != _totrectrasp
|
||||
@ -271,11 +274,11 @@ bool TRic_archivi::leggi_marker_rep()
|
||||
return error_box("Rilevati ERRORI nel file MARKER: impossibile proseguire");
|
||||
|
||||
_nomeid = buffer.sub(0,10);
|
||||
_dittainv = atol(buffer.sub(10,14));
|
||||
_totrectras = atol(buffer.sub(23,29));
|
||||
_numinv = atoi(buffer.sub(14,17));
|
||||
tmp = buffer.sub(17,23);
|
||||
_datatras = converti(tmp);
|
||||
_dittainv = atol(buffer.sub(10,15));
|
||||
_totrectras = atol(buffer.sub(24,30));
|
||||
_numinv = atoi(buffer.sub(15,18));
|
||||
tmp = buffer.sub(18,24);
|
||||
_datatras = converti(tmp,TRUE);
|
||||
|
||||
fclose(i);
|
||||
|
||||
@ -359,6 +362,13 @@ bool TRic_archivi::main_loop()
|
||||
aggiorna_tabella();
|
||||
_tras_file->close(); // Chiude il trasfer letto dalla directory della ditta
|
||||
fremove(_trasf);
|
||||
TString80 tab = _tras_file->path(_dittaric);
|
||||
TString tabcdx = tab;
|
||||
TString tabdbf = tab;
|
||||
tabcdx << "\\ttab.cdx";
|
||||
tabdbf << "\\ttab.dbf";
|
||||
fremove(tabcdx);
|
||||
fremove(tabdbf);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -404,7 +414,7 @@ bool TRic_archivi::main_loop()
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
_trasfhard = _tras_file->path(_dittaric);
|
||||
_trasfhard << HEADER;
|
||||
|
||||
@ -426,7 +436,7 @@ void TRic_archivi::leggi_trasfer(const char* nome)
|
||||
|
||||
if (_tras_file->exist())
|
||||
{
|
||||
if (_tras_file->read_control_rec())
|
||||
if (_tras_file->read_control_rec_t())
|
||||
{
|
||||
_nultras = _tras_file->nultras();
|
||||
_dataultras = _tras_file->dataultras();
|
||||
@ -734,8 +744,8 @@ bool TRic_archivi::set_flag()
|
||||
k += 6;
|
||||
}
|
||||
|
||||
record.overwrite(_sigle_file,38);
|
||||
record.overwrite(_nrec_file,47);
|
||||
record.overwrite(_sigle_file,41);
|
||||
record.overwrite(_nrec_file,50);
|
||||
|
||||
TString agg(7);
|
||||
|
||||
|
535
cg/cg6500.cpp
535
cg/cg6500.cpp
@ -20,7 +20,7 @@ private:
|
||||
|
||||
TString _trasf,_control_rec;
|
||||
long _ditta_tab, _ditta_tras;
|
||||
bool _disable,_ditte_uguali,_salta_hnd;
|
||||
bool _disable,_ditte_uguali,_salta_hnd,_messaggio;
|
||||
|
||||
public:
|
||||
bool user_create();
|
||||
@ -31,12 +31,8 @@ public:
|
||||
virtual int rewrite(const TMask& m);
|
||||
|
||||
void leggi_trasfer();
|
||||
void confronta_ditta();
|
||||
char cerca_stato(long codditta);
|
||||
void codifica_ditta(TMask& m);
|
||||
void tabella_ditta(TMask& m);
|
||||
|
||||
//void esegui_controlli(TMask& m);
|
||||
static bool controlli_hnd (TMask_field& f, KEY k);
|
||||
|
||||
static bool nascosto_handler(TMask& m, KEY k);
|
||||
@ -47,11 +43,15 @@ public:
|
||||
static bool clifo_comune (TMask_field& f, KEY k);
|
||||
static bool pcon_comune (TMask_field& f, KEY k);
|
||||
static bool prima_nota (TMask_field& f, KEY k);
|
||||
static bool iva (TMask_field& f, KEY k);
|
||||
static bool saldaconto (TMask_field& f, KEY k);
|
||||
static bool data_invio (TMask_field& f, KEY k);
|
||||
static bool sigla_file (TMask_field& f, KEY k);
|
||||
static bool chiave_file (TMask_field& f, KEY k);
|
||||
|
||||
static bool nome_id (TMask_field& f, KEY k);
|
||||
static bool nome_id (TMask_field& f, KEY k);
|
||||
|
||||
void setta_chiave (TMask& m);
|
||||
|
||||
Tabinv_application() {}
|
||||
virtual ~Tabinv_application() {}
|
||||
@ -87,7 +87,7 @@ bool Tabinv_application::nascosto_handler(TMask& m, KEY k)
|
||||
m.enable(F_DATAULIN);
|
||||
m.enable(F_STATO);
|
||||
|
||||
if (app()._ditta_tab == app()._ditta_tras)
|
||||
if ( (app()._ditta_tab == app()._ditta_tras) && m.mode() != MODE_INS)
|
||||
{
|
||||
m.enable(F_USELAB);
|
||||
m.enable(F_CHIAVE);
|
||||
@ -112,19 +112,26 @@ bool Tabinv_application::stato_invio(TMask_field& f, KEY k)
|
||||
{
|
||||
TString stato = f.get();
|
||||
int num = f.mask().get_int(F_NUMULINV);
|
||||
TString sigla = f.mask().get(F_USELAB);
|
||||
|
||||
if (num == 0 && stato != "")
|
||||
return warning_box("Numero ultimo invio NON INDICATO: impossibile indicare lo stato ultimo invio");
|
||||
return error_box("Numero ultimo invio NON INDICATO: impossibile indicare lo stato ultimo invio");
|
||||
|
||||
if ( (stato == "F" && sigla == "") || (stato == "D" && sigla != "") )
|
||||
return error_box("La sigla ultimo file elaborato deve essere indicata se lo stato ultimo invio e' uguale a F");
|
||||
}
|
||||
|
||||
if (k == K_TAB)
|
||||
if (k == K_TAB && app()._messaggio)
|
||||
{
|
||||
long codditta = f.mask().get_long(F_DITTAINV);
|
||||
|
||||
char stato = app().cerca_stato(codditta);
|
||||
|
||||
if (stato != '\0' && app()._disable)
|
||||
return warning_box("Rilevato STATO DI RIPARTENZA: prima concludere il trasferimento");
|
||||
{
|
||||
app()._messaggio = FALSE;
|
||||
return message_box("Rilevato STATO DI RIPARTENZA: prima concludere il trasferimento");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +152,57 @@ bool Tabinv_application::ditta_handler(TMask_field& f, KEY k)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (k == K_TAB)
|
||||
{
|
||||
TLocalisamfile ditte (LF_NDITTE);
|
||||
|
||||
long ditta = f.mask().get_long(F_DITTAINV);
|
||||
|
||||
ditte.setkey(1);
|
||||
ditte.zero();
|
||||
ditte.put(NDT_CODDITTA, ditta);
|
||||
if (ditte.read() == NOERR)
|
||||
{
|
||||
TString ragsoc = ditte.get(NDT_RAGSOC);
|
||||
f.mask().set(F_RAGSOC, ragsoc);
|
||||
}
|
||||
else
|
||||
f.mask().set(F_RAGSOC, "");
|
||||
|
||||
app()._ditta_tab = f.mask().get_long(F_DITTAINV);
|
||||
|
||||
if (app()._ditta_tab == app()._ditta_tras)
|
||||
{
|
||||
TTable ind ("%IND");
|
||||
TString dep;
|
||||
|
||||
dep = format("%05d", app()._ditta_tab);
|
||||
|
||||
ind.zero();
|
||||
ind.put("CODTAB", dep);
|
||||
if (ind.read() == NOERR)
|
||||
{
|
||||
TString uselab = app()._tras_file.ult_file();
|
||||
TString chiave = app()._tras_file.key();
|
||||
|
||||
f.mask().set(F_USELAB, uselab);
|
||||
f.mask().set(F_CHIAVE, chiave);
|
||||
}
|
||||
else
|
||||
{
|
||||
f.mask().set(F_USELAB, "");
|
||||
f.mask().set(F_CHIAVE, "");
|
||||
}
|
||||
app()._ditte_uguali = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
app()._ditte_uguali = FALSE;
|
||||
f.mask().set(F_USELAB, "");
|
||||
f.mask().set(F_CHIAVE, "");
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -161,7 +218,7 @@ bool Tabinv_application::almeno_un_flag(TMask_field& f, KEY k)
|
||||
bool fat = f.mask().get_bool(F_FATT);
|
||||
|
||||
if (!cau && !clifo && !pcon && !pn && !iva && !fat)
|
||||
return warning_box("E' necessario indicare almeno una sigla file da trasferire");
|
||||
return error_box("E' necessario indicare almeno una sigla file da trasferire");
|
||||
|
||||
long ditta = f.mask().get_long(F_DITTAINV);
|
||||
|
||||
@ -174,7 +231,7 @@ bool Tabinv_application::almeno_un_flag(TMask_field& f, KEY k)
|
||||
bool causali = f.mask().get_bool(F_CAUSALI);
|
||||
|
||||
if (causali && pcon_cau != "")
|
||||
return warning_box("Tabella causali in comune: impossibile trasferirla");
|
||||
return error_box("Tabella causali in comune: impossibile trasferirla");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -195,7 +252,7 @@ bool Tabinv_application::clifo_comune(TMask_field& f, KEY k)
|
||||
bool clifo = f.mask().get_bool(F_CLIFO);
|
||||
|
||||
if (clifo && ana_com != "")
|
||||
return warning_box("Anagrafica clienti / fornitori in comune: impossibile trasferirla");
|
||||
return error_box("Anagrafica clienti / fornitori in comune: impossibile trasferirla");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -216,7 +273,7 @@ bool Tabinv_application::pcon_comune(TMask_field& f, KEY k)
|
||||
bool pcon = f.mask().get_bool(F_PCON);
|
||||
|
||||
if (pcon && pcon_cau != "")
|
||||
return warning_box("Anagrafica Piano dei conti in comune: impossibile trasferirla");
|
||||
return error_box("Anagrafica Piano dei conti in comune: impossibile trasferirla");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -224,12 +281,48 @@ bool Tabinv_application::pcon_comune(TMask_field& f, KEY k)
|
||||
|
||||
bool Tabinv_application::prima_nota(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER && f.mask().mode() != MODE_QUERY)
|
||||
if (k == K_SPACE && f.mask().mode() != MODE_QUERY)
|
||||
{
|
||||
bool pn = f.mask().get_bool(F_MOV);
|
||||
|
||||
if (!pn && (f.mask().get_bool(F_IVA) || f.mask().get_bool(F_FATT)) )
|
||||
return warning_box("Se si vuole inviare l' iva e' obbligatorio inviare anche la primanota");
|
||||
if (!pn && f.mask().get_bool(F_IVA) )
|
||||
{
|
||||
f.mask().set(F_MOV, "X");
|
||||
return f.error_box("Se si vuole inviare l' iva e' obbligatorio inviare anche la primanota");
|
||||
}
|
||||
if (!pn && f.mask().get_bool(F_FATT) )
|
||||
{
|
||||
f.mask().set(F_MOV, "X");
|
||||
return f.error_box("Se si vuole inviare il saldaconto e' obbligatorio inviare anche la primanota");
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool Tabinv_application::iva(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE && f.mask().mode() != MODE_QUERY)
|
||||
{
|
||||
bool iva = f.mask().get_bool(F_IVA);
|
||||
bool sc = f.mask().get_bool(F_FATT);
|
||||
|
||||
if (iva)
|
||||
f.mask().set(F_MOV, "X");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool Tabinv_application::saldaconto(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE && f.mask().mode() != MODE_QUERY)
|
||||
{
|
||||
bool iva = f.mask().get_bool(F_IVA);
|
||||
bool sc = f.mask().get_bool(F_FATT);
|
||||
|
||||
if (sc)
|
||||
f.mask().set(F_MOV, "X");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -243,10 +336,10 @@ bool Tabinv_application::data_invio (TMask_field& f, KEY k)
|
||||
TDate data (f.get());
|
||||
|
||||
if (num != 0 && !data.ok())
|
||||
return warning_box("Se indicato il numero deve essere indicata anche la data di invio");
|
||||
return error_box("Se indicato il numero deve essere indicata anche la data di invio");
|
||||
|
||||
if (num == 0 && data.ok())
|
||||
return warning_box("Se non indicato il numero non puo' essere indicata la data di invio");
|
||||
return error_box("Se non indicato il numero non puo' essere indicata la data di invio");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -260,12 +353,13 @@ bool Tabinv_application::sigla_file(TMask_field& f, KEY k)
|
||||
TString sigla = f.get();
|
||||
|
||||
if (num == 0 && sigla != "")
|
||||
return warning_box("Numero ultimo invio NON INDICATO: impossibile indicare la sigla ultimo file elaborato");
|
||||
return error_box("Numero ultimo invio NON INDICATO: impossibile indicare la sigla ultimo file elaborato");
|
||||
|
||||
// TString stato = f.mask().get(F_STATO);
|
||||
|
||||
TString stato = f.mask().get(F_STATO);
|
||||
// if ( (stato == "F" && sigla == "") || (stato == "D" && sigla != "") )
|
||||
// return error_box("La sigla ultimo file elaborato deve essere indicata se lo stato ultimo invio e' uguale a F");
|
||||
|
||||
if (stato != "F" && sigla != "")
|
||||
return warning_box("La sigla ultimo file elaborato puo' essere indicata solo se lo stato ultimo invio e' F");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -279,27 +373,110 @@ bool Tabinv_application::chiave_file(TMask_field& f, KEY k)
|
||||
TString chiave = f.get();
|
||||
|
||||
if (sigla == "" && chiave != "")
|
||||
return warning_box("Sigla ultimo file elaborato NON INDICATA: impossibile indicare la chiave ultimo record elaborato");
|
||||
return error_box("Sigla ultimo file elaborato NON INDICATA: impossibile indicare la chiave ultimo record elaborato");
|
||||
|
||||
TString stato = f.mask().get(F_STATO);
|
||||
|
||||
if (stato != "F" && chiave == "" && sigla != "")
|
||||
return warning_box("La chiave ultimo record elaborato deve essere indicata obbligatoriamente");
|
||||
return error_box("La chiave ultimo record elaborato deve essere indicata obbligatoriamente");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Tabinv_application::setta_chiave(TMask& m)
|
||||
{
|
||||
m.set(F_CODICE, "INS");
|
||||
m.field(F_CODICE).check();
|
||||
}
|
||||
|
||||
bool Tabinv_application::nome_id(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB)
|
||||
{
|
||||
TLocalisamfile ditte (LF_NDITTE);
|
||||
|
||||
long ditta = f.mask().get_long(F_DITTAINV);
|
||||
if (ditta != 0)
|
||||
{
|
||||
if (!prefix().exist(ditta))
|
||||
{
|
||||
f.error_box("La ditta selezionata non e' abilitata per la contabilita' ");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ditte.setkey(1);
|
||||
ditte.zero();
|
||||
ditte.put(NDT_CODDITTA, ditta);
|
||||
if (ditte.read() == NOERR)
|
||||
{
|
||||
TString ragsoc = ditte.get(NDT_RAGSOC);
|
||||
f.mask().set(F_RAGSOC, ragsoc);
|
||||
}
|
||||
else
|
||||
f.mask().set(F_RAGSOC, "");
|
||||
|
||||
TTable ind ("%IND");
|
||||
TString dep;
|
||||
|
||||
if (ditta != 0)
|
||||
{
|
||||
dep = format("%05d", ditta);
|
||||
|
||||
ind.zero();
|
||||
ind.put("CODTAB", dep);
|
||||
if (ind.read() == NOERR)
|
||||
{
|
||||
TString stato = ind.get ("S6");
|
||||
int num = ind.get_int ("I0");
|
||||
TDate data = ind.get_date("D0");
|
||||
|
||||
f.mask().set(F_STATO, stato);
|
||||
f.mask().set(F_NUMULINV, num);
|
||||
f.mask().set(F_DATAULIN, data.string());
|
||||
}
|
||||
else
|
||||
{
|
||||
f.mask().set(F_STATO, "");
|
||||
f.mask().set(F_NUMULINV, "");
|
||||
f.mask().set(F_DATAULIN, "");
|
||||
f.error_box("Codice ditta NON PRESENTE in tabella trasferimenti");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
f.mask().set(F_STATO, "");
|
||||
f.mask().set(F_NUMULINV, "");
|
||||
f.mask().set(F_DATAULIN, "");
|
||||
}
|
||||
|
||||
app()._ditta_tab = f.mask().get_long(F_DITTAINV);
|
||||
|
||||
if (app()._ditta_tab == app()._ditta_tras)
|
||||
{
|
||||
TString uselab = app()._tras_file.ult_file();
|
||||
TString chiave = app()._tras_file.key();
|
||||
|
||||
f.mask().set(F_USELAB, uselab);
|
||||
f.mask().set(F_CHIAVE, chiave);
|
||||
app()._ditte_uguali = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
app()._ditte_uguali = FALSE;
|
||||
f.mask().set(F_USELAB, "");
|
||||
f.mask().set(F_CHIAVE, "");
|
||||
}
|
||||
}
|
||||
if (k == K_TAB && !app()._salta_hnd && f.mask().mode() != MODE_QUERY)
|
||||
{
|
||||
long codditta = f.mask().get_long(F_DITTAINV);
|
||||
|
||||
if (codditta != 0)
|
||||
return warning_box("Rilevato STATO DI RIPARTENZA: prima concludere il trasferimento");
|
||||
}
|
||||
if (codditta != 0)
|
||||
return message_box("Rilevato STATO DI RIPARTENZA: prima concludere il trasferimento");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -312,28 +489,28 @@ bool Tabinv_application::controlli_hnd(TMask_field& f, KEY k)
|
||||
TDate data (f.mask().get(F_DATAULIN));
|
||||
|
||||
if (num != 0 && !data.ok())
|
||||
return warning_box("Se indicato il numero deve essere indicata anche la data di invio");
|
||||
return error_box("Se indicato il numero deve essere indicata anche la data di invio");
|
||||
|
||||
if (num == 0 && data.ok())
|
||||
return warning_box("Se non indicato il numero non puo' essere indicata la data di invio");
|
||||
return error_box("Se non indicato il numero non puo' essere indicata la data di invio");
|
||||
|
||||
TString sigla = f.mask().get(F_USELAB);
|
||||
|
||||
if (num == 0 && sigla != "")
|
||||
return warning_box("Numero ultimo invio NON INDICATO: impossibile indicare la sigla ultimo file elaborato");
|
||||
return error_box("Numero ultimo invio NON INDICATO: impossibile indicare la sigla ultimo file elaborato");
|
||||
|
||||
TString stato = f.mask().get(F_STATO);
|
||||
|
||||
if (stato != "F" && sigla != "")
|
||||
return warning_box("La sigla ultimo file elaborato puo' essere indicata solo se lo stato ultimo invio e' F");
|
||||
return error_box("La sigla ultimo file elaborato puo' essere indicata solo se lo stato ultimo invio e' F");
|
||||
|
||||
TString chiave = f.mask().get(F_CHIAVE);
|
||||
|
||||
if (sigla == "" && chiave != "")
|
||||
return warning_box("Sigla ultimo file elaborato NON INDICATA: impossibile indicare la chiave ultimo record elaborato");
|
||||
return error_box("Sigla ultimo file elaborato NON INDICATA: impossibile indicare la chiave ultimo record elaborato");
|
||||
|
||||
if (stato != "F" && chiave == "" && sigla != "")
|
||||
return warning_box("La chiave ultimo record elaborato deve essere indicata obbligatoriamente");
|
||||
return error_box("La chiave ultimo record elaborato deve essere indicata obbligatoriamente");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -351,7 +528,7 @@ void Tabinv_application::leggi_trasfer()
|
||||
if (_tras_file.read_control_rec())
|
||||
{
|
||||
_control_rec = _tras_file.record();
|
||||
_ditta_tras = atol(_control_rec.sub(25,29));
|
||||
_ditta_tras = _tras_file.ditta();
|
||||
}
|
||||
else
|
||||
_ditta_tras = 0;
|
||||
@ -360,89 +537,18 @@ void Tabinv_application::leggi_trasfer()
|
||||
_ditta_tras = 0;
|
||||
}
|
||||
|
||||
void Tabinv_application::confronta_ditta()
|
||||
{
|
||||
_ditta_tab = _msk->get_long(F_DITTAINV);
|
||||
|
||||
if (_ditta_tab == _ditta_tras)
|
||||
{
|
||||
TString uselab = _tras_file.ult_file();
|
||||
TString chiave = _tras_file.key();
|
||||
|
||||
_msk->set(F_USELAB, uselab);
|
||||
_msk->set(F_CHIAVE, chiave);
|
||||
_ditte_uguali = TRUE;
|
||||
}
|
||||
else
|
||||
_ditte_uguali = FALSE;
|
||||
}
|
||||
|
||||
void Tabinv_application::codifica_ditta(TMask& m)
|
||||
{
|
||||
TLocalisamfile ditte ( LF_NDITTE);
|
||||
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
|
||||
ditte.setkey(1);
|
||||
ditte.zero();
|
||||
ditte.put(NDT_CODDITTA, ditta);
|
||||
if (ditte.read() == NOERR)
|
||||
{
|
||||
TString ragsoc = ditte.get(NDT_RAGSOC);
|
||||
m.set(F_RAGSOC, ragsoc);
|
||||
}
|
||||
}
|
||||
|
||||
void Tabinv_application::tabella_ditta(TMask& m)
|
||||
{
|
||||
TTable ind ("%IND");
|
||||
TString dep;
|
||||
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
|
||||
if (ditta != 0)
|
||||
{
|
||||
dep = format("%05d", ditta);
|
||||
|
||||
ind.zero();
|
||||
ind.put("CODTAB", dep);
|
||||
if (ind.read() == NOERR)
|
||||
{
|
||||
TString stato = ind.get_char("S6");
|
||||
int num = ind.get_int ("I0");
|
||||
TDate data = ind.get_date("D0");
|
||||
|
||||
m.set(F_STATO, stato);
|
||||
m.set(F_NUMULINV, num);
|
||||
m.set(F_DATAULIN, data.string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Tabinv_application::init_query_mode(TMask& m)
|
||||
{
|
||||
leggi_trasfer();
|
||||
_disable = TRUE;
|
||||
_disable = TRUE;
|
||||
_messaggio = TRUE;
|
||||
|
||||
if (_tabname == "%INS")
|
||||
{
|
||||
{
|
||||
setta_chiave(m);
|
||||
m.send_key(K_AUTO_ENTER,0);
|
||||
|
||||
m.disable(F_DITTAINV);
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
if (ditta != 0)
|
||||
{
|
||||
codifica_ditta(m);
|
||||
tabella_ditta(m);
|
||||
confronta_ditta();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.reset(F_NUMULINV);
|
||||
m.reset(F_DATAULIN);
|
||||
m.reset(F_STATO);
|
||||
m.reset(F_USELAB);
|
||||
m.reset(F_CHIAVE);
|
||||
m.reset(F_RAGSOC);
|
||||
}
|
||||
}
|
||||
|
||||
m.disable(F_NUMULINV);
|
||||
@ -454,33 +560,60 @@ void Tabinv_application::init_query_mode(TMask& m)
|
||||
|
||||
void Tabinv_application::init_modify_mode(TMask& m)
|
||||
{
|
||||
if (_tabname == "%IND")
|
||||
{
|
||||
leggi_trasfer();
|
||||
confronta_ditta();
|
||||
codifica_ditta(m);
|
||||
//esegui_controlli(m);
|
||||
}
|
||||
|
||||
if (_tabname == "%INS")
|
||||
if (_tabname == "%IND")
|
||||
{
|
||||
m.disable(F_DITTAINV);
|
||||
leggi_trasfer();
|
||||
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
if (ditta != 0)
|
||||
{
|
||||
codifica_ditta(m);
|
||||
tabella_ditta(m);
|
||||
confronta_ditta();
|
||||
|
||||
if (ditta == _ditta_tras)
|
||||
{
|
||||
TString uselab = _tras_file.ult_file();
|
||||
TString chiave = _tras_file.key();
|
||||
|
||||
m.set(F_USELAB, uselab);
|
||||
m.set(F_CHIAVE, chiave);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.reset(F_NUMULINV);
|
||||
m.reset(F_DATAULIN);
|
||||
m.reset(F_STATO);
|
||||
m.reset(F_USELAB);
|
||||
m.reset(F_CHIAVE);
|
||||
m.reset(F_RAGSOC);
|
||||
m.set(F_USELAB, "");
|
||||
m.set(F_CHIAVE, "");
|
||||
}
|
||||
|
||||
char stato = app().cerca_stato(ditta);
|
||||
|
||||
if (stato == '\0')
|
||||
{
|
||||
m.enable(F_CAUSALI);
|
||||
m.enable(F_CLIFO);
|
||||
m.enable(F_PCON);
|
||||
m.enable(F_MOV);
|
||||
m.enable(F_IVA);
|
||||
//m.enable(F_FATT);
|
||||
m.enable(F_BOLLATO);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.disable(F_CAUSALI);
|
||||
m.disable(F_CLIFO);
|
||||
m.disable(F_PCON);
|
||||
m.disable(F_MOV);
|
||||
m.disable(F_IVA);
|
||||
//m.disable(F_FATT);
|
||||
m.disable(F_BOLLATO);
|
||||
}
|
||||
}
|
||||
if (_tabname == "%INS")
|
||||
{
|
||||
setta_chiave(m);
|
||||
|
||||
m.disable(F_DITTAINV);
|
||||
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
if (ditta == 0)
|
||||
m.enable(F_NOMEID);
|
||||
else
|
||||
m.disable(F_NOMEID);
|
||||
}
|
||||
|
||||
m.disable(F_NUMULINV);
|
||||
@ -493,33 +626,10 @@ void Tabinv_application::init_modify_mode(TMask& m)
|
||||
void Tabinv_application::init_insert_mode(TMask& m)
|
||||
{
|
||||
if (_tabname == "%IND")
|
||||
{
|
||||
leggi_trasfer();
|
||||
confronta_ditta();
|
||||
codifica_ditta(m);
|
||||
//esegui_controlli(m);
|
||||
}
|
||||
|
||||
if (_tabname == "%INS")
|
||||
{
|
||||
m.disable(F_DITTAINV);
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
if (ditta != 0)
|
||||
{
|
||||
codifica_ditta(m);
|
||||
tabella_ditta(m);
|
||||
confronta_ditta();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.reset(F_NUMULINV);
|
||||
m.reset(F_DATAULIN);
|
||||
m.reset(F_STATO);
|
||||
m.reset(F_USELAB);
|
||||
m.reset(F_CHIAVE);
|
||||
m.reset(F_RAGSOC);
|
||||
}
|
||||
}
|
||||
|
||||
m.disable(F_NUMULINV);
|
||||
m.disable(F_DATAULIN);
|
||||
@ -531,36 +641,39 @@ void Tabinv_application::init_insert_mode(TMask& m)
|
||||
int Tabinv_application::write(const TMask& m)
|
||||
{
|
||||
if (_tabname == "%IND")
|
||||
{
|
||||
TString str;
|
||||
{
|
||||
if (m.mode() != MODE_INS)
|
||||
{
|
||||
TString str;
|
||||
|
||||
TString std = m.get(F_STATO);
|
||||
TString std = m.get(F_STATO);
|
||||
|
||||
TConfig conf (CONFIG_DITTA);
|
||||
conf.set("FlStInv", std);
|
||||
|
||||
TConfig conf (CONFIG_DITTA);
|
||||
conf.set("FlStInv", std);
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
TString data = m.get (F_DATAULIN);
|
||||
TString sigla = m.get (F_USELAB);
|
||||
TString chiave = m.get (F_CHIAVE);
|
||||
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
TString data = m.get (F_DATAULIN);
|
||||
TString sigla = m.get (F_USELAB);
|
||||
TString chiave = m.get (F_CHIAVE);
|
||||
if (sigla == "")
|
||||
sigla = " ";
|
||||
|
||||
if (sigla == "")
|
||||
sigla = " ";
|
||||
|
||||
if (_tras_file.read_control_rec())
|
||||
{
|
||||
if (_ditte_uguali)
|
||||
{
|
||||
_control_rec = _tras_file.record();
|
||||
str = format("%03d", num);
|
||||
_control_rec.overwrite(str,29);
|
||||
str = riconverti(data);
|
||||
_control_rec.overwrite(str,32);
|
||||
_control_rec.overwrite(sigla,240);
|
||||
str = format("%-15s", (const char*) chiave);
|
||||
_control_rec.overwrite(str,241);
|
||||
if (_tras_file.read_control_rec())
|
||||
{
|
||||
if (_ditte_uguali)
|
||||
{
|
||||
_control_rec = _tras_file.record();
|
||||
str = format("%03d", num);
|
||||
_control_rec.overwrite(str,30);
|
||||
str = riconverti(data,TRUE);
|
||||
_control_rec.overwrite(str,33);
|
||||
_control_rec.overwrite(sigla,240);
|
||||
str = format("%-15s", (const char*) chiave);
|
||||
_control_rec.overwrite(str,241);
|
||||
|
||||
_tras_file.write_control_rec(_control_rec,256);
|
||||
_tras_file.write_control_rec(_control_rec,256);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -571,36 +684,39 @@ int Tabinv_application::write(const TMask& m)
|
||||
int Tabinv_application::rewrite(const TMask& m)
|
||||
{
|
||||
if (_tabname == "%IND")
|
||||
{
|
||||
TString str;
|
||||
{
|
||||
if (m.mode() != MODE_INS)
|
||||
{
|
||||
TString str;
|
||||
|
||||
TString std = m.get(F_STATO);
|
||||
TString std = m.get(F_STATO);
|
||||
|
||||
TConfig conf (CONFIG_DITTA);
|
||||
conf.set("FlStInv", std);
|
||||
TConfig conf (CONFIG_DITTA);
|
||||
conf.set("FlStInv", std);
|
||||
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
TString data = m.get (F_DATAULIN);
|
||||
TString sigla = m.get (F_USELAB);
|
||||
TString chiave = m.get (F_CHIAVE);
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
TString data = m.get (F_DATAULIN);
|
||||
TString sigla = m.get (F_USELAB);
|
||||
TString chiave = m.get (F_CHIAVE);
|
||||
|
||||
if (sigla == "")
|
||||
sigla = " ";
|
||||
if (sigla == "")
|
||||
sigla = " ";
|
||||
|
||||
if (_tras_file.read_control_rec())
|
||||
{
|
||||
if (_ditte_uguali)
|
||||
{
|
||||
_control_rec = _tras_file.record();
|
||||
str = format("%03d", num);
|
||||
_control_rec.overwrite(str,29);
|
||||
str = riconverti(data);
|
||||
_control_rec.overwrite(str,32);
|
||||
_control_rec.overwrite(sigla,240);
|
||||
str = format("%-15s", (const char*) chiave);
|
||||
_control_rec.overwrite(str,241);
|
||||
if (_tras_file.read_control_rec())
|
||||
{
|
||||
if (_ditte_uguali)
|
||||
{
|
||||
_control_rec = _tras_file.record();
|
||||
str = format("%03d", num);
|
||||
_control_rec.overwrite(str,30);
|
||||
str = riconverti(data,TRUE);
|
||||
_control_rec.overwrite(str,33);
|
||||
_control_rec.overwrite(sigla,240);
|
||||
str = format("%-15s", (const char*) chiave);
|
||||
_control_rec.overwrite(str,241);
|
||||
|
||||
_tras_file.write_control_rec(_control_rec,256);
|
||||
_tras_file.write_control_rec(_control_rec,256);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -624,19 +740,22 @@ bool Tabinv_application::user_create()
|
||||
_msk->set_handler(F_CLIFO, clifo_comune);
|
||||
_msk->set_handler(F_PCON, pcon_comune);
|
||||
_msk->set_handler(F_MOV, prima_nota);
|
||||
_msk->set_handler(F_IVA, iva);
|
||||
_msk->set_handler(F_FATT, saldaconto);
|
||||
_msk->set_handler(F_DATAULIN, data_invio);
|
||||
_msk->set_handler(F_USELAB, sigla_file);
|
||||
_msk->set_handler(F_CHIAVE, chiave_file);
|
||||
_msk->set_handler(F_GHOST_FIELD, controlli_hnd);
|
||||
_msk->disable(F_FATT);
|
||||
}
|
||||
|
||||
if (_tabname == "%INS")
|
||||
{
|
||||
{
|
||||
_msk->set_handler(nascosto_handler);
|
||||
_msk->set_handler(F_DITTAINV, nome_id);
|
||||
_salta_hnd = FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1126,7 +1126,7 @@ void TRic_tab::ricevi_movIVA(TString& key, char uselab)
|
||||
occasionali(ocfpi);
|
||||
|
||||
TDate data74ter ( _tmov->get_date(MOV_DATA74TER) );
|
||||
TString codval ( _tmov->get (MOV_CODVAL) );
|
||||
TString codval ( _tmov->get (MOV_CODVALI) );
|
||||
long codcf = _tmov->get_long(MOV_CODCF);
|
||||
real totdoc ( _tmov->get_real(MOV_TOTDOC) );
|
||||
real cambioi ( _tmov->get_real(MOV_CAMBIOI) );
|
||||
@ -1141,7 +1141,7 @@ void TRic_tab::ricevi_movIVA(TString& key, char uselab)
|
||||
if (_mov->read() == NOERR) // Se non esiste la testata
|
||||
{
|
||||
_mov->put(MOV_DATA74TER, data74ter);
|
||||
_mov->put(MOV_CODVAL, codval);
|
||||
_mov->put(MOV_CODVALI, codval);
|
||||
_mov->put(MOV_CODCF, codcf);
|
||||
_mov->put(MOV_TOTDOC, totdoc);
|
||||
_mov->put(MOV_CAMBIOI, cambioi);
|
||||
|
@ -33,19 +33,19 @@ END
|
||||
STRING F_STD 1
|
||||
BEGIN
|
||||
PROMPT 1 6 "Stato del trasferimento "
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
STRING F_USELAB 1
|
||||
BEGIN
|
||||
PROMPT 31 6 ""
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
STRING F_STATO 14
|
||||
STRING F_STATO 15
|
||||
BEGIN
|
||||
PROMPT 35 6 ""
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
|
@ -47,19 +47,19 @@ END
|
||||
STRING F_SDT 1
|
||||
BEGIN
|
||||
PROMPT 31 11 ""
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
STRING F_SIGLA 1
|
||||
BEGIN
|
||||
PROMPT 34 11 ""
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
STRING F_CHIAVE 15
|
||||
BEGIN
|
||||
PROMPT 37 11 ""
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
|
@ -139,8 +139,8 @@ bool TDitta_ric::controlli()
|
||||
}
|
||||
}
|
||||
|
||||
_control_rec.overwrite(_sigle_file,38);
|
||||
_control_rec.overwrite(_nrec_file,47);
|
||||
_control_rec.overwrite(_sigle_file,41);
|
||||
_control_rec.overwrite(_nrec_file,50);
|
||||
_tras_file.write_control_rec(_control_rec,256);
|
||||
leggi_record_controllo();
|
||||
}
|
||||
|
@ -181,14 +181,19 @@ void TVis_ric::registra(TMask& m)
|
||||
str = m.get(F_NULTRAS);
|
||||
TString nultras = format("%03s", (const char*) str);
|
||||
str = m.get(F_DATAULTRAS);
|
||||
TString datault = riconverti(str);
|
||||
TString datault = riconverti(str,TRUE);
|
||||
char agg_cau = m.get(F_AGGCAUSALI)[0];
|
||||
char agg_clf = m.get(F_AGGCLIFO)[0];
|
||||
char agg_pco = m.get(F_AGGPCON)[0];
|
||||
char agg_IV = m.get(F_AGGIVD)[0];
|
||||
char riat_at = m.get(F_FATTEM)[0];
|
||||
char riat_pa = m.get(F_FATTRIC)[0];
|
||||
|
||||
char riat_pa = m.get(F_FATTRIC)[0];
|
||||
if (riat_at =='\0')
|
||||
riat_at = ' ';
|
||||
|
||||
if (riat_pa == '\0')
|
||||
riat_pa = ' ';
|
||||
|
||||
TString flags (7);
|
||||
flags[0] = agg_IV;
|
||||
flags[1] = agg_cau;
|
||||
@ -205,8 +210,8 @@ void TVis_ric::registra(TMask& m)
|
||||
str = m.get(F_STATO);
|
||||
TString chiave = format("%-15s", (const char*) str);
|
||||
|
||||
_control_rec.overwrite(nultras,29);
|
||||
_control_rec.overwrite(datault,32);
|
||||
_control_rec.overwrite(nultras,30);
|
||||
_control_rec.overwrite(datault,33);
|
||||
_control_rec.overwrite(flags,234);
|
||||
_control_rec.overwrite(uselab,240);
|
||||
_control_rec.overwrite(chiave,241);
|
||||
@ -267,8 +272,8 @@ bool TVis_ric::leggi_trasfer()
|
||||
if (_tras_file.read_control_rec())
|
||||
{
|
||||
_control_rec = _tras_file.record();
|
||||
_nomeid = _control_rec.sub(15,25);
|
||||
_dittainv = _control_rec.sub(25,29);
|
||||
_nomeid = _tras_file.nome_simb();
|
||||
_dittainv = _tras_file.ditta();
|
||||
_nultras = _tras_file.nultras();
|
||||
_dataultras = _tras_file.dataultras();
|
||||
_uselab = _tras_file.ult_file();
|
||||
|
@ -21,9 +21,9 @@ class TVis_ric : public TApplication
|
||||
TTable* _tab_tra;
|
||||
TTransfer_file _tras_file;
|
||||
|
||||
TString _trasf,_std,_uselab,_key,_dittainv,_nomeid,_ragsoc_dittar;
|
||||
TString _trasf,_std,_uselab,_key,_nomeid,_ragsoc_dittar;
|
||||
TString _agg_cau,_agg_clifo,_agg_pcon,_agg_IVdir,_riatt_att,_riatt_pas;
|
||||
long _dittaric;
|
||||
long _dittaric,_dittainv;
|
||||
TString _control_rec;
|
||||
TDate _dataultras;
|
||||
int _nultras;
|
||||
|
@ -33,19 +33,19 @@ END
|
||||
STRING F_STD 1
|
||||
BEGIN
|
||||
PROMPT 1 8 "Stato del trasferimento "
|
||||
FLAGS "G"
|
||||
FLAGS "GU"
|
||||
END
|
||||
|
||||
STRING F_USELAB 1
|
||||
BEGIN
|
||||
PROMPT 34 8 ""
|
||||
FLAGS "G"
|
||||
FLAGS "GU"
|
||||
END
|
||||
|
||||
STRING F_STATO 14
|
||||
STRING F_STATO 15
|
||||
BEGIN
|
||||
PROMPT 38 8 ""
|
||||
FLAGS "G"
|
||||
FLAGS "GU"
|
||||
END
|
||||
|
||||
LIST F_AGGCAUSALI 6
|
||||
|
234
cg/cg6900.cpp
234
cg/cg6900.cpp
@ -17,7 +17,15 @@ TInv_cont::TInv_cont(char mov) : _scelta(toupper(mov))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TInv_cont::messaggio_hnd(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB)
|
||||
return message_box("Rilevato STATO DI RIPARTENZA: il trasferimento ripartira' automaticamente");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInv_cont::main_loop()
|
||||
{
|
||||
TString str;
|
||||
@ -57,21 +65,36 @@ bool TInv_cont::main_loop()
|
||||
|
||||
if (!ripartenza)
|
||||
msk.set_handler(F_DITTAINV, setta_maschera_hnd);
|
||||
else
|
||||
msk.set_handler(F_NUMULINV, messaggio_hnd);
|
||||
|
||||
tasto = msk.run();
|
||||
|
||||
if (tasto != K_ENTER) return FALSE;
|
||||
|
||||
|
||||
// Nel caso di invio PC --> SISTEMA eseguo prima la
|
||||
// Lista controllo archivi per rilevare eventuali
|
||||
// differenze.
|
||||
|
||||
long ditta = msk.get_long(F_DITTAINV);
|
||||
set_firm(ditta);
|
||||
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
TString std = conf.get("FlStInv");
|
||||
|
||||
if (_scelta == 'S')
|
||||
{
|
||||
if (_scelta == 'S' && std != "D")
|
||||
{
|
||||
TString appname = "cg6 -8 L";
|
||||
TString corpo = "";
|
||||
|
||||
TDate data = msk.get(F_DATALIM);
|
||||
|
||||
corpo << data.string();
|
||||
|
||||
TMessage mess (appname,"",(const char*)corpo);
|
||||
TMailbox mb;
|
||||
mb.send(mess);
|
||||
|
||||
TExternal_app a (appname);
|
||||
a.run();
|
||||
|
||||
@ -96,6 +119,16 @@ bool TInv_cont::main_loop()
|
||||
setta_tabella_studio(msk); //Aggiorna la tabella studio per invio
|
||||
setta_tabella_ditta(msk,"F"); //Aggiorna la tabella ditta per invio
|
||||
crea_record_controllo(msk); //Crea il record di controllo sul file header
|
||||
}
|
||||
else
|
||||
{
|
||||
TString str,app;
|
||||
|
||||
int num = msk.get_int(F_NUMULINV);
|
||||
TString data (msk.get(F_DATALIM));
|
||||
app = riconverti(data,FALSE);
|
||||
str.format("%03d%6s", num, (const char*) app);
|
||||
aggiorna_marker(str,14);
|
||||
}
|
||||
|
||||
apri_file_temp();
|
||||
@ -103,13 +136,21 @@ bool TInv_cont::main_loop()
|
||||
if (!invio_tempfile(msk))
|
||||
return FALSE;
|
||||
|
||||
calcola_totale_record();
|
||||
str.format("%06ld", _tot_rec);
|
||||
aggiorna_marker(str,23);
|
||||
// calcola_totale_record();
|
||||
// str.format("%06ld", _tot_rec);
|
||||
|
||||
if (_scelta == 'S')
|
||||
{
|
||||
invio_contabilita(); //Costruisce il trasfer nella directory comune
|
||||
{
|
||||
// aggiorna_marker(str,23);
|
||||
|
||||
_trasf = "";
|
||||
_trasf = firm2dir(0);
|
||||
_trasf << "\\trasfer";
|
||||
fremove(_trasf);
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
// if (std != "D")
|
||||
invio_contabilita(); //Costruisce il trasfer nella directory comune
|
||||
|
||||
TMask mask ("cg6900b");
|
||||
KEY k;
|
||||
@ -160,6 +201,8 @@ bool TInv_cont::main_loop()
|
||||
else
|
||||
if (_scelta == 'P')
|
||||
{
|
||||
aggiorna_marker(str,24);
|
||||
|
||||
TMask mask ("cg6900b");
|
||||
KEY k;
|
||||
|
||||
@ -392,7 +435,7 @@ bool TInv_cont::esiste_tabella_studio()
|
||||
return error_box("Codice STUDIO NON ATTIVATO in tabella invii");
|
||||
else
|
||||
{
|
||||
_nome_simbolico = ins.get("CODTAB");
|
||||
_nome_simbolico = ins.get("S0");
|
||||
long ditta = ins.get_long("I0");
|
||||
if (ditta != 0)
|
||||
{
|
||||
@ -483,7 +526,7 @@ bool TInv_cont::controlli()
|
||||
|
||||
bool TInv_cont::sub_controlli()
|
||||
{
|
||||
long ditta_trasfer = atol(_control_rec.sub(25,29));
|
||||
long ditta_trasfer = _tras_file.ditta();
|
||||
|
||||
if (_ditta == ditta_trasfer)
|
||||
{
|
||||
@ -598,16 +641,16 @@ void TInv_cont::codifica_ditta(TMask& m)
|
||||
bool TInv_cont::setta_maschera_hnd(TMask_field& f, KEY k)
|
||||
{
|
||||
if ( (k == K_TAB || k == K_ENTER) && f.mask().is_running())
|
||||
{
|
||||
{
|
||||
app()._ditta = f.mask().get_long(F_DITTAINV);
|
||||
if (!app().tabella_ditta())
|
||||
return error_box("La ditta indicata non e' presente sulla tabella ditta per invio");
|
||||
|
||||
if (!prefix().exist(app()._ditta))
|
||||
return error_box("La ditta indicata non e' abilitata alla contabilita'");
|
||||
|
||||
if (!app().tabella_ditta())
|
||||
return error_box("La ditta indicata non e' presente sulla tabella ditta per invio");
|
||||
|
||||
if (app()._stato != "")
|
||||
return error_box("Lo stato ultimo trasferimento non puo' essere significativo");
|
||||
return error_box("Rilevato STATO DI RIPARTENZA NON RECUPERABILE sulla ditta richiesta");
|
||||
|
||||
f.mask().set(F_DITTAINV, app()._ditta);
|
||||
app().codifica_ditta(f.mask());
|
||||
@ -620,7 +663,7 @@ bool TInv_cont::setta_maschera_hnd(TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
void TInv_cont::crea_marker(TMask& m)
|
||||
{
|
||||
{
|
||||
TString str;
|
||||
|
||||
_marker = "";
|
||||
@ -635,19 +678,40 @@ void TInv_cont::crea_marker(TMask& m)
|
||||
|
||||
if ( (i = fopen(_marker,"w+t")) != NULL)
|
||||
{
|
||||
str = format("%-10s", (const char*) _nome_simbolico);
|
||||
buffer.overwrite(str,0);
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
str = format("%04d", ditta);
|
||||
buffer.overwrite(str,10);
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
num++;
|
||||
str = format("%03d", num);
|
||||
buffer.overwrite(str,14);
|
||||
TString data (m.get(F_DATALIM));
|
||||
str = riconverti(data);
|
||||
buffer.overwrite(str,17);
|
||||
|
||||
if (_scelta == 'S')
|
||||
{
|
||||
str = format("%-10s", (const char*) _nome_simbolico);
|
||||
buffer.overwrite(str,0);
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
str = format("%04d", ditta);
|
||||
buffer.overwrite(str,10);
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
num++;
|
||||
str = format("%03d", num);
|
||||
buffer.overwrite(str,14);
|
||||
TString data (m.get(F_DATALIM));
|
||||
str = riconverti(data,FALSE);
|
||||
buffer.overwrite(str,17);
|
||||
}
|
||||
else
|
||||
if (_scelta == 'P')
|
||||
{
|
||||
str = format("%-10s", (const char*) _nome_simbolico);
|
||||
buffer.overwrite(str,0);
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
str = format("%05d", ditta);
|
||||
buffer.overwrite(str,10);
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
num++;
|
||||
str = format("%03d", num);
|
||||
buffer.overwrite(str,15);
|
||||
TString data (m.get(F_DATALIM));
|
||||
str = riconverti(data,FALSE);
|
||||
buffer.overwrite(str,18);
|
||||
}
|
||||
|
||||
buffer.cut(64); //Sicurezza: le stringhe dimensionate in realta' sono
|
||||
//leggermente piu' lunghe della dimensione specificata
|
||||
const word scritti = fwrite((char*)(const char*)buffer,sizeof(char),size,i);
|
||||
|
||||
fclose(i);
|
||||
@ -672,6 +736,9 @@ void TInv_cont::aggiorna_marker(TString& token, int pos)
|
||||
{
|
||||
const word letti = fread((char*)(const char*)buffer,sizeof(char),size,i);
|
||||
buffer.overwrite(token,pos);
|
||||
|
||||
buffer.cut(64); //Sicurezza: le stringhe dimensionate in realta' sono
|
||||
//leggermente piu' lunghe della dimensione specificata
|
||||
fseek(i, 0L, SEEK_SET);
|
||||
const word scritti = fwrite((char*)(const char*)buffer,sizeof(char),size,i);
|
||||
|
||||
@ -684,16 +751,17 @@ void TInv_cont::calcola_totale_record()
|
||||
_tras_file.open(_header);
|
||||
leggi_record_controllo();
|
||||
|
||||
TString sigle = _control_rec.sub(38,47);
|
||||
TString sigle = _tras_file.sigle_file();
|
||||
sigle.trim();
|
||||
|
||||
_tot_rec = 0;
|
||||
|
||||
for (int i = 0; i < sigle.len(); i++)
|
||||
{
|
||||
long tot_rec = atol(_control_rec.mid((i * 6) + 47,6));
|
||||
long tot_rec = atol(_control_rec.mid((i * 6) + 50,6));
|
||||
_tot_rec += tot_rec;
|
||||
}
|
||||
}
|
||||
_tot_rec += 1;
|
||||
}
|
||||
|
||||
void TInv_cont::setta_tabella_studio(TMask& m,bool flag_ditta)
|
||||
@ -707,7 +775,7 @@ void TInv_cont::setta_tabella_studio(TMask& m,bool flag_ditta)
|
||||
else
|
||||
ditta = 0;
|
||||
|
||||
dep.format("%-10s", (const char*) _nome_simbolico);
|
||||
dep.format("%-3s", (const char*) "INS");
|
||||
|
||||
ins.zero();
|
||||
ins.put("CODTAB", dep);
|
||||
@ -768,23 +836,27 @@ void TInv_cont::crea_record_controllo(TMask& m)
|
||||
buffer.overwrite(str,15); //Nome studio
|
||||
|
||||
long ditta = m.get_long(F_DITTAINV);
|
||||
str = format("%04d", ditta);
|
||||
str = format("%05d", ditta);
|
||||
buffer.overwrite(str,25); //Ditta inviante
|
||||
|
||||
int num = m.get_int(F_NUMULINV);
|
||||
num++;
|
||||
str = format("%03d", num);
|
||||
buffer.overwrite(str,29); //Numero progr. invio
|
||||
buffer.overwrite(str,30); //Numero progr. invio
|
||||
|
||||
TString data (m.get(F_DATALIM));
|
||||
str = riconverti(data);
|
||||
buffer.overwrite(str,32); //Data limite invio
|
||||
str = riconverti(data,TRUE);
|
||||
buffer.overwrite(str,33); //Data limite invio
|
||||
|
||||
str = format("%-9s", (const char*) _files);
|
||||
buffer.overwrite(str,38);
|
||||
buffer.overwrite(str,41);
|
||||
|
||||
str = _files.sub(0,1);
|
||||
buffer.overwrite(str,240);
|
||||
buffer.overwrite(str,240);
|
||||
|
||||
str = "";
|
||||
str.format("%054d", 0);
|
||||
buffer.overwrite(str,50);
|
||||
|
||||
if (!_tras_file.write_control_rec(buffer, size))
|
||||
warning_box("Il record di controllo del file trasfer non e' stato aggiornato correttamente");
|
||||
@ -826,7 +898,7 @@ bool TInv_cont::invio_tempfile(TMask& m)
|
||||
posiz = _files.find(uselab); //Ritorna la posizione della sigla all'interno della schiera
|
||||
key = _tras_file.key();
|
||||
key.trim();
|
||||
nrec = _control_rec.sub(47,101);
|
||||
nrec = _tras_file.nrec_file();
|
||||
|
||||
for (i = posiz; i < _files.len();i++)
|
||||
{
|
||||
@ -867,6 +939,9 @@ bool TInv_cont::invio_tempfile(TMask& m)
|
||||
_control_rec.overwrite(" ",240);
|
||||
_tras_file.write_control_rec(_control_rec,256);
|
||||
_tras_file.close();
|
||||
|
||||
setta_tabella_ditta(m,"D",FALSE);
|
||||
setta_parametri_record(m,"D");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -923,16 +998,6 @@ void TInv_cont::causali2tempfile(TString& key, TMask& m)
|
||||
_control_rec.overwrite("W",240);
|
||||
_control_rec.overwrite(chiave,241);
|
||||
|
||||
long numrec;
|
||||
|
||||
TString stringa;
|
||||
int posiz = _files.find("W");
|
||||
stringa = _control_rec.mid( (posiz * 6) + 47, 6);
|
||||
numrec = atol(stringa);
|
||||
numrec++;
|
||||
stringa = "";
|
||||
stringa.format("%06ld", numrec);
|
||||
_control_rec.overwrite(stringa,((posiz * 6) + 47));
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
}
|
||||
delete _prog;
|
||||
@ -956,8 +1021,8 @@ void TInv_cont::causali2tempfile(TString& key, TMask& m)
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
|
||||
setta_tabella_ditta(m,"D",FALSE);
|
||||
setta_parametri_record(m,"D");
|
||||
// setta_tabella_ditta(m,"D",FALSE);
|
||||
// setta_parametri_record(m,"D");
|
||||
}
|
||||
|
||||
void TInv_cont::cancella_righe_causali(TString& codcaus)
|
||||
@ -1053,17 +1118,6 @@ void TInv_cont::clifo2tempfile(TString& key, TMask& m)
|
||||
_control_rec.overwrite(sigla,240);
|
||||
_control_rec.overwrite(chiave,241);
|
||||
|
||||
long numrec;
|
||||
|
||||
TString stringa;
|
||||
int posiz = _files.find("A");
|
||||
stringa = _control_rec.mid( (posiz * 6) + 47, 6);
|
||||
numrec = atol(stringa);
|
||||
numrec++;
|
||||
stringa = "";
|
||||
stringa.format("%06ld", numrec);
|
||||
_control_rec.overwrite(stringa,((posiz * 6) + 47));
|
||||
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
}
|
||||
delete _prog;
|
||||
@ -1087,8 +1141,8 @@ void TInv_cont::clifo2tempfile(TString& key, TMask& m)
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
|
||||
setta_tabella_ditta(m,"D",FALSE);
|
||||
setta_parametri_record(m,"D");
|
||||
// setta_tabella_ditta(m,"D",FALSE);
|
||||
// setta_parametri_record(m,"D");
|
||||
}
|
||||
|
||||
|
||||
@ -1150,17 +1204,6 @@ void TInv_cont::pcon2tempfile(TString& key, TMask& m)
|
||||
_control_rec.overwrite(sigla,240);
|
||||
_control_rec.overwrite(chiave,241);
|
||||
|
||||
long numrec;
|
||||
|
||||
TString stringa;
|
||||
int posiz = _files.find("P");
|
||||
stringa = _control_rec.mid( (posiz * 6) + 47, 6);
|
||||
numrec = atol(stringa);
|
||||
numrec++;
|
||||
stringa = "";
|
||||
stringa.format("%06ld", numrec);
|
||||
_control_rec.overwrite(stringa,((posiz * 6) + 47));
|
||||
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
}
|
||||
delete _prog;
|
||||
@ -1184,8 +1227,8 @@ void TInv_cont::pcon2tempfile(TString& key, TMask& m)
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
|
||||
setta_tabella_ditta(m,"D",FALSE);
|
||||
setta_parametri_record(m,"D");
|
||||
// setta_tabella_ditta(m,"D",FALSE);
|
||||
// setta_parametri_record(m,"D");
|
||||
}
|
||||
|
||||
void TInv_cont::primanota_inviata(long numreg)
|
||||
@ -1221,20 +1264,6 @@ void TInv_cont::scrivi_righePN(long numreg)
|
||||
_trmov->zero();
|
||||
_trmov->curr() = _rmov->curr();
|
||||
_trmov->write();
|
||||
|
||||
_tras_file.read_control_rec();
|
||||
|
||||
long numrec;
|
||||
|
||||
TString stringa;
|
||||
int posiz = _files.find("Z");
|
||||
stringa = _control_rec.mid( (posiz * 6) + 47, 6);
|
||||
numrec = atol(stringa);
|
||||
numrec++;
|
||||
stringa = "";
|
||||
stringa.format("%06ld", numrec);
|
||||
_control_rec.overwrite(stringa,((posiz * 6) + 47));
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1319,8 +1348,8 @@ void TInv_cont::movPN2tempfile(TString& key, TMask& m)
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
|
||||
setta_tabella_ditta(m,"D",FALSE);
|
||||
setta_parametri_record(m,"D");
|
||||
// setta_tabella_ditta(m,"D",FALSE);
|
||||
// setta_parametri_record(m,"D");
|
||||
}
|
||||
|
||||
bool TInv_cont::occasionali(const TString& cfpi)
|
||||
@ -1442,17 +1471,6 @@ void TInv_cont::movIVA2tempfile(TString& key, TMask& m)
|
||||
_control_rec.overwrite(sigla,240);
|
||||
_control_rec.overwrite(chiave,241);
|
||||
|
||||
long numrec;
|
||||
|
||||
TString stringa;
|
||||
int posiz = _files.find("U");
|
||||
stringa = _control_rec.mid( (posiz * 6) + 47, 6);
|
||||
numrec = atol(stringa);
|
||||
numrec++;
|
||||
stringa = "";
|
||||
stringa.format("%06ld", numrec);
|
||||
_control_rec.overwrite(stringa,((posiz * 6) + 47));
|
||||
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
|
||||
if (nreg != nreg_p)
|
||||
@ -1481,8 +1499,8 @@ void TInv_cont::movIVA2tempfile(TString& key, TMask& m)
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
|
||||
setta_tabella_ditta(m,"D",FALSE);
|
||||
setta_parametri_record(m,"D");
|
||||
// setta_tabella_ditta(m,"D",FALSE);
|
||||
// setta_parametri_record(m,"D");
|
||||
}
|
||||
|
||||
bool TInv_cont::menu(MENU_TAG m)
|
||||
|
13
cg/cg6900.h
13
cg/cg6900.h
@ -67,7 +67,8 @@ class TInv_cont : public TApplication
|
||||
TString _ocfpi, _ragsococc, _indocc, _capocc, _localocc, _provocc, _codvali;
|
||||
bool _esiste_ditta, _esiste_record, _inviato, _flag_bollato;
|
||||
long _ditta, _protiva, _uprotiva, _codcf, _numrec, _tot_rec;
|
||||
long _dim_tot, _dim_disk;
|
||||
long _dim_tot, _dim_disk;
|
||||
long _numrec_cau,_numrec_clifo,_numrec_pcon,_numrec_pn,_numrec_iva;
|
||||
int _num,_annoes;
|
||||
TDate _data, _datadoc, _data74ter,_datalimsk,_dataregiva,_datareg;
|
||||
real _corrlire, _cambioi, _corrval;
|
||||
@ -94,6 +95,7 @@ public:
|
||||
void codifica_ditta (TMask& m);
|
||||
void testata_mov_PN ();
|
||||
void testata_trasfer(long nreg, int nrig, TString& record);
|
||||
void sola_iva(TString& record);
|
||||
bool testata_mov_IVA(long numreg);
|
||||
void cerca_occasionale();
|
||||
void cerca_comune_occas(const TString& com);
|
||||
@ -128,19 +130,24 @@ public:
|
||||
bool invio_pcon ();
|
||||
bool invio_mov_PN ();
|
||||
bool invio_mov_IVA();
|
||||
|
||||
void aggiorna_header(TString& files);
|
||||
void aggiorna_trasfer(TString& files);
|
||||
|
||||
void negPC2negAS(TString& numero);
|
||||
void dec2integer(real& val, long dec);
|
||||
|
||||
void aggiorna_marker(TString& token, int pos);
|
||||
void calcola_totale_record();
|
||||
void scrivi_telefono(TString& app);
|
||||
|
||||
const char* cerca_provincia(const TString& comcf);
|
||||
|
||||
static bool setta_maschera_hnd(TMask_field& f, KEY k);
|
||||
|
||||
static bool messaggio_hnd (TMask_field& f, KEY k);
|
||||
|
||||
int calcola_numero_dischi(TMask& m);
|
||||
FILE* chiedi_disco(const char* name, int disk, char floppy, bool lettura);
|
||||
long determina_dimensione(FILE* f);
|
||||
bool scrivi_disco(char floppy, int disk, const char* work, FILE* i, TProgind& w);
|
||||
|
||||
TInv_cont(char mov);
|
||||
|
@ -18,7 +18,7 @@ END
|
||||
NUMBER F_NUMULINV 3
|
||||
BEGIN
|
||||
PROMPT 2 4 "Numero ultimo invio "
|
||||
FLAGS "R"
|
||||
FLAGS "RG"
|
||||
END
|
||||
|
||||
DATE F_DATAULIN
|
||||
|
265
cg/cg6901.cpp
265
cg/cg6901.cpp
@ -16,6 +16,16 @@ bool TLista_archivi::create()
|
||||
|
||||
_errore_grave = FALSE;
|
||||
_risposta = 0;
|
||||
|
||||
TMailbox m;
|
||||
TMessage* msg = m.next_s("");
|
||||
TString subj;
|
||||
|
||||
if (msg != NULL)
|
||||
{
|
||||
subj = msg->body();
|
||||
_datalimite = subj;
|
||||
}
|
||||
|
||||
dispatch_e_menu (BAR_ITEM(1));
|
||||
|
||||
@ -29,7 +39,7 @@ bool TLista_archivi::destroy()
|
||||
if (_risposta == 1)
|
||||
message_box("Rilevati errori gravi durante il controllo archivi: \n trasferimento interrotto");
|
||||
|
||||
TString appname = "cg2b -8 S";
|
||||
TString appname = "cg6 -8 S";
|
||||
TString body = "";
|
||||
|
||||
body << _risposta;
|
||||
@ -91,11 +101,13 @@ bool TLista_archivi::set()
|
||||
//****************************************
|
||||
//****** Apro la finestra di stampa ******
|
||||
//****************************************
|
||||
|
||||
printer().set_printtype(winprinter);
|
||||
|
||||
if (!(printer().isopen ()))
|
||||
if (!printer().open ())
|
||||
return FALSE;
|
||||
|
||||
printer().set_printtype(screenvis);
|
||||
//****************************************
|
||||
|
||||
_ditta = get_firm();
|
||||
@ -105,7 +117,6 @@ bool TLista_archivi::set()
|
||||
if (_ditte->read() == NOERR)
|
||||
_ragsoc = _ditte->get(NDT_RAGSOC);
|
||||
|
||||
|
||||
if (!tabella_ditta()) return FALSE;
|
||||
|
||||
if (_files.find('W') != -1)
|
||||
@ -117,7 +128,7 @@ bool TLista_archivi::set()
|
||||
if (_files.find('P') != -1)
|
||||
controlla_pcon('P');
|
||||
|
||||
if (_files.find('Z') != -1 || _files.find('U'))
|
||||
if (_files.find('Z') != -1)
|
||||
controlla_PNIVA('Z');
|
||||
|
||||
if (_files.find('B') != -1)
|
||||
@ -293,7 +304,7 @@ void TLista_archivi::controlla_clifo(char file)
|
||||
stampa.add(" - Rilevata partita IVA con piu' di 11 caratteri");
|
||||
}
|
||||
|
||||
TString ptel = _clifo->get(CLI_PTEL);
|
||||
/* TString ptel = _clifo->get(CLI_PTEL);
|
||||
TString tel = _clifo->get(CLI_TEL);
|
||||
TString appoggio;
|
||||
appoggio << ptel << " " << tel;
|
||||
@ -302,7 +313,7 @@ void TLista_archivi::controlla_clifo(char file)
|
||||
errore = TRUE;
|
||||
stampa.add(" - Rilevato numero telefonico troppo lungo");
|
||||
}
|
||||
|
||||
*/
|
||||
int gruppo = _clifo->get_int(CLI_GRUPPORIC);
|
||||
int conto = _clifo->get_int(CLI_CONTORIC);
|
||||
|
||||
@ -336,7 +347,7 @@ void TLista_archivi::controlla_clifo(char file)
|
||||
}
|
||||
|
||||
str << "@b- Codice ";
|
||||
app.format("%c %06d", tipo, codice);
|
||||
app.format("%c %06ld", tipo, codice);
|
||||
str << app;
|
||||
|
||||
row.put(str,0);
|
||||
@ -447,24 +458,30 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
TPrintrow row;
|
||||
TString str;
|
||||
bool errore = FALSE;
|
||||
bool salto = FALSE;
|
||||
bool intesta = TRUE;
|
||||
bool errore = FALSE;
|
||||
bool salto = FALSE;
|
||||
bool intesta = TRUE;
|
||||
bool tit_riga = FALSE;
|
||||
TString_array stampa(50);
|
||||
int num;
|
||||
long nreg_p = 0;
|
||||
|
||||
_mov->setkey(1);
|
||||
_mov->zero();
|
||||
|
||||
for (_mov->first(); !_mov->eof(); _mov->next())
|
||||
{
|
||||
|
||||
long nreg = _mov->get_long(MOV_NUMREG);
|
||||
bool inviato = _mov->get_bool(MOV_INVIATO);
|
||||
bool inviva = _mov->get_bool(MOV_INVIVA);
|
||||
bool soliva = TRUE;
|
||||
|
||||
long nreg = _mov->get_long(MOV_NUMREG);
|
||||
TDate datareg = _mov->get_date(MOV_DATAREG);
|
||||
bool inviato = _mov->get_bool(MOV_INVIATO);
|
||||
bool inviva = _mov->get_bool(MOV_INVIVA);
|
||||
|
||||
if (inviato && inviva) continue; //Se il movimento e' gia' stato inviato non lo posso piu' inviare
|
||||
//cosi' come le sue righe di primanota e iva
|
||||
|
||||
if (datareg > _datalimite) continue;
|
||||
|
||||
if (nreg > 999999)
|
||||
{
|
||||
@ -495,6 +512,8 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
}
|
||||
|
||||
num = 0;
|
||||
|
||||
bool prima = TRUE;
|
||||
|
||||
_rmov->setkey(1);
|
||||
_rmov->zero();
|
||||
@ -503,11 +522,14 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
TRectype rmov (_rmov->curr());
|
||||
|
||||
for (_rmov->read(); !_rmov->eof(); _rmov->next())
|
||||
{
|
||||
bool tit_riga = FALSE;
|
||||
{
|
||||
|
||||
if (_rmov->curr() > rmov) break;
|
||||
|
||||
tit_riga = FALSE;
|
||||
|
||||
soliva = FALSE;
|
||||
|
||||
num++;
|
||||
|
||||
if (num > 99)
|
||||
@ -523,10 +545,17 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
int cc = _rmov->get_int (RMV_CONTOC);
|
||||
|
||||
if (nr > 99)
|
||||
{
|
||||
{
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
app.format("%11s%03d", (const char*)"@b - Riga P ", nr);
|
||||
TString app;
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato numero di riga con piu' di due cifre";
|
||||
stampa.add(app);
|
||||
tit_riga = TRUE;
|
||||
@ -536,11 +565,18 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un gruppo di partita composto da 3 cifre";
|
||||
app << "@r Rilevato un gruppo di partita composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga P ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un gruppo di partita composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
@ -551,11 +587,18 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un conto di partita composto da 3 cifre";
|
||||
app << "@r Rilevato un conto di partita composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("11s%03d", (const char*)"@b - Riga P ", nr);
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un conto di partita composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
@ -565,11 +608,18 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un gruppo di contropartita composto da 3 cifre";
|
||||
app << "@r Rilevato un gruppo di contropartita composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga P ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un gruppo di contropartita composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
@ -580,31 +630,106 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un conto di contropartita composto da 3 cifre";
|
||||
app << "@r Rilevato un conto di contropartita composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga P ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un conto di contropartita composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
}
|
||||
}
|
||||
|
||||
if (soliva)
|
||||
{
|
||||
TLocalisamfile rcaus (LF_RCAUSALI);
|
||||
int g = 0;
|
||||
int c = 0;
|
||||
bool tit_riga = FALSE;
|
||||
bool prima = TRUE;
|
||||
int nr = 1;
|
||||
|
||||
rcaus.setkey(1);
|
||||
rcaus.zero();
|
||||
rcaus.put(RCA_CODCAUS, codcaus);
|
||||
rcaus.read();
|
||||
TString codcau = rcaus.get(RCA_CODCAUS);
|
||||
if (codcau == codcaus)
|
||||
{
|
||||
g = rcaus.get_int (RCA_GRUPPO);
|
||||
c = rcaus.get_int (RCA_CONTO);
|
||||
}
|
||||
|
||||
|
||||
if (g > 99)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un gruppo di partita composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un gruppo di partita composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
tit_riga = TRUE;
|
||||
}
|
||||
|
||||
if (c > 99)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe primanota");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un conto di partita composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un conto di partita composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
}
|
||||
}
|
||||
|
||||
num = 0;
|
||||
|
||||
if (_files.find('U') != -1)
|
||||
{
|
||||
nreg_p = 0;
|
||||
_rmoviva->setkey(1);
|
||||
_rmoviva->zero();
|
||||
_rmoviva->put(RMI_NUMREG, nreg);
|
||||
|
||||
TRectype rmoviva (_rmoviva->curr());
|
||||
|
||||
prima = TRUE;
|
||||
|
||||
for (_rmoviva->read(); !_rmoviva->eof(); _rmoviva->next())
|
||||
{
|
||||
bool tit_riga = FALSE;
|
||||
|
||||
if (_rmoviva->curr() > rmoviva) break;
|
||||
|
||||
|
||||
num++;
|
||||
|
||||
if (num > 9)
|
||||
@ -620,8 +745,15 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
if (nr > 99)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
app.format("%11s%03d", (const char*)"@b - Riga I ", nr);
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe iva");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato numero di riga con piu' di due cifre";
|
||||
stampa.add(app);
|
||||
tit_riga = TRUE;
|
||||
@ -631,11 +763,18 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe iva");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un gruppo composto da 3 cifre";
|
||||
app << "@r Rilevato un gruppo composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga I ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un gruppo composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
@ -646,11 +785,18 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe iva");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un conto composto da 3 cifre";
|
||||
app << "@r Rilevato un conto composto da 3 cifre";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga I ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un conto composto da 3 cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
@ -660,11 +806,18 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe iva");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un codice IVA alfanumerico";
|
||||
app << "@r Rilevato un codice IVA alfanumerico";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga I ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un codice IVA alfanumerico";
|
||||
}
|
||||
stampa.add(app);
|
||||
@ -675,18 +828,26 @@ void TLista_archivi::controlla_PNIVA(char file)
|
||||
{
|
||||
errore = TRUE;
|
||||
TString app;
|
||||
if (prima)
|
||||
{
|
||||
stampa.add(" ");
|
||||
stampa.add("Righe iva");
|
||||
stampa.add(" ");
|
||||
prima = FALSE;
|
||||
}
|
||||
if (tit_riga)
|
||||
app << "@r Rilevato un codice IVA composto da 3 o piu' cifre";
|
||||
app << "@r Rilevato un codice IVA composto da 3 o piu' cifre";
|
||||
else
|
||||
{
|
||||
app.format("%11s%03d", (const char*)"@b - Riga I ", nr);
|
||||
{
|
||||
app.format("%5s%03d", (const char*)"@b - ", nr);
|
||||
app << " " << "@rRilevato un codice IVA composto da 3 o piu' cifre";
|
||||
}
|
||||
stampa.add(app);
|
||||
tit_riga = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (errore)
|
||||
{
|
||||
TString app;
|
||||
@ -740,19 +901,19 @@ void TLista_archivi::setta_intestazione(char sigla)
|
||||
switch (sigla)
|
||||
{
|
||||
case 'W':
|
||||
titolo = "Archivio Causali e Righe Causali";
|
||||
titolo = "Tabella Causali";
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
titolo = "Archivio Clienti / Fornitori";
|
||||
titolo = "Anagrafica Clienti/Fornitori";
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
titolo = "Archivio Piano dei Conti";
|
||||
titolo = "Anagrafica Piano dei Conti";
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
titolo = "Archivio Movimenti";
|
||||
titolo = "Movimenti";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -28,6 +28,7 @@ class TLista_archivi : public TApplication
|
||||
TLocalisamfile* _rmoviva;
|
||||
|
||||
TString _files, _ragsoc;
|
||||
TDate _datalimite;
|
||||
long _ditta;
|
||||
bool _errore_grave;
|
||||
int _risposta;
|
||||
|
321
cg/cg6902.cpp
321
cg/cg6902.cpp
@ -25,15 +25,6 @@ FILE* TInv_cont::chiedi_disco(const char* name, int disk, char floppy, bool lett
|
||||
return f;
|
||||
}
|
||||
|
||||
long TInv_cont::determina_dimensione(FILE* f)
|
||||
{
|
||||
CHECK(f, "Can't measure NULL file");
|
||||
fseek(f, 0, SEEK_END);
|
||||
const long s = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
return s;
|
||||
}
|
||||
|
||||
bool TInv_cont::scrivi_disco(char floppy, int disk, const char* work,
|
||||
FILE* i, TProgind& w)
|
||||
{
|
||||
@ -87,7 +78,7 @@ int TInv_cont::calcola_numero_dischi(TMask& msk)
|
||||
FILE* t = fopen(_trasf, "rb");
|
||||
if (t == NULL) return error_box("Impossibile aprire il file '%s'", _trasf);
|
||||
|
||||
long dim_t = determina_dimensione(t); //Determina la dimensione del trasfer
|
||||
long dim_t = _tras_file.determina_dimensione(t); //Determina la dimensione del trasfer
|
||||
fclose(t);
|
||||
|
||||
// FILE* h = fopen(_header, "rb");
|
||||
@ -99,7 +90,7 @@ int TInv_cont::calcola_numero_dischi(TMask& msk)
|
||||
FILE* m = fopen(_marker, "rb");
|
||||
if (m == NULL) return error_box("Impossibile aprire il file '%s'", _marker);
|
||||
|
||||
long dim_m = determina_dimensione(m); // Determina la dimensione del marker
|
||||
long dim_m = _tras_file.determina_dimensione(m); // Determina la dimensione del marker
|
||||
fclose(m);
|
||||
|
||||
_dim_tot = dim_t + dim_m; //+dim_h; // Determina la dimensione totale
|
||||
@ -143,28 +134,34 @@ bool TInv_cont::invio_contabilita()
|
||||
bool header = TRUE;
|
||||
int size = 256;
|
||||
|
||||
_numrec_cau = 0;
|
||||
_numrec_clifo = 0;
|
||||
_numrec_pcon = 0;
|
||||
_numrec_pn = 0;
|
||||
_numrec_iva = 0;
|
||||
|
||||
_tras_file.open(_header);
|
||||
|
||||
leggi_record_controllo();
|
||||
|
||||
files = _control_rec.sub(38,47);
|
||||
nrec = _control_rec.sub(47,101);
|
||||
files = _tras_file.sigle_file();
|
||||
nrec = _tras_file.nrec_file();
|
||||
files.trim();
|
||||
|
||||
_tras_file.close();
|
||||
|
||||
_trasf = "";
|
||||
_trasf = firm2dir(0);
|
||||
_trasf << "\\trasfer";
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
for (int i = 0; i < files.len();i++)
|
||||
{
|
||||
sigla = files[i];
|
||||
_numrec = atol(nrec.mid(i * 6,6));
|
||||
//_numrec = atol(nrec.mid(i * 6,6));
|
||||
|
||||
if (header)
|
||||
{
|
||||
{
|
||||
TString app1 = _control_rec.mid(0,25);
|
||||
TString app2 = _control_rec.mid(26,7);
|
||||
TString app3 = _control_rec.mid(35);
|
||||
_control_rec = app1 << app2 << app3;
|
||||
_control_rec.insert(" ",232);
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
header = FALSE;
|
||||
}
|
||||
@ -173,7 +170,7 @@ bool TInv_cont::invio_contabilita()
|
||||
{
|
||||
case 'W':
|
||||
if (!invio_tab_cau())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
@ -188,29 +185,163 @@ bool TInv_cont::invio_contabilita()
|
||||
|
||||
case 'Z':
|
||||
if (!invio_mov_PN())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
if (!invio_mov_IVA())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
aggiorna_header(files);
|
||||
aggiorna_trasfer(files);
|
||||
|
||||
TString str;
|
||||
|
||||
calcola_totale_record();
|
||||
str.format("%06ld", _tot_rec);
|
||||
aggiorna_marker(str,23);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TInv_cont::aggiorna_header(TString& files)
|
||||
{
|
||||
char sigla;
|
||||
int size = 256;
|
||||
|
||||
_tras_file.open(_header);
|
||||
leggi_record_controllo();
|
||||
|
||||
for (int i = 0; i < files.len();i++)
|
||||
{
|
||||
sigla = files[i];
|
||||
|
||||
switch (sigla)
|
||||
{
|
||||
case 'W':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_cau);
|
||||
_control_rec.overwrite(app,((i * 6) + 50));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_clifo);
|
||||
_control_rec.overwrite(app,((i * 6) + 50));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_pcon);
|
||||
_control_rec.overwrite(app,((i * 6) + 50));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_pn);
|
||||
_control_rec.overwrite(app,((i * 6) + 50));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_iva);
|
||||
_control_rec.overwrite(app,((i * 6) + 50));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
}
|
||||
|
||||
void TInv_cont::aggiorna_trasfer(TString& files)
|
||||
{
|
||||
char sigla;
|
||||
int size = 256;
|
||||
|
||||
_tras_file.open(_trasf);
|
||||
leggi_record_controllo();
|
||||
|
||||
for (int i = 0; i < files.len();i++)
|
||||
{
|
||||
sigla = files[i];
|
||||
|
||||
switch (sigla)
|
||||
{
|
||||
case 'W':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_cau);
|
||||
_control_rec.overwrite(app,((i * 6) + 47));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_clifo);
|
||||
_control_rec.overwrite(app,((i * 6) + 47));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_pcon);
|
||||
_control_rec.overwrite(app,((i * 6) + 47));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_pn);
|
||||
_control_rec.overwrite(app,((i * 6) + 47));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
{
|
||||
TString app;
|
||||
app.format("%06ld", _numrec_iva);
|
||||
_control_rec.overwrite(app,((i * 6) + 47));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
_tras_file.write_control_rec(_control_rec,size);
|
||||
_tras_file.close();
|
||||
}
|
||||
|
||||
bool TInv_cont::invio_tab_cau()
|
||||
{
|
||||
int size = 256;
|
||||
TString record(size);
|
||||
TString cod;
|
||||
|
||||
|
||||
long cicli = _tcaus->items();
|
||||
_prog = new TProgind(cicli,"Invio tabella causali in corso... Prego attendere.",FALSE);
|
||||
_prog = new TProgind(cicli,"Tabella Causali: generazione file TRASFER per Sistema\nPrego attendere.",FALSE);
|
||||
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
@ -294,6 +425,7 @@ bool TInv_cont::invio_tab_cau()
|
||||
record.overwrite("X",249);
|
||||
else //Autofattura art.34
|
||||
record.overwrite(" ",249);
|
||||
|
||||
|
||||
int num = 0;
|
||||
int pos_gcs = 41;
|
||||
@ -352,7 +484,7 @@ bool TInv_cont::invio_tab_cau()
|
||||
}
|
||||
while (num < 15);
|
||||
|
||||
_numrec++;
|
||||
_numrec_cau++;
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
}
|
||||
@ -363,13 +495,48 @@ bool TInv_cont::invio_tab_cau()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TInv_cont::scrivi_telefono(TString& appoggio)
|
||||
{
|
||||
TString ptel;
|
||||
TString tel;
|
||||
|
||||
if (_tclifo->get(CLI_TEL).not_empty())
|
||||
{
|
||||
ptel = _tclifo->get(CLI_PTEL);
|
||||
tel = _tclifo->get(CLI_TEL);
|
||||
}
|
||||
else
|
||||
if (_tclifo->get(CLI_TEL2).not_empty())
|
||||
{
|
||||
ptel = _tclifo->get(CLI_PTEL2);
|
||||
tel = _tclifo->get(CLI_TEL2);
|
||||
}
|
||||
else
|
||||
if (_tclifo->get(CLI_TEL3).not_empty())
|
||||
{
|
||||
ptel = _tclifo->get(CLI_PTEL3);
|
||||
tel = _tclifo->get(CLI_TEL3);
|
||||
}
|
||||
|
||||
if (real::is_natural(ptel))
|
||||
{
|
||||
appoggio << ptel;
|
||||
if (ptel.not_empty())
|
||||
appoggio << "/" << tel;
|
||||
else
|
||||
appoggio << tel;
|
||||
}
|
||||
else
|
||||
appoggio << tel;
|
||||
}
|
||||
|
||||
bool TInv_cont::invio_clifo()
|
||||
{
|
||||
int size = 256;
|
||||
TString record(size);
|
||||
|
||||
long cicli = _tclifo->items();
|
||||
_prog = new TProgind(cicli,"Invio anagrafica Clienti / Fornitori in corso... Prego attendere.",FALSE);
|
||||
_prog = new TProgind(cicli,"Anagrafica Clienti/Fornitori: generazione file TRASFER per Sistema\nPrego attendere.",FALSE);
|
||||
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
@ -454,11 +621,17 @@ bool TInv_cont::invio_clifo()
|
||||
str.format("%-2s", (const char*) provincia);
|
||||
record.overwrite(str,153); //Provincia
|
||||
|
||||
TString ptel = _tclifo->get(CLI_PTEL);
|
||||
/* TString ptel = _tclifo->get(CLI_PTEL);
|
||||
TString tel = _tclifo->get(CLI_TEL);
|
||||
TString appoggio;
|
||||
appoggio << ptel << " " << tel;
|
||||
record.overwrite(appoggio,155);
|
||||
*/
|
||||
TString appoggio = "";
|
||||
scrivi_telefono(appoggio);
|
||||
appoggio.format("%-12s", (const char*) appoggio);
|
||||
appoggio.cut(12);
|
||||
record.overwrite(appoggio,155);
|
||||
|
||||
TString alleg = _tclifo->get(CLI_ALLEG);
|
||||
record.overwrite(alleg,167); //Flag gestione allegato
|
||||
@ -480,7 +653,7 @@ bool TInv_cont::invio_clifo()
|
||||
TString codpag = _tclifo->get(CLI_CODPAG);
|
||||
str.format("%-2s", (const char*) codpag);
|
||||
|
||||
_numrec++;
|
||||
_numrec_clifo++;
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
}
|
||||
@ -497,7 +670,7 @@ bool TInv_cont::invio_pcon()
|
||||
TString record(size);
|
||||
|
||||
long cicli = _tpcon->items();
|
||||
_prog = new TProgind(cicli,"Invio anagrafica Piano dei Conti in corso... Prego attendere.",FALSE);
|
||||
_prog = new TProgind(cicli,"Anagrafica Piano Conti: generazione file TRASFER per Sistema\nPrego attendere.",FALSE);
|
||||
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
@ -670,7 +843,7 @@ bool TInv_cont::invio_pcon()
|
||||
record.overwrite(str,72); //Numero arabo IV dir
|
||||
}
|
||||
|
||||
_numrec++;
|
||||
_numrec_pcon++;
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
}
|
||||
@ -690,7 +863,7 @@ void TInv_cont::testata_mov_PN()
|
||||
_reg = _tmov->get (MOV_REG);
|
||||
_codcausm = _tmov->get (MOV_CODCAUS);
|
||||
_codpag = _tmov->get (MOV_CODPAG);
|
||||
_tipodoc = _tmov->get (MOV_TIPODOC);
|
||||
// _tipodoc = _tmov->get (MOV_TIPODOC);
|
||||
_protiva = _tmov->get_long(MOV_PROTIVA);
|
||||
_uprotiva = _tmov->get_long(MOV_UPROTIVA);
|
||||
_inviato = _tmov->get_bool(MOV_INVIATO);
|
||||
@ -709,7 +882,7 @@ void TInv_cont::testata_trasfer(long nreg, int nrig, TString& record)
|
||||
record.overwrite(str,8); //Numero di riga
|
||||
|
||||
TString datastr = _datareg.string();
|
||||
str = riconverti(datastr);
|
||||
str = riconverti(datastr,FALSE);
|
||||
str.format("%06s", (const char*) str);
|
||||
record.overwrite(str,15); //Data di registrazione
|
||||
|
||||
@ -725,7 +898,7 @@ void TInv_cont::testata_trasfer(long nreg, int nrig, TString& record)
|
||||
record.overwrite(str,21); //Segnalino della competenza
|
||||
|
||||
TString datadocstr = _datadoc.string();
|
||||
str = riconverti(datadocstr);
|
||||
str = riconverti(datadocstr,FALSE);
|
||||
str.format("%06s", (const char*) str);
|
||||
record.overwrite(str,22); //Data documento
|
||||
|
||||
@ -754,9 +927,41 @@ void TInv_cont::testata_trasfer(long nreg, int nrig, TString& record)
|
||||
record.overwrite(str,95); //Codice di pagamento
|
||||
|
||||
str.format("%05d", _uprotiva);
|
||||
record.overwrite(str,108); //Ultimo numero di protocollo IVA
|
||||
|
||||
record.overwrite(_tipodoc,220); //Tipo documento
|
||||
record.overwrite(str,108); //Ultimo numero di protocollo IVA
|
||||
|
||||
record.overwrite("0",218); //Flag di solo sezionale
|
||||
}
|
||||
|
||||
void TInv_cont::sola_iva(TString& record)
|
||||
{
|
||||
TString str;
|
||||
TLocalisamfile rcaus (LF_RCAUSALI);
|
||||
int gruppo = 0;
|
||||
int conto = 0;
|
||||
long sottoc = 0;
|
||||
|
||||
rcaus.setkey(1);
|
||||
rcaus.zero();
|
||||
rcaus.put(RCA_CODCAUS, _codcausm);
|
||||
rcaus.read();
|
||||
TString codcau = rcaus.get(RCA_CODCAUS);
|
||||
if (codcau == _codcausm)
|
||||
{
|
||||
gruppo = rcaus.get_int (RCA_GRUPPO);
|
||||
conto = rcaus.get_int (RCA_CONTO);
|
||||
sottoc = _tmov->get_long(MOV_CODCF);
|
||||
}
|
||||
|
||||
str.format("%02d", gruppo);
|
||||
record.overwrite(str,74); //Gruppo di partita
|
||||
str.format("%02d", conto);
|
||||
record.overwrite(str,76); //Conto di partita
|
||||
str.format("%06ld", sottoc);
|
||||
record.overwrite(str,78); //Sottoconto di partita
|
||||
|
||||
record.overwrite("0000000000",85); //Sottoconto di contropartita
|
||||
|
||||
record.overwrite("00000000000",97); //Importo
|
||||
}
|
||||
|
||||
bool TInv_cont::invio_mov_PN()
|
||||
@ -766,7 +971,7 @@ bool TInv_cont::invio_mov_PN()
|
||||
bool almeno_una_riga = FALSE;
|
||||
|
||||
long cicli = _tmov->items();
|
||||
_prog = new TProgind(cicli,"Invio Movimenti di primanota in corso... Prego attendere.",FALSE);
|
||||
_prog = new TProgind(cicli,"Movimenti di Prima nota: generazione file TRASFER per Sistema\nPrego attendere.",FALSE);
|
||||
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
@ -792,6 +997,9 @@ bool TInv_cont::invio_mov_PN()
|
||||
{
|
||||
if (_trmov->curr() > trmov) break;
|
||||
|
||||
record = "";
|
||||
record.spaces();
|
||||
|
||||
almeno_una_riga = TRUE;
|
||||
|
||||
int nrig = _trmov->get_int (RMV_NUMRIG);
|
||||
@ -837,17 +1045,19 @@ bool TInv_cont::invio_mov_PN()
|
||||
str.format("%011s", (const char*) numero);
|
||||
record.overwrite(str,97); //Importo riga di movimento
|
||||
|
||||
TString tipoc = _trmov->get(RMV_TIPOC);
|
||||
record.overwrite(tipoc,219); //Flag cliente/fornitore
|
||||
// TString tipoc = _trmov->get(RMV_TIPOC);
|
||||
// record.overwrite(tipoc,219); //Flag cliente/fornitore
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
_numrec++;
|
||||
_numrec_pn++;
|
||||
}
|
||||
|
||||
if (!almeno_una_riga)
|
||||
{
|
||||
int nrig = 1;
|
||||
testata_trasfer(nreg,nrig,record);
|
||||
sola_iva(record);
|
||||
_numrec_pn++;
|
||||
_tras_file.write_control_rec(record,size);
|
||||
}
|
||||
else
|
||||
@ -932,7 +1142,7 @@ bool TInv_cont::invio_mov_IVA()
|
||||
nreg_p = -1;
|
||||
|
||||
long cicli = _triva->items();
|
||||
_prog = new TProgind(cicli,"Invio Movimenti iva in corso... Prego attendere.",FALSE);
|
||||
_prog = new TProgind(cicli,"Movimenti Iva: generazione file TRASFER per Sistema\nPrego attendere.",FALSE);
|
||||
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
|
||||
@ -1006,7 +1216,7 @@ bool TInv_cont::invio_mov_IVA()
|
||||
record.overwrite(str,49); //Sottoconto
|
||||
|
||||
TString data74terstr = _data74ter.string();
|
||||
str = riconverti(data74terstr);
|
||||
str = riconverti(data74terstr,FALSE);
|
||||
str.format("%06s", (const char*) str);
|
||||
record.overwrite(str,55); //Data per registri 74 TER
|
||||
|
||||
@ -1032,6 +1242,12 @@ bool TInv_cont::invio_mov_IVA()
|
||||
str.format("%01d", tipoatt);
|
||||
record.overwrite(str,133); //Tipo attivita'
|
||||
|
||||
bool intra = _triva->get_bool(RMI_INTRA);
|
||||
if (intra)
|
||||
record.overwrite("X",134);
|
||||
else
|
||||
record.overwrite(" ",134); //Flag causale x acquisti intracomunitari
|
||||
|
||||
TString corrlire = _corrlire.string();
|
||||
if (_corrlire.sign() < 0)
|
||||
negPC2negAS(corrlire);
|
||||
@ -1039,20 +1255,22 @@ bool TInv_cont::invio_mov_IVA()
|
||||
record.overwrite(str,135); //Corrispettivo in lire
|
||||
|
||||
record.overwrite(_codvali,146); //Codice valuta
|
||||
|
||||
|
||||
dec2integer(_cambioi,100000);
|
||||
TString cambioi = _cambioi.string();
|
||||
if (_cambioi.sign() < 0)
|
||||
negPC2negAS(cambioi);
|
||||
str.format("%011s", (const char*) cambioi);
|
||||
record.overwrite(str,149); //Cambio
|
||||
|
||||
|
||||
dec2integer(_corrval,1000);
|
||||
TString corrval = _corrval.string();
|
||||
if (_corrval.sign() < 0)
|
||||
negPC2negAS(corrval);
|
||||
str.format("%014s", (const char*) corrval);
|
||||
record.overwrite(str,160); //Corrispettivo in valuta
|
||||
|
||||
_numrec++;
|
||||
_numrec_iva++;
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
|
||||
@ -1077,4 +1295,9 @@ void TInv_cont::negPC2negAS(TString& numero)
|
||||
|
||||
numero = numero.mid(0,len -1); // Considero il numero senza l'ultima cifra
|
||||
numero << carattere;
|
||||
}
|
||||
|
||||
void TInv_cont::dec2integer(real& val, long dec)
|
||||
{
|
||||
val = val * dec;
|
||||
}
|
||||
|
22
cg/cglib.h
22
cg/cglib.h
@ -107,7 +107,7 @@ class TTab_conti : public TAssoc_array
|
||||
{
|
||||
public:
|
||||
void aggiorna_conto(const TBill& tc, int anno_es, const TImporto& importo,
|
||||
bool movap, bool provv, bool somma);
|
||||
bool movap, bool provv, bool somma, bool movimentato);
|
||||
|
||||
TConto* add(const TBill& c, int anno);
|
||||
TConto* find(const TBill& c, int anno);
|
||||
@ -118,14 +118,15 @@ public:
|
||||
class TSaldo_agg : public TObject
|
||||
{
|
||||
TTab_conti _tab_conti;
|
||||
bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in
|
||||
// saldi)
|
||||
bool _provv;
|
||||
int _anno_es; // anno esercizio
|
||||
TDate _data_ulmov; // data ultimo movimento
|
||||
long _num_ulmov; // numero ultimo movimento
|
||||
TRectype * _rec; // record corrente sui saldi
|
||||
|
||||
bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in saldi)
|
||||
bool _provv;
|
||||
int _anno_es; // anno esercizio
|
||||
TDate _data_ulmov; // data ultimo movimento
|
||||
long _num_ulmov; // numero ultimo movimento
|
||||
TRectype* _rec; // record corrente sui saldi
|
||||
bool _movimentato; // di default e' FALSE; viene usato a TRUE solo quando voglio
|
||||
// che un conto sia movimentato sui saldi anche se progressivi
|
||||
// e saldo iniziale non sono significativi. Usato dalla Chiusura/Apertura conti
|
||||
public:
|
||||
void clear_saldi(int year);
|
||||
void registra();
|
||||
@ -144,6 +145,9 @@ public:
|
||||
void set_movprovv (bool p) { _provv = p; }
|
||||
bool movprovv() const { return _provv; }
|
||||
|
||||
void set_movimentato (bool movimentato) { _movimentato = movimentato; }
|
||||
bool movimentato() const { return _movimentato; }
|
||||
|
||||
void set_data_ulmov (const TDate& data) { _data_ulmov = data; }
|
||||
const TDate& data_ulmov() const { return _data_ulmov; }
|
||||
|
||||
|
@ -5,11 +5,10 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// La compilazione e' gia' lenta da sola: evitare include inutili (Guy)
|
||||
// #include <stdlib.h>
|
||||
// #include <utility.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <prefix.h>
|
||||
#include <applicat.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "cglib.h"
|
||||
|
||||
@ -40,8 +39,8 @@ void TTab_conti::remove(const TBill& c, int anno)
|
||||
}
|
||||
|
||||
void TTab_conti::aggiorna_conto(const TBill& tcon,
|
||||
int anno_es, const TImporto& importo,
|
||||
bool movap, bool provv, bool somma)
|
||||
int anno_es, const TImporto& importo, bool movap,
|
||||
bool provv, bool somma, bool movimentato)
|
||||
{
|
||||
TConto* tc = find(tcon, anno_es);
|
||||
if (tc == NULL)
|
||||
@ -73,31 +72,33 @@ void TTab_conti::aggiorna_conto(const TBill& tcon,
|
||||
}
|
||||
|
||||
// rimuovo dalla tabella il conto se dare e avere vanno a zero
|
||||
if (tc->dare().is_zero() && tc->avere().is_zero() &&
|
||||
tc->darepro().is_zero() && tc->averepro().is_zero() &&
|
||||
tc->saldo().is_zero())
|
||||
remove(*tc, anno_es);
|
||||
if (!movimentato)
|
||||
if (tc->dare().is_zero() && tc->avere().is_zero() &&
|
||||
tc->darepro().is_zero() && tc->averepro().is_zero() &&
|
||||
tc->saldo().is_zero())
|
||||
remove(*tc, anno_es);
|
||||
}
|
||||
|
||||
TSaldo_agg::TSaldo_agg()
|
||||
{
|
||||
_anno_es = 0;
|
||||
_data_ulmov = "";
|
||||
_num_ulmov = 0l;
|
||||
_movap = FALSE;
|
||||
_provv = FALSE;
|
||||
_anno_es = 0;
|
||||
_data_ulmov = "";
|
||||
_num_ulmov = 0l;
|
||||
_movap = FALSE;
|
||||
_provv = FALSE;
|
||||
_movimentato = FALSE;
|
||||
// reset(); // INUTILE pulizia dell'array dei conti
|
||||
}
|
||||
|
||||
void TSaldo_agg::aggiorna(const TBill& tc, const TImporto& imp, bool somma)
|
||||
{
|
||||
_tab_conti.aggiorna_conto(tc, _anno_es, imp, _movap, _provv, somma);
|
||||
_tab_conti.aggiorna_conto(tc, _anno_es, imp, _movap, _provv, somma, _movimentato);
|
||||
}
|
||||
|
||||
void TSaldo_agg::aggiorna(int gruppo, int conto, long sottoconto, const real& importo, char sezione, bool somma)
|
||||
{
|
||||
const TImporto imp(sezione, importo);
|
||||
_tab_conti.aggiorna_conto(TBill(gruppo, conto, sottoconto), _anno_es, imp, _movap, _provv, somma);
|
||||
_tab_conti.aggiorna_conto(TBill(gruppo, conto, sottoconto), _anno_es, imp, _movap, _provv, somma, _movimentato);
|
||||
}
|
||||
|
||||
void TSaldo_agg::reset()
|
||||
@ -166,7 +167,7 @@ void TSaldo_agg::registra()
|
||||
CHECK(tcon.ok(), "Tentavi di saldare un conto incompleto, eh?");
|
||||
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES, hobj->key().left(4));
|
||||
saldi.put(SLD_ANNOES, atoi(hobj->key().left(4)) );
|
||||
saldi.put(SLD_GRUPPO, tcon.gruppo());
|
||||
saldi.put(SLD_CONTO, tcon.conto());
|
||||
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());
|
||||
@ -176,7 +177,7 @@ void TSaldo_agg::registra()
|
||||
if (saldi.read(_isequal, _lock) != NOERR)
|
||||
{
|
||||
saldi.zero();
|
||||
saldi.put(SLD_ANNOES, hobj->key().left(4));
|
||||
saldi.put(SLD_ANNOES, atoi(hobj->key().left(4)));
|
||||
saldi.put(SLD_GRUPPO, tcon.gruppo());
|
||||
saldi.put(SLD_CONTO, tcon.conto());
|
||||
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());
|
||||
@ -283,7 +284,8 @@ TEsercizi_contabili::TEsercizi_contabili() : _firm(0)
|
||||
|
||||
void TEsercizi_contabili::update()
|
||||
{
|
||||
_firm = prefix().get_codditta();
|
||||
_firm = main_app().get_firm();
|
||||
|
||||
destroy();
|
||||
TTable esc("ESC");
|
||||
for (int err = esc.first(); err == NOERR; err = esc.next())
|
||||
@ -296,7 +298,7 @@ void TEsercizi_contabili::update()
|
||||
|
||||
void TEsercizi_contabili::check()
|
||||
{
|
||||
if (_firm != prefix().get_codditta())
|
||||
if (_firm != main_app().get_firm())
|
||||
{
|
||||
#ifdef DBG
|
||||
if (_firm != 0)
|
||||
|
895
cg/cglib04.cpp
895
cg/cglib04.cpp
File diff suppressed because it is too large
Load Diff
117
cg/cglib04.h
117
cg/cglib04.h
@ -1,5 +1,8 @@
|
||||
// cglib04.h
|
||||
|
||||
#ifndef __CGLIB04_H
|
||||
#define __CGLIB04_H
|
||||
|
||||
#include <applicat.h>
|
||||
#include <config.h>
|
||||
#include <prefix.h>
|
||||
@ -30,21 +33,23 @@
|
||||
#define TEMP_RMOV "trmov"
|
||||
#define TEMP_RMOVIVA "trmoviva"
|
||||
#define TEMP_OCC "toccas"
|
||||
#define TEMP_TAB "ttab"
|
||||
|
||||
#define SIZE 256
|
||||
|
||||
static unsigned char _tabella[10] = {0x8a,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52};
|
||||
|
||||
HIDDEN TString80 TEMP;
|
||||
|
||||
HIDDEN TString16 HEADER = "\\header";
|
||||
|
||||
const int CAMPI_RCAUS = 6;
|
||||
|
||||
// Tracciato del record di controllo
|
||||
HIDDEN int pos[15] = {0,15,25,29,32,38,47,234,235,236,237,238,239,240,241};
|
||||
|
||||
HIDDEN int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
|
||||
/*HIDDEN*/ const char* converti (TString& data_AS400,bool anno_di_quattro);
|
||||
/*HIDDEN*/ const char* riconverti (TString& data_PC,bool anno_di_quattro);
|
||||
/*HIDDEN*/ int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
|
||||
int packindex(bool vis, int num, TString& name);
|
||||
int pack(bool vis, int num, TString& name);
|
||||
@ -55,6 +60,45 @@ int fremove(const char* path);
|
||||
bool look_causale(const char* codcaus);
|
||||
bool format_if_zero(TString&, int);
|
||||
|
||||
class TRic_recfield : public TObject
|
||||
{
|
||||
char _name[12]; // Nome campo
|
||||
TRectype* _rec; // Puntatore a inizio record
|
||||
char* _p; // Puntatore a inizio campo
|
||||
int _len; // Lunghezza campo
|
||||
int _dec; // Numero di decimali
|
||||
int _type; // Tipo del campo
|
||||
|
||||
void set(int from, int to);
|
||||
|
||||
public:
|
||||
/* int operator =(int i) ;
|
||||
long operator =(long l) ;
|
||||
const TDate& operator =(const TDate& d) ;
|
||||
const real& operator =(const real& r) ; */
|
||||
|
||||
const char* operator =(const char* s);
|
||||
|
||||
/* operator int() const ;
|
||||
operator long() const ;
|
||||
operator TDate() const ;
|
||||
operator const real() const ; */
|
||||
|
||||
operator const char*() const;
|
||||
|
||||
// void setptr(TRecnotype r); // Scrive un campo packed. Sarebbe meglio non usare mai campi packed.
|
||||
// TRecnotype ptr() const; // Legge un campo packed. Sarebbe meglio non usare mai campi packed.
|
||||
|
||||
const char* pos() const { return (const char*) _p;} // Ritorna un puntatore all'inizio del campo nel record. Dovrebbe essere protected!
|
||||
int len() const { return (int) _len;} // Ritorna la lunghezza
|
||||
int dec() const { return (int) _dec;} // Ritorna il numero di decimali
|
||||
TFieldtypes type() const { return (TFieldtypes) _type;} // Ritorna il tipo del campo
|
||||
TRectype& record() const { return *_rec;} // Ritorna puntatore a inizio record
|
||||
|
||||
TRic_recfield(TRectype& rec, const char* name, int from = 0, int len = 0);
|
||||
};
|
||||
|
||||
|
||||
class TMappa_trc : public TAssoc_array
|
||||
{
|
||||
public :
|
||||
@ -80,7 +124,8 @@ class TTransfer_file
|
||||
TString256 _control_rec; // Buffer per il record di controllo
|
||||
TString256 _record; // Buffer per il record corrente
|
||||
TProgind* _prog;
|
||||
TIsamtempfile* _toccas;
|
||||
TIsamtempfile* _toccas;
|
||||
TIsamtempfile* _ttab;
|
||||
|
||||
long _numreg, _numreg_p, _numreg_piva, _npoccas;
|
||||
int _annoes;
|
||||
@ -91,7 +136,10 @@ class TTransfer_file
|
||||
long _tot_rec; // Numero totale di record nel transfer
|
||||
int _nultras; // Numero ultimo trasferimento
|
||||
int _last_tab,_last_mov;
|
||||
|
||||
long _ditta;
|
||||
|
||||
TString16 _tiporec;
|
||||
TString16 _nome_simb;
|
||||
TString16 _dataultras;
|
||||
TString16 _sigle_file;
|
||||
TString _nrec_file;
|
||||
@ -105,6 +153,13 @@ private:
|
||||
void fill_index(TString&,TString&);
|
||||
|
||||
// Funzioni utilizzate da fcopytemp()
|
||||
void scrivi_header(const char* dest,const char* wflag);
|
||||
void scrivi_causali(long nrec);
|
||||
void scrivi_clifo(long nrec);
|
||||
void scrivi_pcon(long nrec);
|
||||
void scrivi_PN(long nrec);
|
||||
void scrivi_IVA(long nrec);
|
||||
|
||||
void write_tmp_tabelle(TString& record, bool create);
|
||||
int trasfer_data_tab(TIsamtempfile& file, TRectype& dep);
|
||||
void write_tmp_movPN(TString& record, bool create);
|
||||
@ -124,7 +179,7 @@ private:
|
||||
int cerca_annoes(long numreg);
|
||||
const char* scrivi_occasionali(const TString& record);
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
void remove_all(bool file_ditta = TRUE);
|
||||
void canc_file_dir_temp(const char* dir);
|
||||
@ -133,11 +188,13 @@ public:
|
||||
const char* cerca_comune_cap(TString& field);
|
||||
const char* cerca_comune_den(TString& field);
|
||||
void datafine_esprec(const int aep, TDate& datacomp);
|
||||
|
||||
|
||||
bool fcopytemp(const char* orig, const char* dest);
|
||||
|
||||
bool ordina_trasfer(const char* orig);
|
||||
long determina_dimensione(FILE* f);
|
||||
|
||||
int dataes(const TDate&, int*, TDate&);
|
||||
|
||||
|
||||
const char* path (long codditta = 0);
|
||||
bool open (const char* path, bool create=FALSE);
|
||||
void close ();
|
||||
@ -147,10 +204,14 @@ public:
|
||||
|
||||
// Funzioni che agiscono sul record di controllo del file trasfer.
|
||||
|
||||
bool read_control_rec(); // Legge il record
|
||||
bool read_control_rec(); // Legge il record del file header
|
||||
bool read_control_rec_t(); // Legge il record di controllo del file trasfer
|
||||
bool write_control_rec(const char* str, const int size); // Scrive una stringa di lunghezza size
|
||||
|
||||
int nultras () const { return _nultras; } // Ritorna il numero ultimo trasferimento
|
||||
const char* tiporec () const { return _tiporec; } // Ritorna il tipo record
|
||||
const char* nome_simb () const { return _nome_simb; } // Ritorna il nome simbolico del sistema inviante
|
||||
long ditta () const { return _ditta; } // Ritorna la ditta inviante
|
||||
int nultras () const { return _nultras; } // Ritorna il numero ultimo trasferimento
|
||||
const char* dataultras() const { return (const char*) _dataultras; } // Ritorna la data ultimo trasferimento
|
||||
const char* sigle_file() const { return (const char*) _sigle_file; } // Ritorna una stringa contenente le sigle dei file da ricevere
|
||||
const char* nrec_file () const { return (const char*) _nrec_file; } // Ritorna una stringa con il numero totale di record corrispondenti ad ogni sigla dei file da ricevere
|
||||
@ -211,37 +272,5 @@ public:
|
||||
~TTransfer_file();
|
||||
};
|
||||
|
||||
HIDDEN const char* converti (TString& data_AS400)
|
||||
{
|
||||
if (data_AS400 == "000000") return TEMP = "";
|
||||
|
||||
TEMP = data_AS400.mid(4,2);
|
||||
TEMP << "-" <<data_AS400.mid(2,2);
|
||||
TEMP << "-" << "19" <<data_AS400.mid(0,2);
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
HIDDEN const char* riconverti (TString& data_PC)
|
||||
{
|
||||
TEMP = data_PC.mid(8,2);
|
||||
TEMP << data_PC.mid(3,2);
|
||||
TEMP << data_PC.mid(0,2);
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
HIDDEN int date2esc(const TDate& d, int* prevesc)
|
||||
{
|
||||
if (prevesc) *prevesc = 0;
|
||||
TTable esc("ESC");
|
||||
for (int err = esc.first(); err == NOERR; err = esc.next())
|
||||
{
|
||||
const TDate ia(esc.get("D0")); // Data inizio esercizio
|
||||
const TDate fa(esc.get("D1")); // Data fine esercizio
|
||||
const anno = esc.get_int("CODTAB");
|
||||
if (d >= ia && d <= fa)
|
||||
return anno;
|
||||
if (prevesc) *prevesc = anno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -203,7 +203,7 @@ U1|1|250|250|23||||
|
||||
U1|2|251|256|23||||
|
||||
U1|3|3|8|23|NUMREG|||
|
||||
U1|4|56|61|23|DATA74TER|2||
|
||||
U1|5|147|149|23|CODVAL|||
|
||||
U1|5|147|149|23|CODVALI|||
|
||||
U1|6|16|21|23|CODCF|||
|
||||
U1|7|238|248|23|TOTDOC|||
|
||||
U1|8|150|160|23|CAMBIOI|3|5|
|
||||
@ -220,6 +220,7 @@ U1|18|134|134|25|TIPOATT|||
|
||||
U1|19|46|47|25|GRUPPO|||
|
||||
U1|20|48|49|25|CONTO|||
|
||||
U1|21|50|55|25|SOTTOCONTO|||
|
||||
U1|22|135|135|25|INTRA|||
|
||||
U1|50|62|86|||||
|
||||
U1|51|249|249|23||||
|
||||
U1|52|109|126|||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user