1994-12-09 16:29:50 +00:00
|
|
|
#include "cg5500.h"
|
|
|
|
#include <utility.h>
|
|
|
|
|
|
|
|
bool Visliq_app::look_lim(int m)
|
|
|
|
{
|
|
|
|
bool ok = FALSE;
|
|
|
|
|
|
|
|
_lim_r->zero();
|
2000-05-05 15:25:49 +00:00
|
|
|
_lam_r->zero();
|
1995-02-16 10:46:35 +00:00
|
|
|
(*_lim_anno) = _year;
|
|
|
|
(*_lim_mese) = format("%02d",m);
|
1994-12-09 16:29:50 +00:00
|
|
|
|
1995-03-09 08:47:36 +00:00
|
|
|
if (_lim->read() == NOERR)
|
|
|
|
{
|
|
|
|
(*_lam_anno) = _year;
|
|
|
|
(*_lam_mese) = format("%02d",m);
|
|
|
|
_lam->read();
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_lim_r->zero();
|
|
|
|
(*_lim_anno) = _year;
|
|
|
|
(*_lim_mese) = format("%02d",m);
|
|
|
|
}
|
|
|
|
|
1995-03-09 08:47:36 +00:00
|
|
|
return _lim->good() && _lam->good();
|
1994-12-09 16:29:50 +00:00
|
|
|
}
|
|
|
|
|
1995-02-03 11:51:44 +00:00
|
|
|
bool Visliq_app::look_del(int month, int type, bool create)
|
1994-12-09 16:29:50 +00:00
|
|
|
{
|
|
|
|
_del->zero();
|
1995-02-03 11:51:44 +00:00
|
|
|
(*_del_ditta) = format("%05ld", get_firm());
|
|
|
|
(*_del_anno) = _year;
|
|
|
|
(*_del_mese) = format("%02d", month);
|
|
|
|
(*_del_tipo) = format("%1d", type);
|
|
|
|
|
|
|
|
TString16 ctab = _del->get("CODTAB");
|
1994-12-09 16:29:50 +00:00
|
|
|
_del->read();
|
|
|
|
|
1995-02-03 11:51:44 +00:00
|
|
|
bool ok = _del->good();
|
|
|
|
|
|
|
|
if (!ok && create)
|
|
|
|
{
|
|
|
|
_del->zero();
|
|
|
|
_del->put("CODTAB",ctab);
|
|
|
|
_del->write();
|
|
|
|
}
|
|
|
|
return ok;
|
1994-12-09 16:29:50 +00:00
|
|
|
}
|
|
|
|
|
1995-02-14 10:03:05 +00:00
|
|
|
bool Visliq_app::look_lia(long ditta, int year)
|
1994-12-09 16:29:50 +00:00
|
|
|
{
|
1995-02-14 10:03:05 +00:00
|
|
|
if (year == 0) year = _year;
|
|
|
|
if (ditta == 0l) ditta = get_firm();
|
|
|
|
TString16 y; y << format("%05ld", ditta); y << year;
|
1994-12-09 16:29:50 +00:00
|
|
|
|
|
|
|
_lia->zero();
|
|
|
|
_lia->put("CODTAB", y);
|
|
|
|
_lia->read();
|
|
|
|
|
|
|
|
return _lia->good();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Visliq_app::is_trim(int x)
|
|
|
|
// TRUE se il mese passato e' un trimestre
|
|
|
|
{ return x == 3 || x == 6 || x == 9 || x == 12; }
|
|
|
|
|
|
|
|
bool Visliq_app::is_month_ok(int x, int month)
|
|
|
|
// TRUE se il mese passato e' compatibile con il regime
|
|
|
|
// di liquidazione e (opz) non e' maggiore di quello scelto
|
|
|
|
{
|
|
|
|
if (month == -1) month = x;
|
|
|
|
return _freqviva == "M" ?
|
|
|
|
( x > 0 && x <= month) :
|
|
|
|
( x <= month && is_trim(x));
|
|
|
|
}
|