96f33c01ee
Files correlati : ve6.exe Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 979 git-svn-id: svn://10.65.10.50/trunk@15623 c028cbd2-c16b-5b4b-a496-9718f37d4682
138 lines
3.0 KiB
C++
Executable File
138 lines
3.0 KiB
C++
Executable File
#include "cg5500.h"
|
|
#include <utility.h>
|
|
#include <righef24.h>
|
|
|
|
bool Visliq_app::look_lim(int m)
|
|
{
|
|
bool ok = FALSE;
|
|
|
|
_lim_r->zero();
|
|
_lam_r->zero();
|
|
(*_lim_anno) = _year;
|
|
(*_lim_mese) = format("%02d",m);
|
|
|
|
if (_lim->read() == NOERR)
|
|
{
|
|
(*_lam_anno) = _year;
|
|
(*_lam_mese) = format("%02d",m);
|
|
_lam->read();
|
|
}
|
|
else
|
|
{
|
|
_lim_r->zero();
|
|
(*_lim_anno) = _year;
|
|
(*_lim_mese) = format("%02d",m);
|
|
}
|
|
|
|
return _lim->good() && _lam->good();
|
|
}
|
|
|
|
bool Visliq_app::look_del(int month, int type, bool create)
|
|
{
|
|
_del->zero();
|
|
(*_del_ditta) = format("%05ld", get_firm());
|
|
(*_del_anno) = _year;
|
|
(*_del_mese) = format("%02d", month);
|
|
(*_del_tipo) = format("%1d", type);
|
|
|
|
TString16 ctab = _del->get("CODTAB");
|
|
_del->read();
|
|
|
|
bool ok = _del->good();
|
|
|
|
if (!ok && create)
|
|
{
|
|
_del->zero();
|
|
_del->put("CODTAB",ctab);
|
|
_del->write();
|
|
}
|
|
return ok;
|
|
}
|
|
|
|
bool Visliq_app::look_f24(int month, int type, bool create)
|
|
{
|
|
TLocalisamfile & f24 = *_f24;
|
|
const bool mensile = _freqviva == "M";
|
|
|
|
int codtrib = mensile ? 6000 + month : 6031 + (month / 3);
|
|
|
|
if (type == 7)
|
|
codtrib = mensile ? 6013 : 6035;
|
|
|
|
f24.setkey(4);
|
|
f24.put(F24_TIPOINTEST, "D");
|
|
f24.put(F24_INTEST, get_firm());
|
|
f24.put(F24_DATASCAD, _year);
|
|
f24.put(F24_TRIBUTO, codtrib);
|
|
const bool found = f24.read(_isgteq) == NOERR && codtrib == f24.get_int(F24_TRIBUTO);
|
|
if (create && !found)
|
|
{
|
|
long progr = 0L;
|
|
TDate scad( type == 7 ? 27 : 16, (mensile || type == 7) ? month : ((month + 2) / 3) * 3), _year);
|
|
|
|
while (scad.wday() > 5)
|
|
++scad;
|
|
if (month < 13 && type != 7)
|
|
scad.addmonth(mensile ? 1 : 2);
|
|
if (f24.last() == NOERR)
|
|
progr = f24.get_long(F24_PROGR);
|
|
progr++;
|
|
f24.zero();
|
|
f24.put(F24_PROGR, progr);
|
|
|
|
f24.put(F24_TRIBUTO, codtrib);
|
|
f24.put(F24_TIPOINTEST, "D");
|
|
f24.put(F24_INTEST, get_firm());
|
|
if (month >= 13)
|
|
{
|
|
if (type == 7)
|
|
f24.put(F24_DESCR, "Acconto IVA");
|
|
else
|
|
f24.put(F24_DESCR,"IVA annuale");
|
|
}
|
|
else
|
|
f24.put(F24_DESCR, format("IVA mese di %s %s", itom(month), (const char *)_year));
|
|
f24.put(F24_DATASCAD, scad);
|
|
f24.put(F24_ANNO, _year);
|
|
}
|
|
return found;
|
|
}
|
|
|
|
int Visliq_app::look_ver(int month, int type, bool create)
|
|
{
|
|
if (look_del(month, type, create))
|
|
return 1;
|
|
else
|
|
if (app()._has_f24 && look_f24(month, type, create))
|
|
return 2;
|
|
return -1;
|
|
}
|
|
|
|
bool Visliq_app::look_lia(long ditta, int year)
|
|
{
|
|
if (year == 0) year = _year;
|
|
if (ditta == 0l) ditta = get_firm();
|
|
TString16 y; y << format("%05ld", ditta); y << year;
|
|
|
|
_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));
|
|
}
|