Corretti errori sui mastrini, estr. vers. e plafond

git-svn-id: svn://10.65.10.50/trunk@2113 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1995-11-08 16:18:13 +00:00
parent 65f300c267
commit c7264b933e
5 changed files with 245 additions and 154 deletions

View File

@ -74,6 +74,7 @@ class TMastrini_application : public TPrintapp
long _sottocontocontr;
bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov;
bool _stampato;
int _annomsk,_annoesmsk,_annoes,_annomsksucc,_tipo_mask,_anno_ghost;
int _anno_corrente,_anno_precedente,_indbil,_numero_pag;
@ -1832,7 +1833,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_sezione == "D")
{
_totale_periodo_dare += _importo;
//_riporto_parziale_dare += _importo;
_riporto_parziale_dare += _importo;
if (_numcarat == 1) // Stampa 132 caratteri
set_row (_rw,"@85g%s", (const char*) _importo_str);
@ -1847,7 +1848,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else if (_sezione == "A")
{
_totale_periodo_avere += _importo;
//_riporto_parziale_avere += _importo;
_riporto_parziale_avere += _importo;
if (_numcarat == 1) // Stampa 132 caratteri
set_row (_rw,"@101g%s", (const char*) _importo_str);
@ -1860,6 +1861,9 @@ bool TMastrini_application::preprocess_page(int file, int counter)
}
}
const int righe_rimaste = printer().rows_left();
_stampato = righe_rimaste >= 1;
_saldo_progressivi_str=_saldo_progressivi.string("###.###.###.###");
_saldo_movimenti_str=_saldo_movimenti.string("###.###.###.###");
if (_numcarat == 2)
@ -2072,10 +2076,10 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
return REPEAT_PAGE;
}
case LF_RMOV:
if (_sezione == "D")
_riporto_parziale_dare += _importo;
else if (_sezione == "A")
_riporto_parziale_avere += _importo;
// if (_sezione == "D")
// _riporto_parziale_dare += _importo;
// else if (_sezione == "A")
// _riporto_parziale_avere += _importo;
force_setpage();
break;
default:
@ -2583,18 +2587,25 @@ void TMastrini_application::crea_intestazione()
{
_riporto_dare += _riporto_parziale_dare;
_riporto_avere += _riporto_parziale_avere;
real dep_dare,dep_avere,imp_d,imp_a;
imp_d = _sezione == "D" ? _importo : ZERO;
imp_a = _sezione == "A" ? _importo : ZERO;
dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d;
dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a;
if (_numcarat == 1)
{
TString string = _riporto_dare.string("###.###.###.###");
TString string = dep_dare.string("###.###.###.###");
set_header (10,"@32gA RIPORTO@85g%15s",(const char*) string);
string = _riporto_avere.string("###.###.###.###");
string = dep_avere.string("###.###.###.###");
set_header (10,"@101g%15s",(const char*) string);
}
if (_numcarat == 2)
{
TString string = _riporto_dare.string("###.###.###.###");
TString string = dep_dare.string("###.###.###.###");
set_header (10,"@32gA RIPORTO@101g%15s",(const char*) string);
string = _riporto_avere.string("###.###.###.###");
string = dep_avere.string("###.###.###.###");
set_header (10,"@117g%15s",(const char*) string);
}
_riporto_parziale_dare = ZERO;
@ -2739,18 +2750,25 @@ void TMastrini_application::stampa_progre_riporto()
{
_riporto_dare += _riporto_parziale_dare;
_riporto_avere += _riporto_parziale_avere;
real dep_dare,dep_avere,imp_d,imp_a;
imp_d = _sezione == "D" ? _importo : ZERO;
imp_a = _sezione == "A" ? _importo : ZERO;
dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d;
dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a;
if (_numcarat == 1)
{
TString string = _riporto_dare.string("###.###.###.###");
TString string = dep_dare.string("###.###.###.###");
set_row (_rw,"@32gA RIPORTO@85g%15s",(const char*) string);
string = _riporto_avere.string("###.###.###.###");
string = dep_avere.string("###.###.###.###");
set_row (_rw++,"@101g%15s",(const char*) string);
}
if (_numcarat == 2)
{
TString string = _riporto_dare.string("###.###.###.###");
TString string = dep_dare.string("###.###.###.###");
set_row (_rw,"@32gA RIPORTO@101g%15s",(const char*) string);
string = _riporto_avere.string("###.###.###.###");
string = dep_avere.string("###.###.###.###");
set_row (_rw++,"@117g%15s",(const char*) string);
}
_riporto_parziale_dare = ZERO;
@ -2784,18 +2802,25 @@ int TMastrini_application::stampa_progre_riporto(int start_riga)
{
_riporto_dare += _riporto_parziale_dare;
_riporto_avere += _riporto_parziale_avere;
real dep_dare,dep_avere,imp_d,imp_a;
imp_d = _sezione == "D" ? _importo : ZERO;
imp_a = _sezione == "A" ? _importo : ZERO;
dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d;
dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a;
if (_numcarat == 1)
{
TString string = _riporto_dare.string("###.###.###.###");
TString string = dep_dare.string("###.###.###.###");
set_row (r,"@32gA RIPORTO@85g%15s",(const char*) string);
string = _riporto_avere.string("###.###.###.###");
string = dep_avere.string("###.###.###.###");
set_row (r++,"@101g%15s",(const char*) string);
}
if (_numcarat == 2)
{
TString string = _riporto_dare.string("###.###.###.###");
TString string = dep_dare.string("###.###.###.###");
set_row (r,"@32gA RIPORTO@101g%15s",(const char*) string);
string = _riporto_avere.string("###.###.###.###");
string = dep_avere.string("###.###.###.###");
set_row (r++,"@117g%15s",(const char*) string);
}
_riporto_parziale_dare = ZERO;
@ -3677,3 +3702,4 @@ int cg3200(int argc, char* argv[])
return 0;
}

View File

@ -421,6 +421,13 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
// codici tributo, concessione, conto fiscale anche se la
// delega esiste gia'
// Molto pericoloso chiamare con create = TRUE:
// se e' gia' stata fatta l'estrazione versamenti
// e l'utente cambia titcf e isdel sull'anagrafica
// sono c... suoi!!! (Maurizio)
// deve rifarsi la delega con l'ESTRAZIONE VERSAMENTI
// io l'ho lasciato per rispetto del lavoro altrui
long ditta = _nditte->curr().get_long("CODDITTA");
_del->zero();
(*_del_ditta) = format("%05ld", ditta);
@ -438,6 +445,7 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
_del->zero();
_del->put("CODTAB",ctab);
}
if (create)
{
// vedi se titolare conto fiscale
@ -454,23 +462,14 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
isdel = anag.get_long("TIPOSTDEL") == 0l;
uffiva = anag.get_int("UFFIVA");
}
if (!titcf || isdel)
{
// non titolare conto fiscale oppure paga con delega:
// cerca banca
// codici ABI e CAB da anagrafica ditte
TString16 abi, cab;
if (!ok)
{
abi = _nditte->lfile().get("ABIBAN");
cab = _nditte->lfile().get("CABBAN");
}
else
{
abi = _del->get("S7");
cab = _del->get("S8");
}
if (abi.empty())
{
/*
@ -481,11 +480,48 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
abi = c.get("CodABI");
cab = c.get("CodCAB");
}
_del->put("S7", abi);
_del->put("S8", cab);
_del->put("S9", ""); // per sicurezza! (visto che non devono mai
} // esistere entrambe
else
{
// non usa delega bensi' bollettino o distinta:
// cerca concessione comune
// infila ufficio concessione in S9
// e descrizione comune in S2
TString16 con;
TString uva;
if (look_conc(con, uva))
{
_del->put("S9", con);
_del->put("S2", uva);
_del->put("S7", "");
_del->put("S8", "");
}
}
} //fine create
// le descrizioni sulla delega non vengono
// memorizzate dai vari programmi di gestione
// e estrazione ma solo qui.
if (ok)
{
int uffiva;
TLocalisamfile anag(LF_ANAG);
anag.zero();
anag.put("TIPOA", _nditte->lfile().get("TIPOA"));
anag.put("CODANAGR", _nditte->lfile().get("CODANAGR"));
if (anag.read() == NOERR)
uffiva = anag.get_int("UFFIVA");
TString16 abi = _del->get("S7");
TString16 cab = _del->get("S8");
TString16 con = _del->get("S9");
// descrizione banca
if (abi.not_empty())
{
TTable ban("%BAN");
ban.zero();
TString codban = format("%05ld", atol(abi));
@ -507,22 +543,13 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
_del->put("S2", desiva);
}
}
else
else if (con.not_empty())
{
// non usa delega bensi' bollettino o distinta:
// cerca concessione comune
// infila ufficio concessione in S9
// e descrizione comune in S2
TString16 con;
if (ok) con = _del->get("S9");
TString uva;
if (look_conc(con, uva))
{
_del->put("S9", con);
_del->put("S2", uva);
}
}
// scrive codice tributo
int ctri = 6000;
if (month == 13 && type == 7)
@ -538,7 +565,7 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
if (!ok) _del->write();
else _del->rewrite();
}
return ok;
}

View File

@ -852,9 +852,13 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
_DescrItem* d = new _DescrItem(DELEGA);
look_del(month,month == 13 ? 2 : 1,TRUE);
//{
d->_f0 = (_del->get("S7").not_empty() || _del->get("S8").not_empty());
d->_f0 = 0;
if (look_del(month,month == 13 ? 2 : 1))
{
if (_del->get("S9").not_empty())
d->_f0 = 2;
else d->_f0 = 1;
if (_del->get_bool("B0"))
{
d->_s0 = _del->get("S2"); // ufficio iva/concessione
@ -864,14 +868,16 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
d->_r0 = _del->get_real("R0");
d->_d0 = _del->get_date("D0");
} // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano
//}
}
if ( (month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4)))
|| (_isannual && _freqviva == "T" && !(_isbenzinaro && _gest4)) )
if (look_del(12,7))
{
d->_s4 = "ACC";
d->_f0 = (_del->get("S7").not_empty() || _del->get("S8").not_empty());
if (_del->get("S9").not_empty())
d->_f1 = 2;
else d->_f1 = 1;
TToken_string t;
if (_del->get_bool("B0"))
{
@ -884,6 +890,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
}
d->_s5 = t;
}
return d;
}
@ -1056,7 +1063,8 @@ void TLiquidazione_app::set_att(_DescrItem& d)
void TLiquidazione_app::set_plafond(_DescrItem& d)
{
if (_isregis) return;
//if (_isregis) return;
if (_isregis && _isfinal) return;
set_bookmark("Quadro plafond", _att_bookmark);
@ -1643,14 +1651,14 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
set_row(rw, "Versamento di L. %s effettuato il %s",
(const char*)vr,
(const char*)dt);
if (di._f0)
if (di._f1 == 1)
{
set_row(rw++, "@68gdiretto all'ufficio IVA di %s", (const char*)loc);
set_row(rw++, "@68gtramite %s", (const char*)ban);
set_row(rw++, "@68gcodice azienda %s codice dipendenza %s",
(const char*)abi, (const char*)cab);
}
else
else if (di._f1 == 2)
{
set_row(rw++, "@68gdiretto al Ministero delle Finanze");
set_row(rw++, "@68gConcessione %s", (const char*)loc);
@ -1663,7 +1671,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
set_row(rw, "Versamento di L. %s effettuato il %s",
(const char*)vr,
(const char*)dt);
if (di._f0)
if (di._f0 == 1)
{
set_row(rw++, "@68gdiretto all'ufficio IVA di %s",
(const char*)(di._s0));
@ -1671,11 +1679,16 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
set_row(rw++, "@68gcodice azienda %s codice dipendenza %s",
(const char*)(di._s2), (const char*)(di._s3));
}
else
else if (di._f0 == 2)
{
set_row(rw++, "@68gdiretto al Ministero delle Finanze");
set_row(rw++, "@68gConcessione %s", (const char*)(di._s0));
}
else
{
set_row(rw++, "@68gdiretto");
set_row(rw++, "@68gtramite");
}
}
}
}

View File

@ -179,6 +179,7 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc)
//bool wasdel = look_del(month, _isannual ? 2 : 1);
bool wasdel = look_del(month, 1);
//la stampa deve essere fatta sia se a credito che a debito
if (!topay.is_zero())
{
tt = new TToken_string(80);
@ -192,7 +193,8 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc)
//if (topay.sign() > 0)
if (versare)
{
look_del(month, 1, TRUE);
look_del(month, 1, TRUE); //ci mette abi, cab o con
//che legge dall'anagrafica!!!
bool stampato = _del->get_bool("B0");
if (stampato) //se esiste e stampato si richiede conferma aggiornamento
{
@ -212,10 +214,33 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc)
tt->add(_del->get("S9"));
tt->add(_nditte->curr().get("PTEL"));
tt->add(_nditte->curr().get("TEL"));
/***
TString desc(_del->get("S1"));
if (desc.not_empty())
tt->add(desc);
else tt->add(_del->get("S2"));
***/
TString desc;
if (_del->get("S9").not_empty())
{
TTable ucc("%UCC");
ucc.zero();
ucc.put("CODTAB", _del->get("S9"));
if (ucc.read() == NOERR)
desc = ucc.get("S0");
}
else if (_del->get("S7").not_empty())
{
TTable ban("%BAN");
TString16 cod;
cod = _del->get("S7");
if (_del->get("S8").not_empty()) cod << _del->get("S8");
ban.zero();
ban.put("CODTAB", cod);
if (ban.read() == NOERR)
desc = ban.get("S0");
}
tt->add(desc);
}
else if (wasdel) //se esiste e no versare
_del->remove();

View File

@ -555,7 +555,7 @@ else //prendo la descrizione della banca
{
TTable ban("%BAN");
TString16 cod;
cod = _abi; cod << _cab;
cod = _abi; if (!_cab.empty()) cod << _cab;
ban.zero();
ban.put("CODTAB", cod);
if (ban.read() == NOERR)