1999-10-22 10:00:18 +00:00
|
|
|
// Programma per la gestione e la stampa della dichiarazione periodica IVA
|
|
|
|
#include <applicat.h>
|
|
|
|
#include <automask.h>
|
|
|
|
#include <currency.h>
|
|
|
|
#include <form.h>
|
|
|
|
#include <prefix.h>
|
2000-10-03 13:45:12 +00:00
|
|
|
#include <recarray.h>
|
1999-10-22 10:00:18 +00:00
|
|
|
#include <sheet.h>
|
|
|
|
#include <tabutil.h>
|
|
|
|
|
|
|
|
#include <nditte.h>
|
|
|
|
|
|
|
|
#include "cg5700.h"
|
2002-02-26 16:20:19 +00:00
|
|
|
#include "cglib03.h"
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
class TDich_periodica_selfirm_mask : public TAutomask
|
|
|
|
{
|
|
|
|
TArray_sheet * _ditte;
|
|
|
|
TString_array _nomiditte;
|
|
|
|
int _year;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool select_button();
|
|
|
|
void build_nomiditte();
|
|
|
|
void build_ditte_sheet();
|
2003-02-25 14:39:02 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
public:
|
2000-10-03 13:45:12 +00:00
|
|
|
const int get_year() const { return _year; }
|
1999-10-22 10:00:18 +00:00
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
TDich_periodica_selfirm_mask();
|
|
|
|
virtual ~TDich_periodica_selfirm_mask();
|
|
|
|
};
|
|
|
|
|
|
|
|
TDich_periodica_selfirm_mask::TDich_periodica_selfirm_mask() : TAutomask("cg5700a")
|
|
|
|
{
|
2003-04-07 14:44:34 +00:00
|
|
|
_ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"),
|
|
|
|
HR("Cod.@5|Ragione Sociale@50"));
|
1999-10-22 10:00:18 +00:00
|
|
|
TDate oggi(TODAY);
|
|
|
|
|
|
|
|
_year = oggi.year();
|
|
|
|
|
|
|
|
build_nomiditte();
|
|
|
|
build_ditte_sheet();
|
|
|
|
}
|
|
|
|
|
|
|
|
TDich_periodica_selfirm_mask::~TDich_periodica_selfirm_mask()
|
|
|
|
{
|
|
|
|
delete _ditte;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TDich_periodica_selfirm_mask::build_nomiditte()
|
|
|
|
{
|
2003-02-25 14:39:02 +00:00
|
|
|
TString cod;
|
2003-04-07 14:44:34 +00:00
|
|
|
TRelation relditte(LF_NDITTE);
|
|
|
|
TRectype & ditta = relditte.lfile().curr();
|
|
|
|
TCursor cur(&relditte);
|
|
|
|
const TRecnotype items = cur.items();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-04-07 14:44:34 +00:00
|
|
|
cur.freeze();
|
1999-10-22 10:00:18 +00:00
|
|
|
_nomiditte.destroy();
|
2003-04-07 14:44:34 +00:00
|
|
|
for (cur = 0L; cur.pos() < items; ++cur)
|
1999-10-22 10:00:18 +00:00
|
|
|
{
|
2003-04-07 14:44:34 +00:00
|
|
|
const long codditta = ditta.get_long("CODDITTA");
|
2000-10-03 13:45:12 +00:00
|
|
|
bool good = prefix().exist(codditta);
|
2003-04-07 14:44:34 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
if (good)
|
2000-05-05 15:25:49 +00:00
|
|
|
{
|
2000-10-03 13:45:12 +00:00
|
|
|
TToken_string* d = new TToken_string(64);
|
|
|
|
d->add(codditta);
|
2003-04-07 14:44:34 +00:00
|
|
|
d->add(ditta.get("RAGSOC"));
|
2000-10-03 13:45:12 +00:00
|
|
|
_nomiditte.add(d);
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TDich_periodica_selfirm_mask::build_ditte_sheet()
|
|
|
|
{
|
|
|
|
_ditte->destroy();
|
|
|
|
long prima = -1;
|
|
|
|
|
|
|
|
for (int i = 0; i < _nomiditte.items(); i++)
|
|
|
|
{
|
|
|
|
TToken_string* d = new TToken_string(_nomiditte.row(i));
|
|
|
|
const long pos = _ditte->add(d);
|
|
|
|
const char vers = d->get_char(2);
|
|
|
|
const bool selectable = vers != '?';
|
|
|
|
_ditte->enable_row(pos, selectable);
|
|
|
|
if (selectable && prima < 0)
|
|
|
|
_ditte->select(prima = pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TDich_periodica_selfirm_mask::select_button()
|
|
|
|
{
|
|
|
|
if (_ditte->run() == K_ENTER)
|
|
|
|
{
|
|
|
|
TToken_string& row = _ditte->row(_ditte->selected());
|
|
|
|
set(F_CODDITTA, row.get(0));
|
|
|
|
set(F_RAGSOC, row.get(1));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
{
|
|
|
|
switch (o.dlg())
|
|
|
|
{
|
|
|
|
case F_CODDITTA:
|
|
|
|
if (e == fe_button)
|
|
|
|
return select_button();
|
|
|
|
|
|
|
|
if (e == fe_modify)
|
|
|
|
{
|
|
|
|
bool found = FALSE;
|
|
|
|
TString16 ditta = o.get();
|
|
|
|
for (int i = 0; i < _ditte->items(); i++)
|
|
|
|
{
|
|
|
|
TToken_string& row = _ditte->row(i);
|
|
|
|
if (ditta == row.get(0))
|
|
|
|
{
|
|
|
|
if (_ditte->row_enabled(i))
|
|
|
|
{
|
|
|
|
set(F_CODDITTA, row.get(0));
|
|
|
|
set(F_RAGSOC, row.get(1));
|
|
|
|
found = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-04-07 14:44:34 +00:00
|
|
|
warning_box(FR("Non sono definiti i parametri liquidazione per la ditta %ld"),
|
1999-10-22 10:00:18 +00:00
|
|
|
atol(ditta));
|
|
|
|
o.reset();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
o.reset();
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case F_RAGSOC:
|
|
|
|
if (e == fe_button)
|
|
|
|
return select_button();
|
|
|
|
if (e == fe_modify)
|
|
|
|
{
|
|
|
|
bool found = FALSE;
|
|
|
|
TString16 ditta = o.get();
|
|
|
|
for (int i = 0; i < _ditte->items(); i++)
|
|
|
|
{
|
|
|
|
TToken_string& row = _ditte->row(i);
|
|
|
|
TString ts(row.get(1));
|
|
|
|
if (ts.find(ditta) != -1)
|
|
|
|
{
|
|
|
|
if (_ditte->row_enabled(i))
|
|
|
|
{
|
|
|
|
set(F_CODDITTA, row.get(0));
|
|
|
|
set(F_RAGSOC, row.get(1));
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) o.reset();
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case F_YEAR:
|
|
|
|
if (e == fe_modify)
|
|
|
|
{
|
|
|
|
_year = atoi(o.get());
|
|
|
|
build_nomiditte();
|
|
|
|
build_ditte_sheet();
|
|
|
|
set(F_CODDITTA, "");
|
|
|
|
set(F_RAGSOC, "");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2001-05-01 08:17:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool change_prompt(TString& p, int year)
|
|
|
|
{
|
|
|
|
bool changed = FALSE;
|
|
|
|
if (p.left(2) == "VP")
|
|
|
|
{
|
|
|
|
const int vp = atoi(p.mid(2,2));
|
|
|
|
if (year >= 2001)
|
|
|
|
{
|
|
|
|
if (vp >= 5)
|
|
|
|
{
|
|
|
|
switch (vp)
|
|
|
|
{
|
|
|
|
case 6:
|
2003-04-07 14:44:34 +00:00
|
|
|
p = TR("VP11 - IVA detratta per il periodo");
|
2001-05-01 08:17:07 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
2003-04-07 14:44:34 +00:00
|
|
|
p = TR("VP14 - IVA non versata o in eccesso da dich. prec.");
|
2001-05-01 08:17:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TString4 n;
|
|
|
|
n.format("%2d", vp+5);
|
|
|
|
p.overwrite(n, 2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class TDich_periodica_iva_form : public TForm
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TDich_periodica_iva_form(int anno);
|
|
|
|
};
|
|
|
|
|
|
|
|
TDich_periodica_iva_form::TDich_periodica_iva_form(int anno) : TForm("cg5700a")
|
|
|
|
{
|
|
|
|
if (anno > 2000)
|
|
|
|
{
|
|
|
|
TPrint_section& b = section('B', odd_page);
|
|
|
|
TString p;
|
|
|
|
for (int i = b.fields()-1; i > 0; i--)
|
|
|
|
{
|
|
|
|
TForm_item& f = b.field(i);
|
|
|
|
p = f.prompt();
|
|
|
|
if (change_prompt(p, anno))
|
|
|
|
f.set_prompt(p);
|
|
|
|
}
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class TDich_periodica_iva_mask : public TAutomask
|
|
|
|
{
|
|
|
|
TDich_periodica_selfirm_mask * _sf;
|
|
|
|
bool _dirty_versament, // Sporco versamento...
|
|
|
|
_is_euro; // importi in euro
|
|
|
|
protected:
|
|
|
|
void read_iva_data();
|
2000-10-03 13:45:12 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
public:
|
|
|
|
void set_prospect();
|
|
|
|
void print_prospect();
|
|
|
|
virtual bool on_key(KEY k);
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
TDich_periodica_iva_mask(TDich_periodica_selfirm_mask *m);
|
|
|
|
virtual ~TDich_periodica_iva_mask() {};
|
|
|
|
};
|
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask *m)
|
|
|
|
: TAutomask("cg5700b")
|
1999-10-22 10:00:18 +00:00
|
|
|
{
|
|
|
|
_sf = m;
|
2001-05-01 08:17:07 +00:00
|
|
|
|
|
|
|
const int anno = _sf->get_int(F_YEAR);
|
|
|
|
if (anno > 2000)
|
|
|
|
{
|
|
|
|
TString p;
|
|
|
|
for (int i = fields()-1; i > 0; i--)
|
|
|
|
{
|
|
|
|
TMask_field& f = fld(i);
|
|
|
|
p = f.prompt();
|
|
|
|
if (change_prompt(p, anno))
|
|
|
|
f.set_prompt(p);
|
|
|
|
}
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TDich_periodica_iva_mask::read_iva_data()
|
|
|
|
{
|
2003-05-05 14:32:23 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
TString16 key;
|
2003-04-07 14:44:34 +00:00
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
key.format("%4d13", _sf->get_year());
|
2003-05-05 14:32:23 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-04-07 14:44:34 +00:00
|
|
|
const TRectype & lim = cache().get("LIM", key);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-04-07 14:44:34 +00:00
|
|
|
if (lim.get_bool("B0"))
|
1999-10-22 10:00:18 +00:00
|
|
|
{
|
2003-04-07 14:44:34 +00:00
|
|
|
const TRectype & lam = cache().get("LAM", key);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
TString descrizione(120);
|
|
|
|
descrizione = lim.get("S0");
|
1999-10-22 10:00:18 +00:00
|
|
|
descrizione << lim.get("S1");
|
|
|
|
const bool exclude_sign = descrizione.find("$$") >= 0 || descrizione.find(">>") >= 0;
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
real cd1_1 = ZERO;
|
|
|
|
real cd1_2 = ZERO;
|
|
|
|
real cd1_3 = ZERO;
|
|
|
|
real cd1_4 = ZERO;
|
|
|
|
real cd2_1 = ZERO;
|
|
|
|
real cd2_2 = ZERO;
|
|
|
|
real cd2_3 = ZERO;
|
|
|
|
real cd2_4 = ZERO;
|
2010-02-02 22:02:40 +00:00
|
|
|
real cd2_5 = ZERO;
|
2003-02-25 14:39:02 +00:00
|
|
|
real cd3_1 = ZERO;
|
|
|
|
real cd3_2 = ZERO;
|
2005-02-17 18:13:12 +00:00
|
|
|
real cd3_3 = ZERO;
|
|
|
|
real cd3_4 = ZERO;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-04-07 14:44:34 +00:00
|
|
|
TRelation relpum("PUM");
|
|
|
|
TRectype & pum = relpum.curr();
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
key.format("%04d",_sf->get_year());
|
2003-05-05 14:32:23 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
pum.put("CODTAB", key);
|
2003-04-07 14:44:34 +00:00
|
|
|
TCursor cur(&relpum, "", 1, &pum, &pum);
|
|
|
|
const TRecnotype items = cur.items();
|
|
|
|
|
|
|
|
cur.freeze();
|
|
|
|
for (cur = 0L; cur.pos() < items; ++cur)
|
2003-02-25 14:39:02 +00:00
|
|
|
{
|
2003-04-07 14:44:34 +00:00
|
|
|
const TString & codtab = pum.get("CODTAB");
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-05-05 14:32:23 +00:00
|
|
|
const TString& annoiva = codtab.left(4);
|
|
|
|
if (annoiva != key)
|
|
|
|
break;
|
2003-04-07 14:44:34 +00:00
|
|
|
if (atoi(codtab.right(2)) == 13) // Solo annuale
|
|
|
|
{
|
|
|
|
cd1_1 += pum.get_real("R14");
|
|
|
|
cd1_2 += pum.get_real("R15");
|
|
|
|
cd1_3 += pum.get_real("R16");
|
|
|
|
cd1_4 += pum.get_real("R17");
|
|
|
|
cd2_1 += pum.get_real("R18");
|
|
|
|
cd2_2 += pum.get_real("R19");
|
|
|
|
cd2_3 += pum.get_real("R20");
|
|
|
|
cd2_4 += pum.get_real("R21");
|
|
|
|
cd3_1 += pum.get_real("R22");
|
|
|
|
cd3_2 += pum.get_real("R23");
|
2005-02-17 18:13:12 +00:00
|
|
|
cd3_3 += pum.get_real("R24");
|
|
|
|
cd3_4 += pum.get_real("R25");
|
2010-02-02 22:02:40 +00:00
|
|
|
cd2_5 += pum.get_real("R26");
|
2003-04-07 14:44:34 +00:00
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-05-05 14:32:23 +00:00
|
|
|
}
|
|
|
|
// Arrotondare tutto all'Euro
|
|
|
|
cd1_1.round(); cd1_2.round(); cd1_3.round(); cd1_4.round();
|
2010-02-02 22:02:40 +00:00
|
|
|
cd2_1.round(); cd2_2.round(); cd2_3.round(); cd2_4.round(); cd2_5.round();
|
2005-02-17 18:13:12 +00:00
|
|
|
cd3_1.round(); cd3_2.round(); cd3_3.round(); cd3_3.round();
|
2003-05-05 14:32:23 +00:00
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
const real rettifica = lim.get_real("R5"); // Rettifiche
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-05-09 09:33:18 +00:00
|
|
|
real cd4 = lam.get_real("R0"); // Iva esigibile per il periodo
|
2003-04-07 14:44:34 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
if (rettifica > ZERO)
|
2003-02-25 14:39:02 +00:00
|
|
|
cd4 += rettifica;
|
2003-05-05 14:32:23 +00:00
|
|
|
cd4.round();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
real cd5 = lam.get_real("R1"); // Iva che si detrae per il periodo
|
1999-10-22 10:00:18 +00:00
|
|
|
if (rettifica < ZERO && !exclude_sign)
|
2003-02-25 14:39:02 +00:00
|
|
|
cd5 += abs(rettifica);
|
2003-05-05 14:32:23 +00:00
|
|
|
cd5.round();
|
2003-02-25 14:39:02 +00:00
|
|
|
|
|
|
|
const real cd6 = cd4 - cd5; // IVA a debito o credito per il periodo
|
|
|
|
real cd6_1, cd6_2;
|
|
|
|
if (cd6 >= ZERO)
|
|
|
|
cd6_1 = cd6;
|
|
|
|
else
|
|
|
|
cd6_2 = -cd6;
|
2001-05-01 08:17:07 +00:00
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
set(F_CD1_1, cd1_1); set(F_CD1_2, cd1_2); set(F_CD1_3, cd1_3); set(F_CD1_4, cd1_4);
|
2010-02-02 22:02:40 +00:00
|
|
|
set(F_CD2_1, cd2_1); set(F_CD2_2, cd2_2); set(F_CD2_3, cd2_3); set(F_CD2_4, cd2_4); set(F_CD2_5, cd2_5);
|
2005-02-17 18:13:12 +00:00
|
|
|
set(F_CD3_1, cd3_1); set(F_CD3_2, cd3_2); set(F_CD3_3, cd3_3); set(F_CD3_4, cd3_4);
|
2003-02-25 14:39:02 +00:00
|
|
|
set(F_CD4, cd4); set(F_CD5, cd5);
|
|
|
|
set(F_CD6_1, cd6_1); set(F_CD6_2, cd6_2);
|
1999-10-22 10:00:18 +00:00
|
|
|
}
|
|
|
|
else
|
2003-05-09 09:33:18 +00:00
|
|
|
error_box("Risultati liquidazione non presenti o da ricalcolare per l'anno %d.", _sf->get_year());
|
2003-05-05 14:32:23 +00:00
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TDich_periodica_iva_mask::print_prospect()
|
|
|
|
{
|
2001-05-01 08:17:07 +00:00
|
|
|
const int anno = _sf->get_int(F_YEAR);
|
|
|
|
TDich_periodica_iva_form frm(anno);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
frm.find_field('B', odd_page, FF_YEAR).set(get(F_YEAR));
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
frm.find_field('B', odd_page, FF_CD1_1).set(get(F_CD1_1));
|
|
|
|
frm.find_field('B', odd_page, FF_CD1_2).set(get(F_CD1_2));
|
|
|
|
frm.find_field('B', odd_page, FF_CD1_3).set(get(F_CD1_3));
|
|
|
|
frm.find_field('B', odd_page, FF_CD1_4).set(get(F_CD1_4));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
frm.find_field('B', odd_page, FF_CD2_1).set(get(F_CD2_1));
|
|
|
|
frm.find_field('B', odd_page, FF_CD2_2).set(get(F_CD2_2));
|
|
|
|
frm.find_field('B', odd_page, FF_CD2_3).set(get(F_CD2_3));
|
|
|
|
frm.find_field('B', odd_page, FF_CD2_4).set(get(F_CD2_4));
|
2010-02-02 22:02:40 +00:00
|
|
|
frm.find_field('B', odd_page, FF_CD2_5).set(get(F_CD2_5));
|
2003-02-25 14:39:02 +00:00
|
|
|
|
|
|
|
frm.find_field('B', odd_page, FF_CD3_1).set(get(F_CD3_1));
|
|
|
|
frm.find_field('B', odd_page, FF_CD3_2).set(get(F_CD3_2));
|
|
|
|
|
2005-02-17 18:13:12 +00:00
|
|
|
frm.find_field('B', odd_page, FF_CD3_3).set(get(F_CD3_3));
|
|
|
|
frm.find_field('B', odd_page, FF_CD3_4).set(get(F_CD3_3));
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
frm.find_field('B', odd_page, FF_CD4).set(get(F_CD4));
|
|
|
|
frm.find_field('B', odd_page, FF_CD5).set(get(F_CD5));
|
|
|
|
|
|
|
|
frm.find_field('B', odd_page, FF_CD6_1).set(get(F_CD6_1));
|
|
|
|
frm.find_field('B', odd_page, FF_CD6_2).set(get(F_CD6_2));
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
TRectype f(LF_NDITTE);
|
|
|
|
f.put(NDT_CODDITTA, get(F_CODDITTA));
|
|
|
|
|
2003-05-05 14:32:23 +00:00
|
|
|
frm.cursor()->setregion(f,f);
|
1999-10-22 10:00:18 +00:00
|
|
|
frm.print();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TDich_periodica_iva_mask::set_prospect()
|
|
|
|
{
|
|
|
|
CHECK(_sf, "Invalid mask");
|
|
|
|
|
|
|
|
_dirty_versament = FALSE;
|
|
|
|
|
2002-02-26 16:20:19 +00:00
|
|
|
const int anno = _sf->get_year();
|
|
|
|
const long ditta = _sf->get_long(F_CODDITTA);
|
|
|
|
|
|
|
|
set(F_YEAR, anno);
|
|
|
|
set(F_CODDITTA, ditta);
|
1999-10-22 10:00:18 +00:00
|
|
|
set(F_RAGSOC, _sf->get(F_RAGSOC));
|
|
|
|
|
2002-02-26 16:20:19 +00:00
|
|
|
TFirm frm(ditta);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2002-02-26 16:20:19 +00:00
|
|
|
TIva_round ir;
|
|
|
|
ir.set_default_iva_mode(anno, FALSE, ditta);
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
read_iva_data();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TDich_periodica_iva_mask::on_key(KEY k)
|
|
|
|
{
|
|
|
|
return TAutomask::on_key(k);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TDich_periodica_iva_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
class TDich_periodica_iva_app : public TSkeleton_application
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual bool create();
|
|
|
|
virtual bool destroy();
|
|
|
|
virtual void main_loop();
|
|
|
|
public:
|
|
|
|
virtual bool firm_change_enabled() const { return FALSE; }
|
|
|
|
TDich_periodica_iva_app () {};
|
|
|
|
virtual ~TDich_periodica_iva_app () {};
|
|
|
|
};
|
|
|
|
|
|
|
|
bool TDich_periodica_iva_app::create()
|
|
|
|
{
|
2000-10-03 13:45:12 +00:00
|
|
|
open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0);
|
1999-10-22 10:00:18 +00:00
|
|
|
return TSkeleton_application::create();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TDich_periodica_iva_app::destroy()
|
|
|
|
{
|
|
|
|
return TSkeleton_application::destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TDich_periodica_iva_app::main_loop()
|
|
|
|
{
|
2003-02-25 14:39:02 +00:00
|
|
|
const long ditta = get_firm();
|
|
|
|
|
|
|
|
TDich_periodica_selfirm_mask* m1 = new TDich_periodica_selfirm_mask();
|
|
|
|
while (m1->run() != K_QUIT)
|
1999-10-22 10:00:18 +00:00
|
|
|
{
|
2003-02-25 14:39:02 +00:00
|
|
|
if (m1->get(F_CODDITTA).empty() || m1->get(F_RAGSOC).empty())
|
1999-10-22 10:00:18 +00:00
|
|
|
{
|
2003-04-07 14:44:34 +00:00
|
|
|
error_box(TR("Selezionare una ditta"));
|
1999-10-22 10:00:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
set_firm(m1->get_long(F_CODDITTA));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
TDich_periodica_iva_mask* m2 = new TDich_periodica_iva_mask(m1);
|
2001-05-01 08:17:07 +00:00
|
|
|
m2->reset();
|
|
|
|
m2->enable_default();
|
|
|
|
m2->set_prospect();
|
|
|
|
if (m2->run() == K_ENTER)
|
|
|
|
m2->print_prospect();
|
2003-02-25 14:39:02 +00:00
|
|
|
delete m2;
|
1999-10-22 10:00:18 +00:00
|
|
|
}
|
2003-02-25 14:39:02 +00:00
|
|
|
delete m1;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
set_firm(ditta);
|
|
|
|
}
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
int cg5700(int argc, char* argv[])
|
1999-10-22 10:00:18 +00:00
|
|
|
{
|
|
|
|
TDich_periodica_iva_app a;
|
2005-02-17 18:13:12 +00:00
|
|
|
a.run(argc, argv, TR("Comunicazione annuale dati IVA"));
|
1999-10-22 10:00:18 +00:00
|
|
|
return 0;
|
2003-05-05 14:32:23 +00:00
|
|
|
}
|