Aggiunta prima gestione di base dello split payment
git-svn-id: svn://10.65.10.50/branches/R_10_00@23036 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9da5c33da5
commit
848151dff5
@ -82,9 +82,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
virtual bool get_next_key(TToken_string& key);
|
virtual bool get_next_key(TToken_string& key);
|
||||||
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
|
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
|
||||||
virtual bool check_autorization() const
|
virtual bool check_autorization() const { return false; }
|
||||||
{return false;}
|
virtual TRelation* get_relation() const { return (TRelation*)_rel; }
|
||||||
virtual TRelation* get_relation() const {return (TRelation*)_rel;}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline TClifo_application& app() { return (TClifo_application&)main_app(); }
|
inline TClifo_application& app() { return (TClifo_application&)main_app(); }
|
||||||
@ -517,8 +516,8 @@ HIDDEN bool alleg_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
if (f.to_check(key, true))
|
if (f.to_check(key, true))
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
|
||||||
const int tipoall = atoi(f.get());
|
const int tipoall = atoi(f.get());
|
||||||
|
TMask& m = f.mask();
|
||||||
|
|
||||||
if (key == K_ENTER)
|
if (key == K_ENTER)
|
||||||
{
|
{
|
||||||
@ -545,6 +544,7 @@ HIDDEN bool alleg_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
if (tipoall == 2)
|
if (tipoall == 2)
|
||||||
m.set(F_OCCASIONALE, "X");
|
m.set(F_OCCASIONALE, "X");
|
||||||
|
m.show(F_SPLITPAY, (tipoall == 4 || tipoall == 7) && m.get(F_TIPOCF)=="C");
|
||||||
m.field(F_COFI).set_dirty(true);
|
m.field(F_COFI).set_dirty(true);
|
||||||
m.field(F_PAIV).set_dirty(true);
|
m.field(F_PAIV).set_dirty(true);
|
||||||
}
|
}
|
||||||
@ -633,8 +633,8 @@ HIDDEN bool contrlav_handler(TMask_field& f, KEY key)
|
|||||||
void TClifo_application::on_config_change()
|
void TClifo_application::on_config_change()
|
||||||
{
|
{
|
||||||
TConfig cnf(CONFIG_DITTA);
|
TConfig cnf(CONFIG_DITTA);
|
||||||
_gesven = cnf.get_bool("GesVen") || !_has_cg;
|
_gesven = !_has_cg || (cnf.get_bool("GesVen") || main_app().has_module(PAAUT));
|
||||||
_gessal = cnf.get_bool("GesSal") || !_has_cg;
|
_gessal = !_has_cg || cnf.get_bool("GesSal");
|
||||||
_lbcn = cnf.get_bool("GsLbCn");
|
_lbcn = cnf.get_bool("GsLbCn");
|
||||||
_liscatven = cnf.get_bool("GESLISCV", "ve");
|
_liscatven = cnf.get_bool("GESLISCV", "ve");
|
||||||
_geslv = _gesven && main_app().has_module(LVAUT);
|
_geslv = _gesven && main_app().has_module(LVAUT);
|
||||||
@ -678,7 +678,7 @@ void TClifo_application::init_insert_mode(TMask& m)
|
|||||||
{
|
{
|
||||||
init_query_mode(m);
|
init_query_mode(m);
|
||||||
m.enable_page(4, _gesven);
|
m.enable_page(4, _gesven);
|
||||||
if(_gesven)
|
if (_gesven)
|
||||||
{
|
{
|
||||||
m.enable_page(10, _geslv);
|
m.enable_page(10, _geslv);
|
||||||
if (_geslv)
|
if (_geslv)
|
||||||
|
@ -158,6 +158,13 @@
|
|||||||
#define F_PADESTIN 263
|
#define F_PADESTIN 263
|
||||||
#define F_PARIFAMM 264
|
#define F_PARIFAMM 264
|
||||||
|
|
||||||
|
#define F_PRODACC 271
|
||||||
|
#define F_PRODALL 272
|
||||||
|
#define F_PRODCAR 273
|
||||||
|
#define F_PRODPLA 274
|
||||||
|
#define F_PRODLEG 275
|
||||||
|
#define F_PRODVET 276
|
||||||
|
|
||||||
#define DLG_RIC 300
|
#define DLG_RIC 300
|
||||||
#define DLG_CST 301
|
#define DLG_CST 301
|
||||||
#define F_RAGSOCA 302
|
#define F_RAGSOCA 302
|
||||||
@ -174,6 +181,7 @@
|
|||||||
#define F_ENTE 313
|
#define F_ENTE 313
|
||||||
#define F_DESENTE 314
|
#define F_DESENTE 314
|
||||||
#define F_INDENTE 315
|
#define F_INDENTE 315
|
||||||
|
#define F_SPLITPAY 316
|
||||||
|
|
||||||
#define F_TPIMBALLO 401
|
#define F_TPIMBALLO 401
|
||||||
#define F_DIMENSIONE 402
|
#define F_DIMENSIONE 402
|
||||||
|
@ -299,7 +299,7 @@ BEGIN
|
|||||||
ITEM "1|Non valido per allegato IVA"
|
ITEM "1|Non valido per allegato IVA"
|
||||||
ITEM "2|Occasionale"
|
ITEM "2|Occasionale"
|
||||||
ITEM "3|Documenti riepilogativi"
|
ITEM "3|Documenti riepilogativi"
|
||||||
ITEM "4|Codice fiscale gia' inserito"
|
ITEM "4|Codice fiscale già inserito"
|
||||||
ITEM "5|Estero CEE"
|
ITEM "5|Estero CEE"
|
||||||
ITEM "6|Privato"
|
ITEM "6|Privato"
|
||||||
ITEM "7|Ente pubblico"
|
ITEM "7|Ente pubblico"
|
||||||
@ -351,6 +351,12 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SPLITPAY
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 15 "Ente soggetto a 'SCISSIONE DEI PAGAMENTI' ai sensi art. 17-ter D.P.R. 633/72"
|
||||||
|
FIELD SPLITPAY
|
||||||
|
END
|
||||||
|
|
||||||
BOOLEAN F_OCCASIONALE
|
BOOLEAN F_OCCASIONALE
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 16 "Occasionale "
|
PROMPT 2 16 "Occasionale "
|
||||||
@ -1419,87 +1425,128 @@ BEGIN
|
|||||||
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
|
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE F_DATAECONAI
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 12 "Data fine esenz.CONAI "
|
|
||||||
FIELD LF_CFVEN->DATAECONAI
|
|
||||||
GROUP 8
|
|
||||||
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_CONAIASS
|
BOOLEAN F_CONAIASS
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 43 12 "Stampa contributo CONAI assolto"
|
PROMPT 30 11 "Stampa 'Contributo CONAI assolto'"
|
||||||
FIELD LF_CFVEN->CONAIASS
|
FIELD LF_CFVEN->CONAIASS
|
||||||
MESSAGE FALSE ENABLE,F_ADDCONAI
|
MESSAGE FALSE ENABLE,F_ADDCONAI
|
||||||
MESSAGE TRUE CLEAR,F_ADDCONAI
|
MESSAGE TRUE CLEAR,F_ADDCONAI
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 76 4
|
DATE F_DATAECONAI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 12 "Data fine esenzione "
|
||||||
|
FIELD LF_CFVEN->DATAECONAI
|
||||||
|
GROUP 8
|
||||||
|
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 38 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 13 "@bEsenzioni CONAI"
|
PROMPT 1 13 "@bEsenzioni CONAI"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ESACC 6 2
|
NUMBER F_ESACC 6 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 14 "Acciaio "
|
PROMPT 2 14 "Acciaio "
|
||||||
FIELD LF_CFVEN->ESACC
|
FIELD LF_CFVEN->ESACC
|
||||||
GROUP 8
|
GROUP 8
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ESALL 6 2
|
NUMBER F_ESALL 6 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 14 "Alluminio "
|
PROMPT 20 14 "Alluminio "
|
||||||
FIELD LF_CFVEN->ESALL
|
FIELD LF_CFVEN->ESALL
|
||||||
GROUP 8
|
GROUP 8
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ESCAR 6 2
|
NUMBER F_ESCAR 6 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 50 14 "Carta "
|
PROMPT 2 15 "Carta "
|
||||||
FIELD LF_CFVEN->ESCAR
|
FIELD LF_CFVEN->ESCAR
|
||||||
GROUP 8
|
GROUP 8
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ESPLA 6 2
|
NUMBER F_ESPLA 6 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 15 "Plastica "
|
PROMPT 20 15 "Plastica "
|
||||||
FIELD LF_CFVEN->ESPLA
|
FIELD LF_CFVEN->ESPLA
|
||||||
GROUP 8
|
GROUP 8
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ESLEG 6 2
|
NUMBER F_ESLEG 6 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 15 "Legno "
|
PROMPT 2 16 "Legno "
|
||||||
FIELD LF_CFVEN->ESLEG
|
FIELD LF_CFVEN->ESLEG
|
||||||
GROUP 8
|
GROUP 8
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_ESVET 6 2
|
NUMBER F_ESVET 6 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 50 15 "Vetro "
|
PROMPT 20 16 "Vetro "
|
||||||
FIELD LF_CFVEN->ESVET
|
FIELD LF_CFVEN->ESVET
|
||||||
GROUP 8
|
GROUP 8
|
||||||
END
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 35 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 42 13 "@bProduttore CONAI"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PRODACC
|
||||||
|
BEGIN
|
||||||
|
PROMPT 43 14 "Acciao"
|
||||||
|
FIELD LF_CFVEN->PRODCONAI[1,1]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PRODALL
|
||||||
|
BEGIN
|
||||||
|
PROMPT 62 14 "Alluminio"
|
||||||
|
FIELD LF_CFVEN->PRODCONAI[2,2]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PRODCAR
|
||||||
|
BEGIN
|
||||||
|
PROMPT 43 15 "Carta"
|
||||||
|
FIELD LF_CFVEN->PRODCONAI[3,3]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PRODPLA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 62 15 "Plastica"
|
||||||
|
FIELD LF_CFVEN->PRODCONAI[4,4]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PRODLEG
|
||||||
|
BEGIN
|
||||||
|
PROMPT 43 16 "Legno"
|
||||||
|
FIELD LF_CFVEN->PRODCONAI[5,5]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PRODVET
|
||||||
|
BEGIN
|
||||||
|
PROMPT 62 16 "Vetro"
|
||||||
|
FIELD LF_CFVEN->PRODCONAI[6,6]
|
||||||
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 76 3
|
GROUPBOX DLG_NULL 76 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 17 "@bFatture Elettroniche P.A."
|
PROMPT 1 18 "@bFattura elettronica Pubblica Amministrazione"
|
||||||
MODULES PA
|
MODULES PA
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PADESTIN 6
|
STRING F_PADESTIN 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 18 "Destinatario "
|
PROMPT 2 19 "Destinatario "
|
||||||
FLAGS "U"
|
FLAGS "U"
|
||||||
MODULES PA
|
MODULES PA
|
||||||
HELP "Codice dell'ufficio dell'amministrazione destinatario della fattura"
|
HELP "Codice dell'ufficio dell'amministrazione destinatario della fattura elettronica"
|
||||||
FIELD LF_CFVEN->PADESTIN
|
FIELD LF_CFVEN->PADESTIN
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PARIFAMM 20
|
STRING F_PARIFAMM 20
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 27 18 "Riferimento amministrazione "
|
PROMPT 27 19 "Riferimento amministrazione "
|
||||||
FLAGS "U"
|
FLAGS "U"
|
||||||
MODULES PA
|
MODULES PA
|
||||||
HELP "Codice del cedente presso l'amministrazione"
|
HELP "Codice del cedente presso l'amministrazione"
|
||||||
@ -2132,6 +2179,7 @@ GROUPBOX DLG_NULL 78 14
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 4 "@bLavanderie"
|
PROMPT 0 4 "@bLavanderie"
|
||||||
GROUP G_LV
|
GROUP G_LV
|
||||||
|
MODULE LV
|
||||||
END
|
END
|
||||||
|
|
||||||
LISTBOX F_TPIMBALLO 10
|
LISTBOX F_TPIMBALLO 10
|
||||||
@ -2141,16 +2189,18 @@ BEGIN
|
|||||||
ITEM "C|Carrello"
|
ITEM "C|Carrello"
|
||||||
FIELD 41@->S0 //LVAUT = 41
|
FIELD 41@->S0 //LVAUT = 41
|
||||||
GROUP G_LV
|
GROUP G_LV
|
||||||
|
MODULE LV
|
||||||
END
|
END
|
||||||
|
|
||||||
LISTBOX F_DIMENSIONE 2
|
LISTBOX F_DIMENSIONE 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 26 5 "Dimensione "
|
PROMPT 30 5 "Dimensione "
|
||||||
ITEM "XS|XS"
|
ITEM "XS|XS"
|
||||||
ITEM "M|M"
|
ITEM "M|M"
|
||||||
ITEM "XL|XL"
|
ITEM "XL|XL"
|
||||||
FIELD 41@->S2 //LVAUT = 41
|
FIELD 41@->S2 //LVAUT = 41
|
||||||
GROUP G_LV
|
GROUP G_LV
|
||||||
|
MODULE LV
|
||||||
END
|
END
|
||||||
|
|
||||||
LISTBOX F_RIEMPIMENTO 24
|
LISTBOX F_RIEMPIMENTO 24
|
||||||
@ -2160,6 +2210,7 @@ BEGIN
|
|||||||
ITEM "P|Proporzionale"
|
ITEM "P|Proporzionale"
|
||||||
FIELD 41@->S1
|
FIELD 41@->S1
|
||||||
GROUP G_LV
|
GROUP G_LV
|
||||||
|
MODULE LV
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_ARTSEP
|
BOOLEAN F_ARTSEP
|
||||||
@ -2167,6 +2218,7 @@ BEGIN
|
|||||||
PROMPT 1 7 "Articoli separati"
|
PROMPT 1 7 "Articoli separati"
|
||||||
FIELD 41@->B0 //LVAUT = 41
|
FIELD 41@->B0 //LVAUT = 41
|
||||||
GROUP G_LV
|
GROUP G_LV
|
||||||
|
MODULE LV
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
@ -226,17 +226,10 @@ const char* TProgressivi_iva::desc_iva(const TString& cod)
|
|||||||
if (cod == "{AF")
|
if (cod == "{AF")
|
||||||
return TR("Artt.17c3/74c1");
|
return TR("Artt.17c3/74c1");
|
||||||
|
|
||||||
else if (cod == "{VA7")
|
if (cod == "{VA7")
|
||||||
return TR("Art.40c5/6/8 a.i.");
|
return TR("Art.40c5/6/8 a.i.");
|
||||||
|
|
||||||
else
|
return cache().get("%IVA", cod, "S0");
|
||||||
{
|
|
||||||
TString16 codtab; codtab.format("%-4s", (const char*)cod);
|
|
||||||
const TRectype & iva = cache().get("%IVA", codtab);
|
|
||||||
|
|
||||||
return iva.get("S0");
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char TProgressivi_iva::frequenza_versamenti(long ditta, int anno)
|
char TProgressivi_iva::frequenza_versamenti(long ditta, int anno)
|
||||||
|
@ -1852,8 +1852,10 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
_as400 = false;
|
||||||
|
if (ini.set_paragraph("24,1"))
|
||||||
|
_as400 = !ini.exist(RMV_ROWTYPE) && ini.get_int(RMV_NUMRIG) == 1;
|
||||||
|
|
||||||
if (msk.id2pos(F_ANNORIF) > 0)
|
if (msk.id2pos(F_ANNORIF) > 0)
|
||||||
set_not_empty(msk, F_ANNORIF, ini, PART_ANNO);
|
set_not_empty(msk, F_ANNORIF, ini, PART_ANNO);
|
||||||
if (msk.id2pos(F_NUMRIF) > 0)
|
if (msk.id2pos(F_NUMRIF) > 0)
|
||||||
@ -1864,10 +1866,11 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
msk.set(F_SOLAIVA, ini.get("SOLAIVA"));
|
msk.set(F_SOLAIVA, ini.get("SOLAIVA"));
|
||||||
if (msk.id2pos(F_CODIVA) >= 0)
|
if (msk.id2pos(F_CODIVA) >= 0)
|
||||||
msk.set(F_CODIVA, ini.get("CODIVA"));
|
msk.set(F_CODIVA, ini.get("CODIVA"));
|
||||||
|
|
||||||
add_cgs_tot(msk);
|
add_cgs_tot(msk);
|
||||||
|
|
||||||
TSheet_field& is = ivas();
|
TSheet_field& is = ivas();
|
||||||
for (i = 0; ini.set_paragraph(format("%d,%d", LF_RMOVIVA, i+1)); i++)
|
for (int i = 0; ini.set_paragraph(format("%d,%d", LF_RMOVIVA, i+1)); i++)
|
||||||
{
|
{
|
||||||
TToken_string& riga = is.row(i);
|
TToken_string& riga = is.row(i);
|
||||||
|
|
||||||
@ -1896,12 +1899,14 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TSheet_field& cg = cgs();
|
TSheet_field& cg = cgs();
|
||||||
for (i = 0; ini.set_paragraph(format("%d,%d", LF_RMOV, i+1)); i++)
|
for (int i = 0; ini.set_paragraph(format("%d,%d", LF_RMOV, i+1)); i++)
|
||||||
{
|
{
|
||||||
char tipo = ini.get_char(RMV_ROWTYPE);
|
char tipo = ini.get_char(RMV_ROWTYPE);
|
||||||
if (tipo == '\0') tipo = ' ';
|
if (tipo < ' ') tipo = ' ';
|
||||||
|
|
||||||
TBill conto; ini2bill(ini, conto, false);
|
TBill conto; ini2bill(ini, conto, false);
|
||||||
|
if (_as400 && conto.tipo() <= ' ')
|
||||||
|
conto.find();
|
||||||
|
|
||||||
int numrig = ini.get_int(RMV_NUMRIG)-1;
|
int numrig = ini.get_int(RMV_NUMRIG)-1;
|
||||||
if (numrig != i) // Controllo se ho un numero riga valido
|
if (numrig != i) // Controllo se ho un numero riga valido
|
||||||
@ -1926,7 +1931,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
|
|
||||||
TToken_string& riga = cg.row(numrig);
|
TToken_string& riga = cg.row(numrig);
|
||||||
|
|
||||||
if (numrig < 0 || !(cg.cell_disabled(numrig, 0) && cg.cell_disabled(numrig, 1)))
|
if (numrig < 0 || _as400 || !(cg.cell_disabled(numrig, 0) && cg.cell_disabled(numrig, 1)))
|
||||||
{
|
{
|
||||||
TString4 sez = ini.get(RMV_SEZIONE); sez.strip("\"");
|
TString4 sez = ini.get(RMV_SEZIONE); sez.strip("\"");
|
||||||
if (sez == "A" || sez == "D")
|
if (sez == "A" || sez == "D")
|
||||||
@ -1973,7 +1978,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
const int start_items = pag.items();
|
const int start_items = pag.items();
|
||||||
|
|
||||||
msk.reset(FS_RECALC); // Disabilita ricalcolo automatico
|
msk.reset(FS_RECALC); // Disabilita ricalcolo automatico
|
||||||
for (i = 0; ini.set_paragraph(format("%d,%d", LF_SCADENZE, i+1)); i++)
|
for (int i = 0; ini.set_paragraph(format("%d,%d", LF_SCADENZE, i+1)); i++)
|
||||||
{
|
{
|
||||||
TToken_string& row = pag.row(i);
|
TToken_string& row = pag.row(i);
|
||||||
if (i >= start_items)
|
if (i >= start_items)
|
||||||
@ -1986,6 +1991,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
// pag_notify(pag, i, K_ENTER);
|
// pag_notify(pag, i, K_ENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i;
|
||||||
for (i = 0; i < pag.items(); i++)
|
for (i = 0; i < pag.items(); i++)
|
||||||
{
|
{
|
||||||
TToken_string& row = pag.row(i);
|
TToken_string& row = pag.row(i);
|
||||||
|
@ -147,6 +147,7 @@ BEGIN
|
|||||||
ITEM "Tipo"
|
ITEM "Tipo"
|
||||||
ITEM "Riga pag."
|
ITEM "Riga pag."
|
||||||
ITEM "Blocc."
|
ITEM "Blocc."
|
||||||
|
ITEM "Motivazione@50"
|
||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -295,6 +296,26 @@ END
|
|||||||
BOOLEAN 114
|
BOOLEAN 114
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 8 "Pagamenti bloccati"
|
PROMPT 1 8 "Pagamenti bloccati"
|
||||||
|
MESSAGE FALSE CLEAR,115|CLEAR,116
|
||||||
|
MESSAGE TRUE ENABLE,115
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING 115 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 9 "Motivo "
|
||||||
|
USE %MBP
|
||||||
|
INPUT CODTAB 115
|
||||||
|
DISPLAY "Codice"
|
||||||
|
DISPLAY "Descrizione@50"
|
||||||
|
OUTPUT 115 CODTAB
|
||||||
|
OUTPUT 116 S0
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING 116 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 17 9 ""
|
||||||
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 12 2
|
BUTTON DLG_CANCEL 12 2
|
||||||
|
@ -1411,9 +1411,9 @@ void TPrimanota_application::ivas_pack()
|
|||||||
{
|
{
|
||||||
TToken_string& r = rows.row(i);
|
TToken_string& r = rows.row(i);
|
||||||
const real imponibile(r.get(0));
|
const real imponibile(r.get(0));
|
||||||
if (imponibile != ZERO) continue;
|
if (!imponibile.is_zero()) continue;
|
||||||
const real imposta(r.get(3));
|
const real imposta(r.get(3));
|
||||||
if (imposta != ZERO) continue;
|
if (!imposta.is_zero()) continue;
|
||||||
rows.destroy(i, false);
|
rows.destroy(i, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1553,15 +1553,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
|||||||
if (i.is_zero())
|
if (i.is_zero())
|
||||||
deliva = oldposiva[d];
|
deliva = oldposiva[d];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TBill conto(row, 6);
|
TBill conto(row, 6);
|
||||||
int newpos = bill2pos(conto, 'I'); // Riga in cui andra' l'imponibile
|
int newpos = bill2pos(conto, 'I'); // Riga in cui andra' l'imponibile
|
||||||
|
|
||||||
TImporto newimp = a.real2imp(imponibile, 'I');
|
TImporto newimp = a.real2imp(imponibile, 'I');
|
||||||
newimp.normalize();
|
newimp.normalize();
|
||||||
|
|
||||||
// Aggiorna conto sulla riga contabile
|
// Aggiorna conto sulla riga contabile
|
||||||
if (newpos < 0)
|
if (newpos < 0)
|
||||||
{
|
{
|
||||||
TString saved_descr;
|
TString saved_descr;
|
||||||
@ -1581,7 +1580,6 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
const bool empty = a.add_cgs_imp(newpos, newimp);
|
const bool empty = a.add_cgs_imp(newpos, newimp);
|
||||||
if (empty) // Se la riga si e' azzerata ...
|
if (empty) // Se la riga si e' azzerata ...
|
||||||
@ -2681,11 +2679,24 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_as400)
|
if (_as400)
|
||||||
|
{
|
||||||
|
if (riga_totale >= 0) // Dare e Avere potrebbero essere disabilitati
|
||||||
|
{
|
||||||
|
TToken_string& r = ss.row(riga_totale);
|
||||||
|
if (row_type(r) == 'T')
|
||||||
|
{
|
||||||
|
r.rtrim(2);
|
||||||
|
ss.enable_cell(riga_totale, 0);
|
||||||
|
ss.enable_cell(riga_totale, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Creazione/Aggiornamento riga totale
|
// Creazione/Aggiornamento riga totale
|
||||||
const real tot(m.get(F_TOTALE));
|
const real tot(m.get(F_TOTALE));
|
||||||
TString descr;
|
TString80 descr;
|
||||||
if (riga_totale >= 0)
|
if (riga_totale >= 0)
|
||||||
descr = cgs().row(riga_totale).get(8);
|
descr = cgs().row(riga_totale).get(8);
|
||||||
if (descr.blank())
|
if (descr.blank())
|
||||||
@ -2973,6 +2984,25 @@ static void force_iva_det_bill()
|
|||||||
cgs.force_update();
|
cgs.force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TPrimanota_application::is_split_payment() const
|
||||||
|
{
|
||||||
|
bool yes = false;
|
||||||
|
const TMask& m = curr_mask();
|
||||||
|
if (clifo() == 'C' && m.get_int(F_ANNOIVA) >= 2015)
|
||||||
|
{
|
||||||
|
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CLIENTE));
|
||||||
|
if (cliente.get_bool(CLI_SPLITPAY))
|
||||||
|
{
|
||||||
|
TRelation rel(LF_MOV);
|
||||||
|
rel.add(LF_PARTITE, "NREG==NUMREG", 2);
|
||||||
|
m.autosave(rel);
|
||||||
|
yes = ::is_split_payment(rel.curr()); // Controlla reverse charge e ritenute
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return yes;
|
||||||
|
}
|
||||||
|
|
||||||
// Handler of the F_LIQDIFF
|
// Handler of the F_LIQDIFF
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
bool TPrimanota_application::liqdiff_handler(TMask_field& f, KEY key)
|
bool TPrimanota_application::liqdiff_handler(TMask_field& f, KEY key)
|
||||||
@ -2980,10 +3010,12 @@ bool TPrimanota_application::liqdiff_handler(TMask_field& f, KEY key)
|
|||||||
if (key == K_SPACE && f.mask().is_running())
|
if (key == K_SPACE && f.mask().is_running())
|
||||||
force_iva_det_bill();
|
force_iva_det_bill();
|
||||||
|
|
||||||
if (key == K_ENTER)
|
if (key == K_ENTER && f.get().full())
|
||||||
{
|
{
|
||||||
if (f.get().full() && f.mask().get_bool(F_IVAXCASSA))
|
if (f.mask().get_bool(F_IVAXCASSA))
|
||||||
return f.error_box(TR("Non è ammesso selezionare IVA per cassa e liquidazione differita"));
|
return f.error_box(TR("Non è ammessa l'IVA per cassa a liquidazione differita"));
|
||||||
|
if (app().is_split_payment())
|
||||||
|
return f.error_box(TR("Non è ammessa la liquidazione differita con split payment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2996,10 +3028,10 @@ bool TPrimanota_application::ivaxcassa_handler(TMask_field& f, KEY key)
|
|||||||
if (key == K_SPACE && f.mask().is_running())
|
if (key == K_SPACE && f.mask().is_running())
|
||||||
force_iva_det_bill();
|
force_iva_det_bill();
|
||||||
|
|
||||||
if (key == K_ENTER)
|
if (key == K_ENTER && f.get().full())
|
||||||
{
|
{
|
||||||
if (f.get().full() && f.mask().get_bool(F_LIQDIFF))
|
if (app().is_split_payment())
|
||||||
return f.error_box(TR("Non è ammesso selezionare IVA per cassa e liquidazione differita"));
|
return f.error_box(TR("Non è ammesso l'IVA per cassa con split payment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -213,6 +213,8 @@ protected:
|
|||||||
bool is_fattura() const { return is_saldaconto() && causale().tipomov() == 1; }
|
bool is_fattura() const { return is_saldaconto() && causale().tipomov() == 1; }
|
||||||
bool is_nota_credito() const { return is_saldaconto() && causale().tipomov() == 2; }
|
bool is_nota_credito() const { return is_saldaconto() && causale().tipomov() == 2; }
|
||||||
bool is_pagamento() const { return is_saldaconto() && causale().tipomov() >= 3; }
|
bool is_pagamento() const { return is_saldaconto() && causale().tipomov() >= 3; }
|
||||||
|
bool is_split_payment() const;
|
||||||
|
|
||||||
bool activate_numrif(TMask& m, bool set_pag);
|
bool activate_numrif(TMask& m, bool set_pag);
|
||||||
|
|
||||||
void fill_sheet(TMask& m) const;
|
void fill_sheet(TMask& m) const;
|
||||||
|
@ -68,30 +68,30 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
|||||||
|
|
||||||
// qui viene il bello, si fa per dire
|
// qui viene il bello, si fa per dire
|
||||||
if (news != ts.get(0)) // modificata data scadenza
|
if (news != ts.get(0)) // modificata data scadenza
|
||||||
mod = m_scad = TRUE;
|
mod = m_scad = true;
|
||||||
if (real(newp) != real(ts.get(3))) // modificata percentuale
|
if (real(newp) != real(ts.get(3))) // modificata percentuale
|
||||||
mod = m_perc = TRUE;
|
mod = m_perc = true;
|
||||||
if (real(newl) != real(ts.get(1))) // modificato importo lire
|
if (real(newl) != real(ts.get(1))) // modificato importo lire
|
||||||
{
|
{
|
||||||
// se si modifica la percentuale nessun importo viene cagato
|
// se si modifica la percentuale nessun importo viene cagato
|
||||||
if ((recalc && !m_perc) || (!recalc))
|
if ((recalc && !m_perc) || (!recalc))
|
||||||
mod = m_impl = TRUE;
|
mod = m_impl = true;
|
||||||
}
|
}
|
||||||
if (in_valuta && real(newv) != real(ts.get(2)))
|
if (in_valuta && real(newv) != real(ts.get(2)))
|
||||||
{
|
{
|
||||||
// se si modifica la percentuale nessun importo viene cagato
|
// se si modifica la percentuale nessun importo viene cagato
|
||||||
if ((recalc && !m_perc) || (!recalc))
|
if ((recalc && !m_perc) || (!recalc))
|
||||||
mod = m_impv = TRUE;
|
mod = m_impv = true;
|
||||||
}
|
}
|
||||||
if (newt != ts.get(4)) // modificato tipo pagamento
|
if (newt != ts.get(4)) // modificato tipo pagamento
|
||||||
mod = m_tipo = m_ulc = TRUE;
|
mod = m_tipo = m_ulc = true;
|
||||||
|
|
||||||
if (newu != ts.get(5)) // modificata ulteriore classificazione
|
if (newu != ts.get(5)) // modificata ulteriore classificazione
|
||||||
mod = m_ulc = TRUE;
|
mod = m_ulc = true;
|
||||||
else if (m_tipo)
|
else if (m_tipo)
|
||||||
{
|
{
|
||||||
// forza reset di ulc se si e' modificato il tipo rata
|
// forza reset di ulc se si e' modificato il tipo rata
|
||||||
m_ulc = TRUE;
|
m_ulc = true;
|
||||||
newu = "";
|
newu = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,9 +230,9 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
|||||||
word err = pag.validate();
|
word err = pag.validate();
|
||||||
if (m.edit_mode())
|
if (m.edit_mode())
|
||||||
err &= ~(P_RSUM | P_TOTNCLIT | P_TOTNCVAL ); // Ignora totale importi e rate
|
err &= ~(P_RSUM | P_TOTNCLIT | P_TOTNCVAL ); // Ignora totale importi e rate
|
||||||
if ((err && P_ZEROLIT) && yesno_box("Almeno una rata ha importo zero in lire si desidera continuare ? "))
|
if ((err && P_ZEROLIT) && yesno_box(TR("Almeno una rata ha importo nullo in Euro si desidera continuare?")))
|
||||||
err &= ~P_ZEROLIT;
|
err &= ~P_ZEROLIT;
|
||||||
if ((err && P_ZEROVAL) && yesno_box("Almeno una rata ha importo in valuta zero si desidera continuare ? "))
|
if ((err && P_ZEROVAL) && yesno_box(TR("Almeno una rata ha importo nullo in valuta si desidera continuare?")))
|
||||||
err &= ~P_ZEROVAL;
|
err &= ~P_ZEROVAL;
|
||||||
if (err != P_OK)
|
if (err != P_OK)
|
||||||
{
|
{
|
||||||
@ -260,8 +260,8 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
|||||||
const TString is = curr.string(TRUE);
|
const TString is = curr.string(TRUE);
|
||||||
curr.set_num(tot);
|
curr.set_num(tot);
|
||||||
const TString ts = curr.string(TRUE);
|
const TString ts = curr.string(TRUE);
|
||||||
ok = yesno_box(FR("Il totale delle rate e' %s mentre\n"
|
ok = yesno_box(FR("Il totale delle rate è %s mentre\n"
|
||||||
"il totale del documento e' %s.\n"
|
"il totale del documento è %s.\n"
|
||||||
"Si desidera registrare ugualmente?"),
|
"Si desidera registrare ugualmente?"),
|
||||||
(const char*)is, (const char*)ts);
|
(const char*)is, (const char*)ts);
|
||||||
}
|
}
|
||||||
@ -285,8 +285,8 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
|||||||
const TRectype & rec = cache().get("%VAL", TCurrency::get_firm_val());
|
const TRectype & rec = cache().get("%VAL", TCurrency::get_firm_val());
|
||||||
const char * name = (const char *) rec.get("S0");
|
const char * name = (const char *) rec.get("S0");
|
||||||
|
|
||||||
ok = yesno_box(FR("Il totale in %s delle rate e' %s mentre\n"
|
ok = yesno_box(FR("Il totale in %s delle rate è %s mentre\n"
|
||||||
"il totale del documento e' %s.\n"
|
"il totale del documento è %s.\n"
|
||||||
"Si desidera registrare ugualmente?"),
|
"Si desidera registrare ugualmente?"),
|
||||||
name, (const char*)is, (const char*)ts);
|
name, (const char*)is, (const char*)ts);
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
if (set_scad && f.empty())
|
if (set_scad && f.empty())
|
||||||
{
|
{
|
||||||
ok = f.error_box(TR("Il codice di pagamento e' obbligatorio!"));
|
ok = f.error_box(TR("Il codice di pagamento è obbligatorio!"));
|
||||||
|
|
||||||
// Nella maschera iva cerco di reperirlo dal cliente
|
// Nella maschera iva cerco di reperirlo dal cliente
|
||||||
if (m.id2pos(F_CLIENTE) > 0)
|
if (m.id2pos(F_CLIENTE) > 0)
|
||||||
@ -367,7 +367,7 @@ bool TPrimanota_application::annorif_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
const TString& anno = m.get(F_DATADOC).right(4);
|
const TString& anno = m.get(F_DATADOC).right(4);
|
||||||
f.set(anno);
|
f.set(anno);
|
||||||
ok = error_box(TR("L'anno di riferimento partita e' obbligatorio!"));
|
ok = error_box(TR("L'anno di riferimento partita è obbligatorio!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -404,7 +404,7 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
|||||||
f.set(m.get(a._npart_is_prot ? F_PROTIVA : F_NUMDOC));
|
f.set(m.get(a._npart_is_prot ? F_PROTIVA : F_NUMDOC));
|
||||||
key = K_TAB; // Forza la successiva activate_numrif
|
key = K_TAB; // Forza la successiva activate_numrif
|
||||||
|
|
||||||
ok = f.error_box(TR("Il numero di riferimento partita e' obbligatorio!"));
|
ok = f.error_box(TR("Il numero di riferimento partita è obbligatorio!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == K_TAB && a.is_fattura())
|
if (key == K_TAB && a.is_fattura())
|
||||||
@ -561,8 +561,8 @@ bool TPrimanota_application::recalc_handler(TMask_field& f, KEY key)
|
|||||||
if (pag.in_valuta()) yak |= (pag.tval_rata(0) != pag.importo_da_non_dividere(TRUE));
|
if (pag.in_valuta()) yak |= (pag.tval_rata(0) != pag.importo_da_non_dividere(TRUE));
|
||||||
if (yak)
|
if (yak)
|
||||||
{
|
{
|
||||||
if (yesno_box(TR("L'importo della prima rata e' stato modificato. "
|
if (yesno_box(TR("L'importo della prima rata è stato modificato. "
|
||||||
"Con il ricalcolo automatico esso non sara' piu'"
|
"Con il ricalcolo automatico esso non sarà più"
|
||||||
" modificabile. Si desidera "
|
" modificabile. Si desidera "
|
||||||
"riportare le rate alle condizioni iniziali?")))
|
"riportare le rate alle condizioni iniziali?")))
|
||||||
{
|
{
|
||||||
@ -571,8 +571,8 @@ bool TPrimanota_application::recalc_handler(TMask_field& f, KEY key)
|
|||||||
a.reset_pagamento();
|
a.reset_pagamento();
|
||||||
a.set_scadenze(m);
|
a.set_scadenze(m);
|
||||||
}
|
}
|
||||||
else warning_box(FR("Il tipo prima rata e' stato modificato in \"%s\" per "
|
else warning_box(FR("Il tipo prima rata è stato modificato in \"%s\" per "
|
||||||
"poter mantenere la rateazione scelta e la possibilita' di "
|
"poter mantenere la rateazione scelta e la possibilità di "
|
||||||
"ricalcolo automatico"),
|
"ricalcolo automatico"),
|
||||||
pag.desc_tpr());
|
pag.desc_tpr());
|
||||||
}
|
}
|
||||||
@ -609,7 +609,7 @@ bool TPrimanota_application::nrate_handler(TMask_field& f, KEY key)
|
|||||||
app().set_banche(m);
|
app().set_banche(m);
|
||||||
app().pag_rows() = ps.rows_array();
|
app().pag_rows() = ps.rows_array();
|
||||||
}
|
}
|
||||||
TString8 r; r.format("%d", pag.n_rate());
|
TString4 r; r.format("%d", pag.n_rate());
|
||||||
f.set(r);
|
f.set(r);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -802,10 +802,10 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
|||||||
const TDate datadoc = testa.get_date(MOV_DATADOC);
|
const TDate datadoc = testa.get_date(MOV_DATADOC);
|
||||||
|
|
||||||
const int npart = part.prima_fattura(nreg);
|
const int npart = part.prima_fattura(nreg);
|
||||||
if (npart <= 0) // Non esiste una riga per questo movimento
|
if (npart <= 0) // Non esiste una riga per questo movimento
|
||||||
{
|
{
|
||||||
partite().destroy();
|
partite().destroy();
|
||||||
return FALSE; // Non dovrebbe succedere mai, in quanto gia' beccato sopra!
|
return false; // Non dovrebbe succedere mai, in quanto gia' beccato sopra!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determino il codice pagamento dalla riga di fattura
|
// Determino il codice pagamento dalla riga di fattura
|
||||||
@ -1139,7 +1139,7 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
TString msg(128);
|
TString msg(128);
|
||||||
const TCurrency curr(speso.valore());
|
const TCurrency curr(speso.valore());
|
||||||
msg.format(FR("L'importo sul saldaconto della riga %d e' %s"), (riga+1), (const char*)curr.string(TRUE));
|
msg.format(FR("L'importo sul saldaconto della riga %d è %s"), (riga+1), (const char*)curr.string(TRUE));
|
||||||
if (!speso.is_zero())
|
if (!speso.is_zero())
|
||||||
msg << (speso.sezione() == 'A' ? TR(" Avere") : TR(" Dare"));
|
msg << (speso.sezione() == 'A' ? TR(" Avere") : TR(" Dare"));
|
||||||
return f.error_box(msg);
|
return f.error_box(msg);
|
||||||
@ -1297,7 +1297,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
|||||||
if (old_ap != ' ') // Se c'era un abbuono ...
|
if (old_ap != ' ') // Se c'era un abbuono ...
|
||||||
{
|
{
|
||||||
const int riga_abb = type2pos(old_ap);
|
const int riga_abb = type2pos(old_ap);
|
||||||
CHECK(riga_abb >= 0, "Chiss'e' fregato gli abbuoni?");
|
CHECK(riga_abb >= 0, "Chiss'è fregato gli abbuoni?");
|
||||||
const bool empty = add_cgs_imp(riga_abb, old_abbuono);
|
const bool empty = add_cgs_imp(riga_abb, old_abbuono);
|
||||||
if (empty && new_ap != old_ap)
|
if (empty && new_ap != old_ap)
|
||||||
sheet.destroy(riga_abb);
|
sheet.destroy(riga_abb);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
PAGE "Rata pagamento" -1 -1 50 15
|
PAGE "Rata pagamento" -1 -1 51 15
|
||||||
|
|
||||||
DATE 101
|
DATE 101
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -147,20 +147,29 @@ BEGIN
|
|||||||
PROMPT 1 11 "Note:"
|
PROMPT 1 11 "Note:"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 114
|
STRING 112 50 47
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 12 11 "Non cancellabile"
|
PROMPT 1 12 ""
|
||||||
FLAGS "D"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 113
|
BOOLEAN 113
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 38 11 "Bloccata"
|
PROMPT 12 11 "Bloccata"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING 112 50 47
|
BOOLEAN 114
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 -1 "Non cancellabile"
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "" 0 0 0 2
|
||||||
|
|
||||||
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 12 ""
|
PROMPT -33 -1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_DELREC 10 2
|
BUTTON DLG_DELREC 10 2
|
||||||
@ -175,11 +184,6 @@ BEGIN
|
|||||||
PROMPT -23 -1 ""
|
PROMPT -23 -1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -33 -1 ""
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -40,7 +40,7 @@ BEGIN
|
|||||||
ITEM "1|Differenziate" MESSAGE DISABLE,FS_NRATE
|
ITEM "1|Differenziate" MESSAGE DISABLE,FS_NRATE
|
||||||
ITEM "2|Uguali (obbligate dalla 2a)" MESSAGE ENABLE,FS_NRATE
|
ITEM "2|Uguali (obbligate dalla 2a)" MESSAGE ENABLE,FS_NRATE
|
||||||
ITEM "3|Uguali dall'ultima modificata" MESSAGE DISABLE,FS_NRATE
|
ITEM "3|Uguali dall'ultima modificata" MESSAGE DISABLE,FS_NRATE
|
||||||
ITEM "4|Uguali finche' possibile" MESSAGE DISABLE,FS_NRATE
|
ITEM "4|Uguali finché possibile" MESSAGE DISABLE,FS_NRATE
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FS_NAMEPAG 50 29
|
STRING FS_NAMEPAG 50 29
|
||||||
|
@ -850,7 +850,7 @@ void TLiquidazione_app::build_ditte_sheet(wht what)
|
|||||||
const char vers = d->get_char(2);
|
const char vers = d->get_char(2);
|
||||||
const bool agr = d->get_char(3) == 'X';
|
const bool agr = d->get_char(3) == 'X';
|
||||||
|
|
||||||
bool unselectable = vers == '?' || (_year > "1997" && _month < 13 && agr);
|
const bool unselectable = (vers == '?') || (_month < 13 && agr);
|
||||||
if ((what == mnt && vers == 'T') || (what == trimestre && vers == 'M'))
|
if ((what == mnt && vers == 'T') || (what == trimestre && vers == 'M'))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
175
cg/cg4301.cpp
175
cg/cg4301.cpp
@ -563,38 +563,7 @@ void TLiquidazione_app::zero_att(int month, const char* codatt)
|
|||||||
zero_diff(month,codatt);
|
zero_diff(month,codatt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
bool TLiquidazione_app::ivadiff_chiusa(const TRectype& mov, const TDate& fine) const
|
||||||
static bool ivadiff_chiusa_old(const TRectype& mov, const TDate& fine)
|
|
||||||
{
|
|
||||||
const long numreg = mov.get_long(MOV_NUMREG);
|
|
||||||
|
|
||||||
TString query;
|
|
||||||
query << "USE IVADIFF"
|
|
||||||
<< "\nSELECT BETWEEN(DATAREGP,0," << fine.date2ansi() << ")"
|
|
||||||
<< "\nFROM NUMREG=" << numreg
|
|
||||||
<< "\nTO NUMREG=" << numreg;
|
|
||||||
TISAM_recordset id(query);
|
|
||||||
const TRectype& rid = id.cursor()->curr();
|
|
||||||
|
|
||||||
bool some_pag = false; // Ci sono pagamenti?
|
|
||||||
TImporto tot;
|
|
||||||
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
|
||||||
{
|
|
||||||
const char sez = rid.get_char("SEZIONE");
|
|
||||||
const real imp = rid.get(RMI_IMPOSTA);
|
|
||||||
if (!imp.is_zero())
|
|
||||||
{
|
|
||||||
if (rid.get_int(MOV_TIPOMOV) > 1)
|
|
||||||
some_pag = true;
|
|
||||||
tot += TImporto(sez, imp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const bool chiusa = some_pag && tot.valore() < 0.01;
|
|
||||||
return chiusa;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static bool ivadiff_chiusa_new(const TRectype& mov, const TDate& fine)
|
|
||||||
{
|
{
|
||||||
bool chiusa = false;
|
bool chiusa = false;
|
||||||
const long numreg = mov.get_long(MOV_NUMREG);
|
const long numreg = mov.get_long(MOV_NUMREG);
|
||||||
@ -625,14 +594,6 @@ static bool ivadiff_chiusa_new(const TRectype& mov, const TDate& fine)
|
|||||||
return chiusa;
|
return chiusa;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLiquidazione_app::ivadiff_chiusa(const TRectype& mov, const TDate& fine) const
|
|
||||||
{
|
|
||||||
bool cnew = ivadiff_chiusa_new(mov, fine);
|
|
||||||
//bool cold = ivadiff_chiusa_old(mov, fine);
|
|
||||||
// CHECK(cold == cnew, "Cazzo");
|
|
||||||
return cnew;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fattura più vecchia di un anno a ente NON pubblico
|
// Fattura più vecchia di un anno a ente NON pubblico
|
||||||
bool TLiquidazione_app::sarebbe_da_pagare(const TRectype& mov, const TDate& fine) const
|
bool TLiquidazione_app::sarebbe_da_pagare(const TRectype& mov, const TDate& fine) const
|
||||||
{
|
{
|
||||||
@ -665,24 +626,32 @@ bool TLiquidazione_app::sarebbe_da_pagare(const TRectype& mov, const TDate& fine
|
|||||||
|
|
||||||
TString8 key; key.format("%c|%ld", mov.get_char(MOV_TIPO), mov.get_long(MOV_CODCF));
|
TString8 key; key.format("%c|%ld", mov.get_char(MOV_TIPO), mov.get_long(MOV_CODCF));
|
||||||
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
||||||
const int alleg = clifo.get_int(CLI_ALLEG);
|
int alleg = clifo.get_int(CLI_ALLEG);
|
||||||
|
|
||||||
if (alleg == 7 || alleg == 8) // Ente pubblico e amministrazione controllata ...
|
if (alleg == 7 || alleg == 8) // Ente pubblico e amministrazione controllata ...
|
||||||
return false; // ... possono aspettare le calende greche
|
return false; // ... possono aspettare le calende greche
|
||||||
|
|
||||||
if (mov.get_bool(MOV_IVAXCASSA))
|
if (mov.get_bool(MOV_IVAXCASSA))
|
||||||
{
|
{
|
||||||
|
if (alleg == 6) // privato?
|
||||||
|
{
|
||||||
|
TString16 paiv, cofi;
|
||||||
|
if (clifo.get_bool(CLI_OCCAS))
|
||||||
|
{
|
||||||
|
const TRectype& occas = cache().get(LF_OCCAS, mov.get(MOV_OCFPI));
|
||||||
|
paiv = occas.get(OCC_PAIV);
|
||||||
|
cofi = occas.get(OCC_COFI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
paiv = clifo.get(CLI_PAIV);
|
||||||
|
cofi = clifo.get(CLI_COFI);
|
||||||
|
}
|
||||||
|
if (paiv.full())
|
||||||
|
alleg = 0; // Falso allarme: NON è un privato avendo partita IVA
|
||||||
|
}
|
||||||
if (alleg == 5 || alleg == 6 || alleg == 9) // Privati, import ed export non hanno IVA per cassa
|
if (alleg == 5 || alleg == 6 || alleg == 9) // Privati, import ed export non hanno IVA per cassa
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
TString16 paiv = clifo.get(CLI_PAIV);
|
|
||||||
if (paiv.empty() && clifo.get_bool(CLI_OCCAS))
|
|
||||||
{
|
|
||||||
const TRectype& occas = cache().get(LF_OCCAS, mov.get(MOV_OCFPI));
|
|
||||||
paiv = occas.get(OCC_PAIV);
|
|
||||||
}
|
|
||||||
if (paiv.blank())
|
|
||||||
return true; // In assenza di Partita IVA non c'è IVA per cassa
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ivadiff_chiusa(mov, fine))
|
if (ivadiff_chiusa(mov, fine))
|
||||||
@ -824,9 +793,8 @@ static bool is_autofattura_articolo_17(const TRectype& mov)
|
|||||||
// Dal 24-02-2014 controlliamo meglio
|
// Dal 24-02-2014 controlliamo meglio
|
||||||
if (af)
|
if (af)
|
||||||
{
|
{
|
||||||
TString8 key;
|
const TRectype& clifo = cache().get_rec(LF_CLIFO, mov.get(MOV_TIPO), mov.get(MOV_CODCF));
|
||||||
key << mov.get(MOV_TIPO) << '|' << mov.get(MOV_CODCF);
|
const int tp = clifo.get_int(CLI_ALLEG);
|
||||||
const int tp = atoi(cache().get(LF_CLIFO, key, CLI_ALLEG));
|
|
||||||
af = tp == 5 || tp == 9; // cliente estero CEE o non CEE
|
af = tp == 5 || tp == 9; // cliente estero CEE o non CEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,7 +978,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
if (_isviaggio)
|
if (_isviaggio)
|
||||||
f74 = TDate(1, 1, year_int-1);
|
f74 = TDate(1, 1, year_int-1);
|
||||||
|
|
||||||
if (year_int < 1998 || _recalc_regis) // Vecchia selezione o calcolo progressivi per stampa registri bollati
|
if (_recalc_regis) // Vecchia selezione priam del 1998 o calcolo progressivi per stampa registri bollati
|
||||||
{
|
{
|
||||||
t.set_month(month == 13 ? 12 : month);
|
t.set_month(month == 13 ? 12 : month);
|
||||||
t.set_year(year_int);
|
t.set_year(year_int);
|
||||||
@ -1079,7 +1047,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (_mov->get_long(MOV_NUMREG) == 15985)
|
if (_mov->get_long(MOV_CODCF) == 940)
|
||||||
int cazzone = 1;
|
int cazzone = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1095,11 +1063,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const bool cau_intra = rcs.get_bool(CAU_INTRACOM);
|
const bool cau_intra = rcs.get_bool(CAU_INTRACOM);
|
||||||
const bool cau_valintra = rcs.get_bool(CAU_VALINTRA);
|
const bool cau_valintra = rcs.get_bool(CAU_VALINTRA);
|
||||||
|
|
||||||
|
// Gestione SPLIT PAYMENT dal 01-01-2015: movimenti a enti pubblici senza ritenuta e senza reverse charge
|
||||||
|
if (tipomov == vendita && (tm == tm_fattura || tm == tm_nota_credito) &&
|
||||||
|
!cau_intra && date.year() >= 2015 && is_split_payment(_mov->curr()))
|
||||||
|
continue; // Ignora movimento di split payment
|
||||||
|
|
||||||
// Inizio gestione IVA differita
|
// Inizio gestione IVA differita
|
||||||
const bool iva_diff = _mov->get_bool(MOV_LIQDIFF);
|
const bool iva_diff = _mov->get_bool(MOV_LIQDIFF);
|
||||||
const bool iva_cass = !iva_diff && _mov->get_bool(MOV_IVAXCASSA) && tm > 0;
|
const bool iva_cass = !iva_diff && !_isviaggio && tm > tm_nessuno && _mov->get_bool(MOV_IVAXCASSA) && is_IVAxCassa(_mov->curr());
|
||||||
const bool movdiff = (iva_diff || iva_cass) && !_recalc_regis; // Aggiunto test su ricalcolo da registri 13-12-2012
|
const bool movdiff = (iva_diff || iva_cass) && !_recalc_regis; // Aggiunto test su ricalcolo da registri 13-12-2012
|
||||||
bool dok = is_date_ok(date, month, liqmonth, year_int);
|
bool dok = is_date_ok(date, month, liqmonth, year_int);
|
||||||
|
|
||||||
TPartite_array arrpart; // Partite interessate
|
TPartite_array arrpart; // Partite interessate
|
||||||
TPointer_array pagscatt; // Righe di pagsca interessate
|
TPointer_array pagscatt; // Righe di pagsca interessate
|
||||||
@ -1124,7 +1097,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const TPartita* p = arrpart.first();
|
const TPartita* p = arrpart.first();
|
||||||
const int row = p ? p->mov2rig(numreg, 0) : 0;
|
const int row = p ? p->mov2rig(numreg, 0) : 0;
|
||||||
game_found = row > 0;
|
game_found = row > 0;
|
||||||
if (game_found && !id_chiusa) // 25-02-2014 sostituito inizio al posto di fine
|
if (game_found && !id_chiusa)
|
||||||
{
|
{
|
||||||
const TRiga_partite& rp = p->riga(row);
|
const TRiga_partite& rp = p->riga(row);
|
||||||
TImporto pg, nc;
|
TImporto pg, nc;
|
||||||
@ -1317,7 +1290,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const bool intra = _rmoviva->get_bool(RMI_INTRA);
|
const bool intra = _rmoviva->get_bool(RMI_INTRA);
|
||||||
|
|
||||||
// autofatture art. 17 per non residenti, con trattamento speciale in liquidazione annuale
|
// autofatture art. 17 per non residenti, con trattamento speciale in liquidazione annuale
|
||||||
const bool autodafe = is_autofattura_articolo_17(_mov->curr());
|
const bool autodafe = (tipodoc == "AF") && is_autofattura_articolo_17(_mov->curr());
|
||||||
// vendite art. 40 c. 5/6/8 acq.intra., con trattamento
|
// vendite art. 40 c. 5/6/8 acq.intra., con trattamento
|
||||||
// speciale in liquidazione annuale (VA7 in stampa)
|
// speciale in liquidazione annuale (VA7 in stampa)
|
||||||
const bool art40 = (tipodoc != "AF" && tipoiva != "NS" && !rcs.get_bool("AUTOFATT") && rcs.get_bool("VALINTRA") && !intra);
|
const bool art40 = (tipodoc != "AF" && tipoiva != "NS" && !rcs.get_bool("AUTOFATT") && rcs.get_bool("VALINTRA") && !intra);
|
||||||
@ -1464,9 +1437,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
meseliq += 3-resto;
|
meseliq += 3-resto;
|
||||||
}
|
}
|
||||||
idcurr.put("MESELIQ", meseliq);
|
idcurr.put("MESELIQ", meseliq);
|
||||||
|
|
||||||
if (pagtmp.sezione() != sezpag)
|
|
||||||
int cazzone = 2;
|
|
||||||
idcurr.put("SEZIONE", pagtmp.sezione());
|
idcurr.put("SEZIONE", pagtmp.sezione());
|
||||||
if (ultimo)
|
if (ultimo)
|
||||||
{
|
{
|
||||||
@ -1564,15 +1534,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
)
|
)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/* Riga imponibile > 9 = ritenute; non si considerano (Scudler 1994) */
|
||||||
* Riga imponibile > 9 = ritenute; non si
|
|
||||||
* considerano (Scudler 1994)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Filling dell'array per IVA11
|
// Filling dell'array per IVA11
|
||||||
if (_is_interactive && month == 13)
|
if (_is_interactive && month == 13)
|
||||||
iva11_set_arr_phase_1(trueatt);
|
iva11_set_arr_phase_1(trueatt);
|
||||||
|
|
||||||
|
|
||||||
// Cumula l'ammontare delle operazioni attive/passive
|
// Cumula l'ammontare delle operazioni attive/passive
|
||||||
// per la dichiarazione annuale dati iva e quadro VT
|
// per la dichiarazione annuale dati iva e quadro VT
|
||||||
@ -1593,8 +1559,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
{
|
{
|
||||||
if (clifo.get_bool(CLI_OCCAS))
|
if (clifo.get_bool(CLI_OCCAS))
|
||||||
{
|
{
|
||||||
const TString80 key_occ(_mov->get(MOV_OCFPI));
|
const TString& key_occ = _mov->get(MOV_OCFPI);
|
||||||
const TRectype & occas = cache().get(LF_OCCAS, key_occ);
|
const TRectype& occas = cache().get(LF_OCCAS, key_occ);
|
||||||
|
|
||||||
key = occas.get(OCC_STATO);
|
key = occas.get(OCC_STATO);
|
||||||
key << "|" << occas.get(OCC_COM);
|
key << "|" << occas.get(OCC_COM);
|
||||||
@ -1623,9 +1589,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
|
const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
|
||||||
if (iva_vpn.full())
|
|
||||||
|
// Aggiunto "&& is_detraibile" al test altrimenti somma due volte imponibile_orig (22/01/2015)
|
||||||
|
if (iva_vpn.full() && _mov->get(MOV_ANNOIVA) == _year && is_detraibile)
|
||||||
{
|
{
|
||||||
if (_mov->get(MOV_ANNOIVA) == _year)
|
|
||||||
switch (tipomov)
|
switch (tipomov)
|
||||||
{
|
{
|
||||||
case vendita: // CD1 - 1 2 3 4
|
case vendita: // CD1 - 1 2 3 4
|
||||||
@ -2512,10 +2479,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rediito_
|
/* calcola il lercio prorata solo se liq. periodica */
|
||||||
* calcola il lercio prorata
|
|
||||||
* solo se liq. periodica
|
|
||||||
*/
|
|
||||||
real prorata, prorata_precedente1, prorata_precedente2;
|
real prorata, prorata_precedente1, prorata_precedente2;
|
||||||
real percentuale1, percentuale2;
|
real percentuale1, percentuale2;
|
||||||
if (month != 13)
|
if (month != 13)
|
||||||
@ -2544,7 +2508,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
// Prorata per l'anno corrente + quelli eventuali dello scorso anno e quelli che sono oltre 3 anni fa...
|
// Prorata per l'anno corrente + quelli eventuali dello scorso anno e quelli che sono oltre 3 anni fa...
|
||||||
// E quelli che non hanno la % prorata settata in tabella
|
// E quelli che non hanno la % prorata settata in tabella
|
||||||
real aaa = acquisti_iva;
|
real aaa = acquisti_iva;
|
||||||
aaa -= ammort_det_iva; // Scarta gli acquisti di beni ammortizzabili (4-9-2014)
|
|
||||||
|
// E'una questione molto dibattuta il fatti di escludere i beni ammortizzabili o no:
|
||||||
|
// Nella versione precedente (10.0) non venivano esclusi, poi dal 4-9-2014 sono stati esclusi ed infine nuovamente ignorati dal 17-2-2015
|
||||||
|
// aaa -= ammort_det_iva; // Scarta gli acquisti di beni ammortizzabili
|
||||||
|
|
||||||
if (percentuale1 != INVALID_PRORATA && percentuale1 != INVALID_PRORATA_ASSERT)
|
if (percentuale1 != INVALID_PRORATA && percentuale1 != INVALID_PRORATA_ASSERT)
|
||||||
aaa -= rr1 ? *rr1 : ZERO;
|
aaa -= rr1 ? *rr1 : ZERO;
|
||||||
if (percentuale2 != INVALID_PRORATA && percentuale2 != INVALID_PRORATA_ASSERT)
|
if (percentuale2 != INVALID_PRORATA && percentuale2 != INVALID_PRORATA_ASSERT)
|
||||||
@ -3833,7 +3801,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
real vf1 = _pla->get_real("R14");
|
real vf1 = _pla->get_real("R14");
|
||||||
real vf2(_pla->get("S1"));
|
real vf2 = _pla->get("S1");
|
||||||
real iaq = _pla->get_real("R11"); // IVA acquisti
|
real iaq = _pla->get_real("R11"); // IVA acquisti
|
||||||
real ppg = _pla->get_real("R12"); // pro-rata pagato
|
real ppg = _pla->get_real("R12"); // pro-rata pagato
|
||||||
|
|
||||||
@ -3853,23 +3821,16 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
real prorata = 0.0;
|
real prorata = 0.0;
|
||||||
real conguaglio = 0.0;
|
real conguaglio = 0.0;
|
||||||
real topay = 0.0;
|
real topay = 0.0;
|
||||||
real ris = vol_aff_t; // gia' esclusi: NS, B3, cess. amm
|
const real ris = vol_aff_t; // gia' esclusi: NS, B3, cess. amm
|
||||||
|
|
||||||
// calcola nuovo prorata per ogni attivita' (miste: 1+2)
|
// calcola nuovo prorata dal 1998 per ogni attivita' (miste: 1+2)
|
||||||
if (year_int > 1997) // Calcolo dal 1998 in poi
|
const real rsa = ris - (es_c1a-es_c1a_am) - (es_c3-es_c3_am);
|
||||||
|
const real rsn = rsa - es_c1;
|
||||||
|
if (!rsa.is_zero())
|
||||||
{
|
{
|
||||||
const real rsa = ris - (es_c1a-es_c1a_am) - (es_c3-es_c3_am);
|
prorata = CENTO - (rsn * CENTO / rsa); // Percentuale di indetraibilita: reciproco della percentuale di detraibilita'
|
||||||
const real rsn = rsa - es_c1;
|
prorata.round(0);
|
||||||
if (!rsa.is_zero())
|
|
||||||
prorata = CENTO - (rsn * CENTO / rsa); // Percentuale di indetraibilita: reciproco della percentuale di detraibilita'
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!ris.is_zero())
|
|
||||||
prorata = es_c1 * CENTO / ris;
|
|
||||||
}
|
|
||||||
|
|
||||||
prorata.round(0);
|
|
||||||
|
|
||||||
// calcolo conguaglio -- se positivo e' a debito
|
// calcolo conguaglio -- se positivo e' a debito
|
||||||
if (prorata > ZERO)
|
if (prorata > ZERO)
|
||||||
@ -3932,23 +3893,17 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
|
|
||||||
// comprende anche il conguaglio prorata
|
// comprende anche il conguaglio prorata
|
||||||
risultato += tot_cong;
|
risultato += tot_cong;
|
||||||
if (atoi(_year) <= 1997)
|
|
||||||
|
// Nuovo prorata dal 1998, congloba il conguaglio pro-rata nell'IVA ammessa in detrazione
|
||||||
|
if (tot_cong.sign() > 0)
|
||||||
{
|
{
|
||||||
if (tot_cong.sign() > 0) res_debt += tot_cong;
|
iva_acq -= tot_cong;
|
||||||
if (tot_cong.sign() < 0) res_cred -= tot_cong;
|
res_cred -= tot_cong;
|
||||||
}
|
}
|
||||||
else // Nuovo prorata dal 1998, congloba il conguaglio pro-rata nell'IVA ammessa in detrazione
|
else
|
||||||
{
|
{
|
||||||
if (tot_cong.sign() > 0)
|
iva_acq += abs(tot_cong);
|
||||||
{
|
res_cred += abs(tot_cong);
|
||||||
iva_acq -= tot_cong;
|
|
||||||
res_cred -= tot_cong;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iva_acq += abs(tot_cong);
|
|
||||||
res_cred += abs(tot_cong);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
look_lim(month+deltam,TRUE);
|
look_lim(month+deltam,TRUE);
|
||||||
@ -4084,13 +4039,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
_lam->put("R3", debt_precd);
|
_lam->put("R3", debt_precd);
|
||||||
|
|
||||||
if (!_recalc_only && _recalc != never)
|
if (!_recalc_only && _recalc != never)
|
||||||
{
|
_lim->put("B0","X");
|
||||||
_lim->put("B0","X");
|
|
||||||
// Dal 1998 questo flag vale solo per i progressivi dei registri IVA, visto che sono separati
|
|
||||||
// pertanto il suo settaggio andra' fatto solo in fase di ricalcolo (_recalc_only)
|
|
||||||
if (atoi(_year) < 1998)
|
|
||||||
_lim->put("B1","X");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_recalc_only)
|
if (_recalc_only)
|
||||||
_lim->put("B1", "X");
|
_lim->put("B1", "X");
|
||||||
|
@ -41,25 +41,21 @@ void TLiquidazione_app::zero_plafond (int month, const char* codatt)
|
|||||||
{
|
{
|
||||||
if (_recalc != needed)
|
if (_recalc != needed)
|
||||||
{
|
{
|
||||||
describe_error(TR("Progressivi plafond non ricalcolati per "
|
describe_error(TR("Progressivi plafond non ricalcolati per i mesi precedenti: possibili errori"),
|
||||||
"i mesi precedenti: possibili errori"),
|
|
||||||
codatt);
|
codatt);
|
||||||
is_ok = FALSE;
|
is_ok = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!update_att(previous_month(month),codatt, FALSE))
|
if (!update_att(previous_month(month),codatt, FALSE))
|
||||||
describe_error(TR("Progressivi plafond non ricalcolati per "
|
describe_error(TR("Progressivi plafond non ricalcolati per i mesi precedenti: possibili errori"),
|
||||||
"i mesi precedenti: possibili errori"),
|
|
||||||
codatt);
|
codatt);
|
||||||
look_ppa(previous_month(month),codatt,jj);
|
look_ppa(previous_month(month),codatt,jj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ok) // Se il record prec. esiste allora esegue i calcoli; In caso contrario diventa un errore sistematico
|
if (is_ok) // Se il record prec. esiste allora esegue i calcoli; In caso contrario diventa un errore sistematico
|
||||||
r = _ppa_r->get_real("R2") -
|
r = _ppa_r->get_real("R2") - _ppa_r->get_real("R0") - _ppa_r->get_real("R1");
|
||||||
_ppa_r->get_real("R0") -
|
|
||||||
_ppa_r->get_real("R1");
|
|
||||||
|
|
||||||
_ppa->readat(rn);
|
_ppa->readat(rn);
|
||||||
}
|
}
|
||||||
@ -637,6 +633,9 @@ void TLiquidazione_app::zero_diff(int month, const char* codatt)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TFast_isamfile fid(LF_IVADIFF);
|
TFast_isamfile fid(LF_IVADIFF);
|
||||||
|
if (fid.status() != NOERR)
|
||||||
|
return;
|
||||||
|
|
||||||
TString query;
|
TString query;
|
||||||
query << "USE IVADIFF KEY 2"; // Key 2 = ANNOLIQ+MESELIQ+...
|
query << "USE IVADIFF KEY 2"; // Key 2 = ANNOLIQ+MESELIQ+...
|
||||||
query << "\nFROM ANNOLIQ=" << _year;
|
query << "\nFROM ANNOLIQ=" << _year;
|
||||||
|
@ -942,7 +942,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
|||||||
}
|
}
|
||||||
} // fine while (codatt)
|
} // fine while (codatt)
|
||||||
|
|
||||||
if (!describe_pis && (art40.sign() > 0 || art40_iva.sign() > 0))
|
if (!describe_pis && (art40 > ZERO || art40_iva > ZERO))
|
||||||
{
|
{
|
||||||
_DescrItem* ads = new _DescrItem(PIM_ROW);
|
_DescrItem* ads = new _DescrItem(PIM_ROW);
|
||||||
ads->_s0 = ref;
|
ads->_s0 = ref;
|
||||||
@ -953,7 +953,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
|||||||
_descr_arr.insert(ads, totpos++);
|
_descr_arr.insert(ads, totpos++);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!describe_pis && (autodafe.sign() > 0 || autodafe_iva.sign() > 0))
|
if (!describe_pis && (autodafe > ZERO || autodafe_iva > ZERO))
|
||||||
{
|
{
|
||||||
_DescrItem* ads = new _DescrItem(PIM_ROW);
|
_DescrItem* ads = new _DescrItem(PIM_ROW);
|
||||||
ads->_s0 = ref;
|
ads->_s0 = ref;
|
||||||
@ -1004,7 +1004,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
|||||||
|
|
||||||
// aggiunge dati ptm
|
// aggiunge dati ptm
|
||||||
_DescrItem* t = new _DescrItem(MISC_LIQ);
|
_DescrItem* t = new _DescrItem(MISC_LIQ);
|
||||||
t->_f2 = atoi(_year) > 1997 ? describe_pis : TRUE; //isfirst; // per il form feed o meno alla fine
|
t->_f2 = describe_pis; //isfirst; // per il form feed o meno alla fine
|
||||||
|
|
||||||
if (!describe_pis)
|
if (!describe_pis)
|
||||||
{
|
{
|
||||||
@ -1051,8 +1051,12 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
|||||||
t->_r14 += _plm->get_real("R15");
|
t->_r14 += _plm->get_real("R15");
|
||||||
t->_r15 = _plm->get_real("R16"); // percentuale prorata 2 anni addietro
|
t->_r15 = _plm->get_real("R16"); // percentuale prorata 2 anni addietro
|
||||||
}
|
}
|
||||||
t->_r11 += _plm->get_real("R2") - _plm->get_real("R14") - _plm->get_real("R15"); // pro-rata indetraibile sui doc. acq. anno attuale
|
|
||||||
// in caso di liq. annuale prende il totale (tutto R2)
|
// pro-rata indetraibile sui doc. acq. anno attuale
|
||||||
|
// in caso di liq. annuale prende il totale (tutto R2)
|
||||||
|
t->_r11 += _plm->get_real("R2");
|
||||||
|
t->_r11 -= _plm->get_real("R14") + _plm->get_real("R15");
|
||||||
|
|
||||||
ad1 = real(ttm.get(1));
|
ad1 = real(ttm.get(1));
|
||||||
ad2 = real(ttm.get(2));
|
ad2 = real(ttm.get(2));
|
||||||
ad1 += _pom->get_real("R11");
|
ad1 += _pom->get_real("R11");
|
||||||
@ -2227,44 +2231,35 @@ void TLiquidazione_app::set_pumpam(const _DescrItem& d)
|
|||||||
{
|
{
|
||||||
printed = TRUE;
|
printed = TRUE;
|
||||||
|
|
||||||
if (yy > 1997) // prorata 1998
|
real prc(dp.get(0));
|
||||||
|
real rprc = CENTO - prc;
|
||||||
|
TString ss(rprc.string());
|
||||||
|
|
||||||
|
set_row(row++, FR("%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r"),
|
||||||
|
(const char*) ss, (const char*)prc.string(), &(d._r11));
|
||||||
|
yy-=2;
|
||||||
|
if (d._r13 != INVALID_PRORATA && d._r12 != ZERO)
|
||||||
{
|
{
|
||||||
real prc(dp.get(0));
|
rprc = CENTO - d._r13;
|
||||||
real rprc = CENTO - prc;
|
ss = rprc.string();
|
||||||
TString ss(rprc.string());
|
set_row(row++, FR("%% PRO-RATA %d (%s%%) ed IVA non detraibile (%s%%)@69g%r"),
|
||||||
|
yy, (const char*) ss, (const char*)d._r13.string(), &(d._r12));
|
||||||
set_row(row++, FR("%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r"),
|
|
||||||
(const char*) ss, (const char*)prc.string(), &(d._r11));
|
|
||||||
yy-=2;
|
|
||||||
if (d._r13 != INVALID_PRORATA && d._r12 != ZERO)
|
|
||||||
{
|
|
||||||
rprc = CENTO - d._r13;
|
|
||||||
ss = rprc.string();
|
|
||||||
set_row(row++, FR("%% PRO-RATA %d (%s%%) ed IVA non detraibile (%s%%)@69g%r"),
|
|
||||||
yy, (const char*) ss, (const char*)d._r13.string(), &(d._r12));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!_isfinal && d._r13 == INVALID_PRORATA_ASSERT)
|
|
||||||
set_row(row++, FR("Impossibile reperire la %% PRO-RATA relativa all'anno %d."), yy);
|
|
||||||
|
|
||||||
yy--;
|
|
||||||
if (d._r15 != INVALID_PRORATA && d._r14 != ZERO)
|
|
||||||
{
|
|
||||||
rprc = CENTO - d._r15;
|
|
||||||
ss = rprc.string();
|
|
||||||
set_row(row++, FR("%% PRO-RATA %d (%s%%) ed IVA non detraibile (%s%%)@69g%r"),
|
|
||||||
yy, (const char*) ss, (const char*)d._r15.string(), &(d._r14));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!_isfinal && d._r15 == INVALID_PRORATA_ASSERT)
|
|
||||||
set_row(row++, FR("Impossibile reperire la %% PRO-RATA relativa all'anno %d."), yy);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if (!_isfinal && d._r13 == INVALID_PRORATA_ASSERT)
|
||||||
|
set_row(row++, FR("Impossibile reperire la %% PRO-RATA relativa all'anno %d."), yy);
|
||||||
|
|
||||||
|
yy--;
|
||||||
|
if (d._r15 != INVALID_PRORATA && d._r14 != ZERO)
|
||||||
{
|
{
|
||||||
real prc(dp.get(0));
|
rprc = CENTO - d._r15;
|
||||||
set_row(row++, FR("%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r"),
|
ss = rprc.string();
|
||||||
(const char*)prc.string(), &(d._r11));
|
set_row(row++, FR("%% PRO-RATA %d (%s%%) ed IVA non detraibile (%s%%)@69g%r"),
|
||||||
|
yy, (const char*) ss, (const char*)d._r15.string(), &(d._r14));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (!_isfinal && d._r15 == INVALID_PRORATA_ASSERT)
|
||||||
|
set_row(row++, FR("Impossibile reperire la %% PRO-RATA relativa all'anno %d."), yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// items vari per dichiarazione annuale
|
// items vari per dichiarazione annuale
|
||||||
|
160
cg/cg4400.cpp
160
cg/cg4400.cpp
@ -683,43 +683,39 @@ bool TStampa_registri_app::mask_cod (TMask_field& f, KEY k)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampa_registri_app::mask_data (TMask_field& f, KEY k)
|
bool TStampa_registri_app::mask_data(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_TAB && f.mask().is_running())
|
if (k == K_TAB && f.mask().is_running())
|
||||||
{
|
{
|
||||||
const int anno = f.mask().get_int(ANNO);
|
const TDate data(f.get());
|
||||||
TDate data(f.get());
|
if (data.ok())
|
||||||
if (data.ok())
|
{
|
||||||
if (data.year() != anno)
|
TMask& m = f.mask();
|
||||||
{
|
const int anno = m.get_int(ANNO);
|
||||||
f.warning_box(TR("L'anno delle date limite deve essere uguale all'anno iva specificato"));
|
if (data.year() != anno)
|
||||||
return false;
|
return f.warning_box(FR("L'anno delle date limite deve essere %d"), anno);
|
||||||
}
|
if (f.dlg() == A_DATA)
|
||||||
if (f.dlg() == A_DATA)
|
m.show (TIPO_RIEPILOGATIVO, data.day() == 31 && data.month() == 12);
|
||||||
if (data.ok())
|
}
|
||||||
{
|
|
||||||
if ( data.day() == 31 && data.month() == 12 )
|
|
||||||
f.mask().show (TIPO_RIEPILOGATIVO);
|
|
||||||
else f.mask().hide (TIPO_RIEPILOGATIVO);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampa_registri_app::year_handler(TMask_field& f, KEY key)
|
bool TStampa_registri_app::year_freq_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
if (key == K_TAB && f.focusdirty())
|
if (key == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
app().set_year(atoi(f.get()));
|
TMask& m = f.mask();
|
||||||
const int freq = f.mask().get_int(F_FREQUENZA);
|
app().set_year(m.get_int(ANNO));
|
||||||
app().build_ditte_sheet(freq);
|
const int freq = m.get_int(F_FREQUENZA);
|
||||||
|
app().build_ditte_sheet(freq);
|
||||||
|
app().set_choice_limits(m);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_registri_app::build_ditte_sheet(int flags)
|
void TStampa_registri_app::build_ditte_sheet(int flags)
|
||||||
{
|
{
|
||||||
TWait_cursor hourglass;
|
|
||||||
if (_nomiditte.empty())
|
if (_nomiditte.empty())
|
||||||
build_nomiditte();
|
build_nomiditte();
|
||||||
|
|
||||||
@ -733,9 +729,10 @@ void TStampa_registri_app::build_ditte_sheet(int flags)
|
|||||||
// build sheet
|
// build sheet
|
||||||
_ditte->destroy();
|
_ditte->destroy();
|
||||||
_ditte->enable_row(-1);
|
_ditte->enable_row(-1);
|
||||||
|
long good_one = -1;
|
||||||
for (int i = 0; i < _nomiditte.items(); i++)
|
for (int i = 0; i < _nomiditte.items(); i++)
|
||||||
{
|
{
|
||||||
TToken_string d = (const TToken_string&)_nomiditte[i];
|
TToken_string d = _nomiditte.row(i);
|
||||||
const char vers = d.get_char(2);
|
const char vers = d.get_char(2);
|
||||||
if ((flags == 0x1 && vers != 'M') || (flags == 0x2 && vers != 'T'))
|
if ((flags == 0x1 && vers != 'M') || (flags == 0x2 && vers != 'T'))
|
||||||
continue;
|
continue;
|
||||||
@ -748,9 +745,15 @@ void TStampa_registri_app::build_ditte_sheet(int flags)
|
|||||||
{
|
{
|
||||||
const long ditta = d.get_long(1);
|
const long ditta = d.get_long(1);
|
||||||
if (sel[ditta])
|
if (sel[ditta])
|
||||||
_ditte->check(i);
|
_ditte->check(pos); // Ripristino eventuale selezione precedente
|
||||||
|
if (good_one == -1)
|
||||||
|
good_one = pos; else
|
||||||
|
if (good_one >= 0)
|
||||||
|
good_one = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (good_one >= 0 && !_ditte->one_checked())
|
||||||
|
_ditte->check(good_one);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------- handlers per selezione ditte
|
// --------- handlers per selezione ditte
|
||||||
@ -767,16 +770,15 @@ bool TStampa_registri_app::to_ditt_handler(TMask_field& f, KEY key)
|
|||||||
sh->disable(DLG_USER);
|
sh->disable(DLG_USER);
|
||||||
if (sh->run() == K_ENTER)
|
if (sh->run() == K_ENTER)
|
||||||
{
|
{
|
||||||
app().select_firm_range(m.get_long(DA_CODICE),sh->row(sh->selected()).get_long(1));
|
m.set(A_CODICE, sh->row(sh->selected()).get_long(1));
|
||||||
app().set_choice_limits(m);
|
key = K_TAB;
|
||||||
}
|
}
|
||||||
sh->enable(DLG_USER);
|
sh->enable(DLG_USER);
|
||||||
}
|
}
|
||||||
if (key == K_TAB && f.focusdirty())
|
if (key == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
const long l = app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE));
|
app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE));
|
||||||
app().set_choice_limits(m);
|
app().set_choice_limits(m);
|
||||||
m.set(F_SELECT, l);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -793,34 +795,30 @@ bool TStampa_registri_app::fr_ditt_handler(TMask_field& f, KEY key)
|
|||||||
sh->disable(DLG_USER);
|
sh->disable(DLG_USER);
|
||||||
if (sh->run() == K_ENTER)
|
if (sh->run() == K_ENTER)
|
||||||
{
|
{
|
||||||
app().select_firm_range(sh->row(sh->selected()).get_long(1), m.get_long(A_CODICE));
|
m.set(DA_CODICE, sh->row(sh->selected()).get_long(1));
|
||||||
app().set_choice_limits(m);
|
key = K_TAB;
|
||||||
}
|
}
|
||||||
sh->enable(DLG_USER);
|
sh->enable(DLG_USER);
|
||||||
}
|
}
|
||||||
else if (key == K_TAB && f.focusdirty())
|
if (key == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
const long l = app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE));
|
app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE));
|
||||||
app().set_choice_limits(m);
|
app().set_choice_limits(m);
|
||||||
m.set(F_SELECT, l);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_registri_app::set_choice_limits(TMask& m)
|
void TStampa_registri_app::set_choice_limits(TMask& m)
|
||||||
{
|
{
|
||||||
long first = -1l, last = -1l;
|
long first = 0, last = 0;
|
||||||
for (int i = 0; i < _ditte->items(); i++)
|
FOR_EACH_CHECKED_ROW(*_ditte, i, riga)
|
||||||
{
|
{
|
||||||
if (_ditte->checked(i))
|
const long dit = riga->get_long(1);
|
||||||
{
|
if (first <= 0) first = dit;
|
||||||
const long dit = _ditte->row(i).get_long(1);
|
if (last < dit) last = dit;
|
||||||
if (first < 0) first = dit;
|
|
||||||
if (last < dit) last = dit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (first > 0) m.set(DA_CODICE, first);
|
m.set(DA_CODICE, first);
|
||||||
if (last > 0) m.set(A_CODICE, last);
|
m.set(A_CODICE, last);
|
||||||
m.set(F_SELECT, _ditte->checked());
|
m.set(F_SELECT, _ditte->checked());
|
||||||
if (m.is_running() && first > 0)
|
if (m.is_running() && first > 0)
|
||||||
app().set_firm(first);
|
app().set_firm(first);
|
||||||
@ -848,7 +846,7 @@ long TStampa_registri_app::select_firm_range(long from, long to)
|
|||||||
return _ditte->checked();
|
return _ditte->checked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_registri_app::build_nomiditte(TProgind* pnd)
|
void TStampa_registri_app::build_nomiditte()
|
||||||
{
|
{
|
||||||
_nomiditte.destroy();
|
_nomiditte.destroy();
|
||||||
|
|
||||||
@ -870,28 +868,32 @@ void TStampa_registri_app::build_nomiditte(TProgind* pnd)
|
|||||||
d->add(freq);
|
d->add(freq);
|
||||||
_nomiditte.add(d);
|
_nomiditte.add(d);
|
||||||
}
|
}
|
||||||
_n_ditte = _nomiditte.items();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampa_registri_app::set_ditte(TMask& m)
|
bool TStampa_registri_app::set_ditte(TMask& m)
|
||||||
{
|
{
|
||||||
m.field(TIPO_STAMPA).set("1");
|
m.set(TIPO_STAMPA, 1);
|
||||||
m.field(DA_DATA).set("");
|
m.reset(DA_DATA);
|
||||||
m.field(A_DATA).set("");
|
m.reset(A_DATA);
|
||||||
m.field(CODICE_LIBRO_PROVA).set("");
|
m.reset(CODICE_LIBRO_PROVA);
|
||||||
|
|
||||||
KEY tasto;
|
KEY tasto = K_SPACE;
|
||||||
do
|
while (tasto != K_ENTER && tasto != K_QUIT)
|
||||||
{
|
{
|
||||||
tasto = m.run();
|
tasto = m.run();
|
||||||
if (tasto == DLG_SELECT)
|
if (tasto == DLG_SELECT)
|
||||||
{
|
{
|
||||||
_ditte->enable_check();
|
_ditte->enable_check();
|
||||||
// seleziona e aggiungi alle gia' selezionate
|
// seleziona e aggiungi alle già selezionate
|
||||||
if (_ditte->run() == K_ENTER)
|
if (_ditte->run() == K_ENTER)
|
||||||
|
{
|
||||||
|
const long sel = _ditte->selected();
|
||||||
|
if (sel >= 0 && _ditte->row_enabled(sel) && !_ditte->checked(sel))
|
||||||
|
_ditte->check(sel);
|
||||||
set_choice_limits(m);
|
set_choice_limits(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (tasto != K_ENTER && tasto != K_QUIT);
|
}
|
||||||
return tasto == K_ENTER;
|
return tasto == K_ENTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,13 +910,12 @@ bool TStampa_registri_app::user_create()
|
|||||||
_cur = new TSorted_cursor(_rel, "DATAREG|PROTIVA|NUMREG","", 2);
|
_cur = new TSorted_cursor(_rel, "DATAREG|PROTIVA|NUMREG","", 2);
|
||||||
_ditte = new TArray_sheet(-1, 4, -4, -4, TR("Selezione Ditte"),
|
_ditte = new TArray_sheet(-1, 4, -4, -4, TR("Selezione Ditte"),
|
||||||
HR("@1|Cod.@5R|Ragione Sociale@50|Vers."));
|
HR("@1|Cod.@5R|Ragione Sociale@50|Vers."));
|
||||||
_n_ditte = 0l;
|
|
||||||
__firm = TApplication::get_firm();
|
__firm = TApplication::get_firm();
|
||||||
|
|
||||||
TDate oggi(TODAY);
|
const TDate oggi(TODAY);
|
||||||
_annoes = oggi.year();
|
_annoes = oggi.year(); // Anno per frequenza IVA ditte
|
||||||
|
|
||||||
build_ditte_sheet(0x3);
|
build_ditte_sheet(0x3);
|
||||||
|
|
||||||
add_cursor(_cur);
|
add_cursor(_cur);
|
||||||
add_file(LF_MOV);
|
add_file(LF_MOV);
|
||||||
add_file(LF_RMOVIVA);
|
add_file(LF_RMOVIVA);
|
||||||
@ -1286,6 +1287,7 @@ int TStampa_registri_app::stampa_prospetto(int rr, bool print_prec)
|
|||||||
riga << TR("; 4=liquidazione differita");
|
riga << TR("; 4=liquidazione differita");
|
||||||
if (has_module(ICAUT))
|
if (has_module(ICAUT))
|
||||||
riga << TR("; 5=IVA per cassa");
|
riga << TR("; 5=IVA per cassa");
|
||||||
|
riga << TR("; 6=Scissione pagamenti art.17 ter");
|
||||||
set_row(rr++, riga);
|
set_row(rr++, riga);
|
||||||
|
|
||||||
_stampa = _st_tot_fin;
|
_stampa = _st_tot_fin;
|
||||||
@ -2054,7 +2056,7 @@ bool TStampa_registri_app::print_IVAxCassa(int da_month, int a_month)
|
|||||||
riga.put(id.get("MOV.NUMDOC").as_string(), 24);
|
riga.put(id.get("MOV.NUMDOC").as_string(), 24);
|
||||||
riga.put(format("%6ld", id.get("CLIFO.CODCF").as_int()), 31);
|
riga.put(format("%6ld", id.get("CLIFO.CODCF").as_int()), 31);
|
||||||
riga.put(clifo.get(), 38);
|
riga.put(clifo.get(), 38);
|
||||||
riga.put(tipodiff == 2 ? "5" : "4", 66); // 4 = Differita; 5 = x Cassa
|
riga.put(tipodiff == 2 ? "5" : "4", 66); // 4 = Differita; 5 = x Cassa;
|
||||||
riga.put(id.get("MOV.TIPODOC").as_string(), 68);
|
riga.put(id.get("MOV.TIPODOC").as_string(), 68);
|
||||||
print_real(riga, importo, 70);
|
print_real(riga, importo, 70);
|
||||||
print_real(riga, imponibile, 85);
|
print_real(riga, imponibile, 85);
|
||||||
@ -2302,8 +2304,10 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
TString4 codval = mov.get(MOV_CODVALI);
|
TString4 codval = mov.get(MOV_CODVALI);
|
||||||
real corrval = mov.get_real(MOV_CORRVALUTA);
|
real corrval = mov.get_real(MOV_CORRVALUTA);
|
||||||
const bool autof = caus.get_bool(CAU_AUTOFATT);
|
const bool autof = caus.get_bool(CAU_AUTOFATT);
|
||||||
const bool liqdiff = mov.get_bool(MOV_LIQDIFF);
|
|
||||||
const bool IVAxcassa= !liqdiff && mov.get_bool(MOV_IVAXCASSA);
|
const bool splitpay = tipocf == 'C' && is_split_payment(mov.curr());
|
||||||
|
const bool liqdiff = !splitpay && mov.get_bool(MOV_LIQDIFF);
|
||||||
|
const bool IVAxcassa= !splitpay && !liqdiff && mov.get_bool(MOV_IVAXCASSA);
|
||||||
|
|
||||||
TString80 descrcau = caus.get(CAU_DESCR);
|
TString80 descrcau = caus.get(CAU_DESCR);
|
||||||
|
|
||||||
@ -2532,15 +2536,22 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
{
|
{
|
||||||
_auto_intraf = true;
|
_auto_intraf = true;
|
||||||
tipo_op = "3";
|
tipo_op = "3";
|
||||||
}
|
} else
|
||||||
else if (intra)
|
if (intra)
|
||||||
tipo_op = "1";
|
tipo_op = "1"; else
|
||||||
else if (autof)
|
if (autof)
|
||||||
tipo_op = "2";
|
tipo_op = "2"; else
|
||||||
else if (liqdiff)
|
if (splitpay)
|
||||||
tipo_op = "4";
|
{
|
||||||
else if (IVAxcassa)
|
tipo_op = "6";
|
||||||
tipo_op = "5";
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (liqdiff)
|
||||||
|
tipo_op = "4"; else
|
||||||
|
if (IVAxcassa)
|
||||||
|
tipo_op = "5";
|
||||||
|
}
|
||||||
|
|
||||||
set_row(_r, "@66g%s", (const char*)tipo_op);
|
set_row(_r, "@66g%s", (const char*)tipo_op);
|
||||||
|
|
||||||
@ -3353,7 +3364,8 @@ bool TStampa_registri_app::setta_mask(long i)
|
|||||||
if (_u_data.ok())
|
if (_u_data.ok())
|
||||||
mb.set(U_DATA, _u_data.string());
|
mb.set(U_DATA, _u_data.string());
|
||||||
KEY tasto = mb.run();
|
KEY tasto = mb.run();
|
||||||
if (tasto != K_ENTER) return false;
|
if (tasto != K_ENTER)
|
||||||
|
return false;
|
||||||
//MI3213
|
//MI3213
|
||||||
_pagine_stampate = mb.get_long(U_PAGINA);
|
_pagine_stampate = mb.get_long(U_PAGINA);
|
||||||
_numini = _pagine_stampate;
|
_numini = _pagine_stampate;
|
||||||
@ -3612,8 +3624,8 @@ bool TStampa_registri_app::set_print(int n)
|
|||||||
m.set_handler (F_ANNULLA, mask_azzera);
|
m.set_handler (F_ANNULLA, mask_azzera);
|
||||||
m.set_handler (A_CODICE, to_ditt_handler);
|
m.set_handler (A_CODICE, to_ditt_handler);
|
||||||
m.set_handler (DA_CODICE, fr_ditt_handler);
|
m.set_handler (DA_CODICE, fr_ditt_handler);
|
||||||
m.set_handler (ANNO, year_handler);
|
m.set_handler (ANNO, year_freq_handler);
|
||||||
m.set_handler (F_FREQUENZA, year_handler);
|
m.set_handler (F_FREQUENZA, year_freq_handler);
|
||||||
|
|
||||||
m.set(DA_CODICE, get_firm());
|
m.set(DA_CODICE, get_firm());
|
||||||
m.set(A_CODICE, get_firm(), 0x3);
|
m.set(A_CODICE, get_firm(), 0x3);
|
||||||
|
10
cg/cg4400.h
10
cg/cg4400.h
@ -41,7 +41,7 @@ class TStampa_registri_app : public TPrintapp
|
|||||||
TTipodoc_array _doc_array;
|
TTipodoc_array _doc_array;
|
||||||
TRiga_array _tot_iva_array, _tot_prec_iva_array;
|
TRiga_array _tot_iva_array, _tot_prec_iva_array;
|
||||||
TArray_sheet *_ditte;
|
TArray_sheet *_ditte;
|
||||||
TArray _nomiditte;
|
TString_array _nomiditte;
|
||||||
tiporeg _tipo_reg;
|
tiporeg _tipo_reg;
|
||||||
bool _st_liq[13];
|
bool _st_liq[13];
|
||||||
bool _test;
|
bool _test;
|
||||||
@ -54,7 +54,7 @@ class TStampa_registri_app : public TPrintapp
|
|||||||
char _frequiva, _tipo_riepilogativo, _freq_riepilogo;
|
char _frequiva, _tipo_riepilogativo, _freq_riepilogo;
|
||||||
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
|
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
|
||||||
TDate _u_data;
|
TDate _u_data;
|
||||||
long _n_ditte, _u_stampata, _primast, __firm, _uprotivap, _ditta;
|
long _u_stampata, _primast, __firm, _uprotivap, _ditta;
|
||||||
long _numini, _pagine_stampate;
|
long _numini, _pagine_stampate;
|
||||||
int _fino_a_mese, _cod_un_loc;
|
int _fino_a_mese, _cod_un_loc;
|
||||||
int _annoes, _r, _stampa_width, _mese_ultima_liq, _mese_credito;
|
int _annoes, _r, _stampa_width, _mese_ultima_liq, _mese_credito;
|
||||||
@ -84,7 +84,7 @@ protected:
|
|||||||
static bool mask_mese (TMask_field&, KEY);
|
static bool mask_mese (TMask_field&, KEY);
|
||||||
static bool mask_fino_a_mese (TMask_field&, KEY);
|
static bool mask_fino_a_mese (TMask_field&, KEY);
|
||||||
static bool mask_azzera (TMask_field&, KEY);
|
static bool mask_azzera (TMask_field&, KEY);
|
||||||
static bool year_handler (TMask_field&, KEY);
|
static bool year_freq_handler(TMask_field&, KEY);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -148,8 +148,8 @@ public:
|
|||||||
bool some_IVAxCassa(int da_month, int a_month) const; // C'e' IVA per cassa o differita da stampare?
|
bool some_IVAxCassa(int da_month, int a_month) const; // C'e' IVA per cassa o differita da stampare?
|
||||||
bool print_IVAxCassa(int da_month, int a_month);
|
bool print_IVAxCassa(int da_month, int a_month);
|
||||||
|
|
||||||
void build_nomiditte(TProgind* pnd = NULL);
|
void build_nomiditte();
|
||||||
void set_year(int y) { _annoes = y; }
|
void set_year(int y) { if (_annoes != y) { _annoes = y; build_nomiditte(); } }
|
||||||
void clear_stliq();
|
void clear_stliq();
|
||||||
virtual bool preprocess_print(int, int);
|
virtual bool preprocess_print(int, int);
|
||||||
virtual bool user_create();
|
virtual bool user_create();
|
||||||
|
@ -60,7 +60,7 @@ BEGIN
|
|||||||
ITEM "13|Annuale"
|
ITEM "13|Annuale"
|
||||||
END
|
END
|
||||||
|
|
||||||
BROWSEFILE F_VISFLQ -3 -1
|
BROWSEFILE F_VISFLQ -3 12
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 4 ""
|
PROMPT 0 4 ""
|
||||||
END
|
END
|
||||||
|
@ -211,25 +211,22 @@ public:
|
|||||||
|
|
||||||
TDich_periodica_iva_form::TDich_periodica_iva_form(int anno) : TForm("cg5700a")
|
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--)
|
||||||
{
|
{
|
||||||
TPrint_section& b = section('B', odd_page);
|
TForm_item& f = b.field(i);
|
||||||
TString p;
|
p = f.prompt();
|
||||||
for (int i = b.fields()-1; i > 0; i--)
|
if (change_prompt(p, anno))
|
||||||
{
|
f.set_prompt(p);
|
||||||
TForm_item& f = b.field(i);
|
|
||||||
p = f.prompt();
|
|
||||||
if (change_prompt(p, anno))
|
|
||||||
f.set_prompt(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TDich_periodica_iva_mask : public TAutomask
|
class TDich_periodica_iva_mask : public TAutomask
|
||||||
{
|
{
|
||||||
TDich_periodica_selfirm_mask * _sf;
|
TDich_periodica_selfirm_mask * _sf;
|
||||||
bool _dirty_versament, // Sporco versamento...
|
bool _dirty_versament; // Sporco versamento...
|
||||||
_is_euro; // importi in euro
|
|
||||||
protected:
|
protected:
|
||||||
void read_iva_data();
|
void read_iva_data();
|
||||||
real imposta_diff(int tipo) const;
|
real imposta_diff(int tipo) const;
|
||||||
@ -286,13 +283,8 @@ real TDich_periodica_iva_mask::imposta_diff(int tipo) const
|
|||||||
|
|
||||||
void TDich_periodica_iva_mask::read_iva_data()
|
void TDich_periodica_iva_mask::read_iva_data()
|
||||||
{
|
{
|
||||||
|
TString8 key; key.format("%4d13", _sf->get_year());
|
||||||
TString16 key;
|
const TRectype& lim = cache().get("LIM", key);
|
||||||
|
|
||||||
key.format("%4d13", _sf->get_year());
|
|
||||||
|
|
||||||
|
|
||||||
const TRectype & lim = cache().get("LIM", key);
|
|
||||||
|
|
||||||
if (lim.get_bool("B0"))
|
if (lim.get_bool("B0"))
|
||||||
{
|
{
|
||||||
@ -319,19 +311,16 @@ void TDich_periodica_iva_mask::read_iva_data()
|
|||||||
real cd3_4 = ZERO;
|
real cd3_4 = ZERO;
|
||||||
|
|
||||||
TRelation relpum("PUM");
|
TRelation relpum("PUM");
|
||||||
TRectype & pum = relpum.curr();
|
TRectype& pum = relpum.curr();
|
||||||
|
|
||||||
key.format("%04d",_sf->get_year());
|
key.format("%04d",_sf->get_year());
|
||||||
|
|
||||||
pum.put("CODTAB", key);
|
pum.put("CODTAB", key);
|
||||||
TCursor cur(&relpum, "", 1, &pum, &pum);
|
TCursor cur(&relpum, "", 1, &pum, &pum);
|
||||||
const TRecnotype items = cur.items();
|
|
||||||
|
|
||||||
|
const TRecnotype items = cur.items();
|
||||||
cur.freeze();
|
cur.freeze();
|
||||||
for (cur = 0L; cur.pos() < items; ++cur)
|
for (cur = 0L; cur.pos() < items; ++cur)
|
||||||
{
|
{
|
||||||
const TString& codtab = pum.get("CODTAB");
|
const TString& codtab = pum.get("CODTAB");
|
||||||
|
|
||||||
const TString& annoiva = codtab.left(4);
|
const TString& annoiva = codtab.left(4);
|
||||||
if (annoiva != key)
|
if (annoiva != key)
|
||||||
break;
|
break;
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
void ricevi_movPN(const TString& key, char sigla);
|
void ricevi_movPN(const TString& key, char sigla);
|
||||||
void scrivi_righePN(long numreg);
|
void scrivi_righePN(long numreg);
|
||||||
void ricevi_movIVA(const TString& key, char sigla);
|
void ricevi_movIVA(const TString& key, char sigla);
|
||||||
void scrivi_righeIVA(long numreg);
|
bool scrivi_righeIVA(long numreg);
|
||||||
void ricevi_movSC(TString& key,char sigla);
|
void ricevi_movSC(TString& key,char sigla);
|
||||||
long esiste_numreg(long nreg);
|
long esiste_numreg(long nreg);
|
||||||
void num_protocollo();
|
void num_protocollo();
|
||||||
@ -1217,24 +1217,36 @@ bool TRic_tab::occasionali(TString& ocfpi)
|
|||||||
return err == NOERR;
|
return err == NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRic_tab::scrivi_righeIVA(long numreg)
|
bool TRic_tab::scrivi_righeIVA(long numreg)
|
||||||
{
|
{
|
||||||
_triva->setkey(1);
|
if (_triva)
|
||||||
_triva->zero();
|
|
||||||
_triva->put(RMI_NUMREG, numreg);
|
|
||||||
|
|
||||||
for (_triva->read(); !_triva->eof(); _triva->next())
|
|
||||||
{
|
{
|
||||||
if (_triva->get_long(RMI_NUMREG) != numreg)
|
_triva->setkey(1);
|
||||||
break;
|
_triva->zero();
|
||||||
_triva->put(RMI_NUMREG, _nuovareg);
|
_triva->put(RMI_NUMREG, numreg);
|
||||||
_rmoviva->curr() = _triva->curr();
|
|
||||||
_rmoviva->write();
|
for (_triva->read(); !_triva->eof(); _triva->next())
|
||||||
|
{
|
||||||
|
if (_triva->get_long(RMI_NUMREG) != numreg)
|
||||||
|
break;
|
||||||
|
_triva->put(RMI_NUMREG, _nuovareg);
|
||||||
|
_rmoviva->curr() = _triva->curr();
|
||||||
|
_rmoviva->write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return cantread_box(_tmpriva);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRic_tab::ricevi_movIVA(const TString& key, char uselab)
|
void TRic_tab::ricevi_movIVA(const TString& key, char uselab)
|
||||||
{
|
{
|
||||||
|
if (_triva == NULL)
|
||||||
|
{
|
||||||
|
cantread_box(_tmpriva);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const char flag = _tras_file.flg_agg(uselab);
|
const char flag = _tras_file.flg_agg(uselab);
|
||||||
|
|
||||||
_tmov->setkey(1);
|
_tmov->setkey(1);
|
||||||
|
@ -670,8 +670,6 @@ bool TRic_ListaMov::controlla_mov()
|
|||||||
bool TRic_ListaMov::errori_partita(int g, int c, long s)
|
bool TRic_ListaMov::errori_partita(int g, int c, long s)
|
||||||
{
|
{
|
||||||
TLocalisamfile pconti (LF_PCON);
|
TLocalisamfile pconti (LF_PCON);
|
||||||
pconti.setkey(1);
|
|
||||||
pconti.zero();
|
|
||||||
pconti.put(PCN_GRUPPO, g);
|
pconti.put(PCN_GRUPPO, g);
|
||||||
pconti.put(PCN_CONTO, c);
|
pconti.put(PCN_CONTO, c);
|
||||||
pconti.put(PCN_SOTTOCONTO, 0L);
|
pconti.put(PCN_SOTTOCONTO, 0L);
|
||||||
@ -681,8 +679,6 @@ bool TRic_ListaMov::errori_partita(int g, int c, long s)
|
|||||||
if (tipo == 'C' || tipo == 'F')
|
if (tipo == 'C' || tipo == 'F')
|
||||||
{
|
{
|
||||||
TLocalisamfile clifo (LF_CLIFO);
|
TLocalisamfile clifo (LF_CLIFO);
|
||||||
clifo.setkey(1);
|
|
||||||
clifo.zero();
|
|
||||||
clifo.put(CLI_TIPOCF, tipo);
|
clifo.put(CLI_TIPOCF, tipo);
|
||||||
clifo.put(CLI_CODCF, s);
|
clifo.put(CLI_CODCF, s);
|
||||||
if (clifo.read() != NOERR)
|
if (clifo.read() != NOERR)
|
||||||
@ -690,7 +686,6 @@ bool TRic_ListaMov::errori_partita(int g, int c, long s)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pconti.zero();
|
|
||||||
pconti.put(PCN_GRUPPO, g);
|
pconti.put(PCN_GRUPPO, g);
|
||||||
pconti.put(PCN_CONTO, c);
|
pconti.put(PCN_CONTO, c);
|
||||||
pconti.put(PCN_SOTTOCONTO, s);
|
pconti.put(PCN_SOTTOCONTO, s);
|
||||||
@ -698,7 +693,8 @@ bool TRic_ListaMov::errori_partita(int g, int c, long s)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return FALSE;
|
else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -842,8 +838,7 @@ void TRic_ListaMov::stampa_errori_rmov(int riga)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (_importo != ZERO && _sezione == '\0') ||
|
if (!_importo.is_zero() && _sezione != 'D' && _sezione != 'A')
|
||||||
(_sezione != 'D' && _sezione != 'A' && _sezione != '\0') )
|
|
||||||
{
|
{
|
||||||
_errore_grave = TRUE;
|
_errore_grave = TRUE;
|
||||||
set_row(++riga, FR("@8g*** Segnale dare/avere non valido"));
|
set_row(++riga, FR("@8g*** Segnale dare/avere non valido"));
|
||||||
@ -861,7 +856,7 @@ void TRic_ListaMov::stampa_errori_rmov(int riga)
|
|||||||
set_row(++riga, FR("@8g--- Sottoconto contropartita non valido o non presente in archivio"));
|
set_row(++riga, FR("@8g--- Sottoconto contropartita non valido o non presente in archivio"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_mov_sez && _importo == ZERO)
|
if (!_mov_sez && _importo.is_zero())
|
||||||
set_row(++riga, FR("@8g--- Importo riga uguale a zero"));
|
set_row(++riga, FR("@8g--- Importo riga uguale a zero"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,10 +558,9 @@ real TRegistro::prorata(int annodoc)
|
|||||||
void TRegistro::set_prorata(int annodoc, const real& pro)
|
void TRegistro::set_prorata(int annodoc, const real& pro)
|
||||||
{
|
{
|
||||||
const int annoiva = year();
|
const int annoiva = year();
|
||||||
if (annodoc <= 1900) annodoc = annoiva; // Test per anno documento non specificato
|
if (annodoc <= 2000) annodoc = annoiva; // Test per anno documento non specificato
|
||||||
const int annopro = annoiva >= 1998 && annodoc < annoiva ? annodoc+1 : annoiva;
|
const int annopro = annodoc < annoiva ? annodoc+1 : annoiva;
|
||||||
|
TString4 chiave; chiave << annopro;
|
||||||
TString16 chiave; chiave << annopro;
|
|
||||||
_prorata.add(chiave, pro, TRUE);
|
_prorata.add(chiave, pro, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,7 +933,7 @@ bool TBill::find()
|
|||||||
{
|
{
|
||||||
TString16 key;
|
TString16 key;
|
||||||
key.format("%c|%ld", _tipo, _sottoconto);
|
key.format("%c|%ld", _tipo, _sottoconto);
|
||||||
const TRectype & clifo = cache().get(LF_CLIFO, key);
|
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
||||||
ok = !clifo.empty();
|
ok = !clifo.empty();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
881
cg/cglib03.cpp
881
cg/cglib03.cpp
@ -1,405 +1,476 @@
|
|||||||
#include "cg2103.h"
|
#include "cg2103.h"
|
||||||
#include "cglib03.h"
|
#include "cglib03.h"
|
||||||
|
|
||||||
#include <diction.h>
|
#include <diction.h>
|
||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
|
|
||||||
#include <mov.h>
|
#include <causali.h>
|
||||||
#include <rmoviva.h>
|
#include <clifo.h>
|
||||||
|
#include <mov.h>
|
||||||
static int codind2tipodet(const TString & codind, real& perc)
|
#include <occas.h>
|
||||||
{
|
#include <rmoviva.h>
|
||||||
int tipodet = 0;
|
|
||||||
perc = ZERO;
|
static int codind2tipodet(const TString & codind, real& perc)
|
||||||
if (codind.full())
|
{
|
||||||
{
|
int tipodet = 0;
|
||||||
const TRectype& rec = cache().get("%DET", codind);
|
perc = ZERO;
|
||||||
if (rec.empty())
|
if (codind.full())
|
||||||
{
|
{
|
||||||
if (strchr("139", codind[0]) != NULL) // Clausola di salvaguardia
|
const TRectype& rec = cache().get("%DET", codind);
|
||||||
{
|
if (rec.empty())
|
||||||
tipodet = codind[0]-'0';
|
{
|
||||||
perc = CENTO;
|
if (strchr("139", codind[0]) != NULL) // Clausola di salvaguardia
|
||||||
}
|
{
|
||||||
}
|
tipodet = codind[0]-'0';
|
||||||
else
|
perc = CENTO;
|
||||||
{
|
}
|
||||||
tipodet = rec.get_int("I0");
|
}
|
||||||
if (tipodet > 0)
|
else
|
||||||
perc = rec.get_real("R0");
|
{
|
||||||
}
|
tipodet = rec.get_int("I0");
|
||||||
}
|
if (tipodet > 0)
|
||||||
return tipodet;
|
perc = rec.get_real("R0");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
real indetraibile_al(const TString& codind, const TCausale& caus, int /*annodoc*/, int & tipodet,const bool is_liq)
|
return tipodet;
|
||||||
{
|
}
|
||||||
real perc;
|
|
||||||
|
real indetraibile_al(const TString& codind, const TCausale& caus, int /*annodoc*/, int & tipodet,const bool is_liq)
|
||||||
switch (caus.iva())
|
{
|
||||||
{
|
real perc;
|
||||||
case iva_acquisti:
|
|
||||||
case nessuna_iva:
|
switch (caus.iva())
|
||||||
case iva_errata:
|
{
|
||||||
#ifdef PRORATA100
|
case iva_acquisti:
|
||||||
if (!is_liq && caus.reg().prorata100(annodoc)) // Se prorata = 100% e' indetraibile
|
case nessuna_iva:
|
||||||
{
|
case iva_errata:
|
||||||
perc = CENTO;
|
#ifdef PRORATA100
|
||||||
tipodet = 9;
|
if (!is_liq && caus.reg().prorata100(annodoc)) // Se prorata = 100% e' indetraibile
|
||||||
}
|
{
|
||||||
else
|
perc = CENTO;
|
||||||
#endif
|
tipodet = 9;
|
||||||
tipodet = codind2tipodet(codind, perc);
|
}
|
||||||
break;
|
else
|
||||||
default:
|
#endif
|
||||||
tipodet = 0; // Vendite sempre detraibili
|
tipodet = codind2tipodet(codind, perc);
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
tipodet = 0; // Vendite sempre detraibili
|
||||||
return perc;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int analizza_IVA(const real& imptot, const real& ivatot, const real perc_ind,
|
return perc;
|
||||||
const bool corrispettivo, const bool iva_ind_al_costo, const TString& codiva,
|
}
|
||||||
real& imp_det, real& iva_det, real& imp_ind, real& iva_ind)
|
|
||||||
{
|
int analizza_IVA(const real& imptot, const real& ivatot, const real perc_ind,
|
||||||
int flag = 0;
|
const bool corrispettivo, const bool iva_ind_al_costo, const TString& codiva,
|
||||||
|
real& imp_det, real& iva_det, real& imp_ind, real& iva_ind)
|
||||||
if (perc_ind <= ZERO)
|
{
|
||||||
{
|
int flag = 0;
|
||||||
flag = 1;
|
|
||||||
imp_det = imptot;
|
if (perc_ind <= ZERO)
|
||||||
iva_det = ivatot;
|
{
|
||||||
if (corrispettivo && iva_det.is_zero())
|
flag = 1;
|
||||||
{
|
imp_det = imptot;
|
||||||
const TCodiceIVA iva(codiva);
|
iva_det = ivatot;
|
||||||
iva_det = iva.scorpora(imp_det);
|
if (corrispettivo && iva_det.is_zero())
|
||||||
}
|
{
|
||||||
imp_ind = iva_ind = ZERO;
|
const TCodiceIVA iva(codiva);
|
||||||
}
|
iva_det = iva.scorpora(imp_det);
|
||||||
else
|
}
|
||||||
{
|
imp_ind = iva_ind = ZERO;
|
||||||
if (perc_ind >= CENTO)
|
}
|
||||||
{
|
else
|
||||||
flag = 2;
|
{
|
||||||
imp_ind = imptot;
|
if (perc_ind >= CENTO)
|
||||||
iva_ind = ivatot;
|
{
|
||||||
imp_det = iva_det = ZERO;
|
flag = 2;
|
||||||
}
|
imp_ind = imptot;
|
||||||
else
|
iva_ind = ivatot;
|
||||||
{
|
imp_det = iva_det = ZERO;
|
||||||
flag = 3;
|
}
|
||||||
const int decimali = TCurrency::get_firm_dec();
|
else
|
||||||
imp_ind = imptot * perc_ind / CENTO; imp_ind.round(decimali);
|
{
|
||||||
imp_det = imptot - imp_ind;
|
flag = 3;
|
||||||
|
const int decimali = TCurrency::get_firm_dec();
|
||||||
const TCodiceIVA iva(codiva);
|
imp_ind = imptot * perc_ind / CENTO; imp_ind.round(decimali);
|
||||||
iva_ind = iva.imposta(imp_ind, decimali);
|
imp_det = imptot - imp_ind;
|
||||||
iva_det = ivatot - iva_ind;
|
|
||||||
}
|
const TCodiceIVA iva(codiva);
|
||||||
if (iva_ind_al_costo && !iva_ind.is_zero())
|
iva_ind = iva.imposta(imp_ind, decimali);
|
||||||
{
|
iva_det = ivatot - iva_ind;
|
||||||
imp_ind += iva_ind;
|
}
|
||||||
iva_ind = ZERO;
|
if (iva_ind_al_costo && !iva_ind.is_zero())
|
||||||
}
|
{
|
||||||
}
|
imp_ind += iva_ind;
|
||||||
|
iva_ind = ZERO;
|
||||||
return flag;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gestione_IVAxCassa(const TDate& data, long firm)
|
return flag;
|
||||||
{
|
}
|
||||||
int anno = data.year();
|
|
||||||
if (anno <= 0)
|
bool gestione_IVAxCassa(const TDate& data_mov, long firm)
|
||||||
anno = TDate(TODAY).year();
|
{
|
||||||
bool yes = anno >= 2012 && dongle().active(ICAUT) && dongle().active(SCAUT);
|
const TDate data = data_mov.ok() ? data_mov : TDate(TODAY);
|
||||||
if (yes)
|
const int anno = data.year();
|
||||||
{
|
bool yes = anno >= 2012 && dongle().active(ICAUT) && dongle().active(SCAUT);
|
||||||
if (firm <= 0)
|
if (yes)
|
||||||
firm = prefix().get_codditta();
|
{
|
||||||
TString16 codtab;
|
if (firm <= 0)
|
||||||
codtab.format("%05ld%04d", firm, anno);
|
firm = prefix().get_codditta();
|
||||||
const TRectype& lia = cache().get("%LIA", codtab);
|
TString16 codtab;
|
||||||
yes = lia.get_bool("B5");
|
codtab.format("%05ld%04d", firm, anno);
|
||||||
if (yes)
|
const TRectype& lia = cache().get("%LIA", codtab);
|
||||||
{
|
yes = lia.get_bool("B5");
|
||||||
TDate dal = lia.get("D0"); if (dal.year() != anno) dal = TDate( 1, 1,anno);
|
if (yes)
|
||||||
TDate al = lia.get("D1"); if (al.year() != anno) al = TDate(31,12,anno);
|
{
|
||||||
yes = data >= dal && data <= al;
|
TDate dal = lia.get("D0"); if (dal.year() != anno) dal = TDate( 1, 1, anno);
|
||||||
}
|
TDate al = lia.get("D1"); if (al.year() != anno) al = TDate(31,12, anno);
|
||||||
}
|
yes = data >= dal && data <= al;
|
||||||
return yes;
|
}
|
||||||
}
|
}
|
||||||
|
return yes;
|
||||||
// Anticamente TIPODET conteneva in tipo di indetraibilita,
|
}
|
||||||
// ora invece trattasi di un codice di indetraibilità
|
|
||||||
// associato ad un motivo ed una percentuale di indetraibilita'
|
bool is_split_payment(const TRectype& mov)
|
||||||
int get_tipodet_from_rmi(const TRectype& rmi, const TRectype& mov,real& percind, const bool is_liq)
|
{
|
||||||
{
|
if (mov.get_char(MOV_TIPO) == 'C' && mov.get_int(MOV_ANNOIVA) >= 2015 && mov.get_real(MOV_RITFIS).is_zero())
|
||||||
const int annodoc = mov.get_date(MOV_DATAREG).year();
|
{
|
||||||
const TCausale caus(mov.get(MOV_CODCAUS), annodoc);
|
const TRectype& clifo = cache().get_rec(LF_CLIFO, "C", mov.get(MOV_CODCF));
|
||||||
|
if (clifo.get_bool(CLI_SPLITPAY)) // Ente pubblico con split payment
|
||||||
int tipodet = 0;
|
{
|
||||||
percind = indetraibile_al(rmi.get(RMI_TIPODET), caus, annodoc, tipodet, is_liq);
|
const TRectype& rcs = cache().get(LF_CAUSALI, mov.get(MOV_CODCAUS));
|
||||||
|
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
|
||||||
return tipodet;
|
if (rsi != 13 && rsi != 50 && rsi != 51) // No reverse charge!
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
///////////////////////////////////
|
}
|
||||||
// classe TInteressi_IVA_table //
|
return false;
|
||||||
// per la lettura versamenti e //
|
}
|
||||||
// e interessi IVA dalla tabella //
|
|
||||||
///////////////////////////////////
|
bool is_IVAxCassa(const TRectype& mov)
|
||||||
|
{
|
||||||
TInteressi_IVA_table::TInteressi_IVA_table() : TTable("%VER")
|
if (mov.get_bool(MOV_LIQDIFF) || !mov.get_bool(MOV_IVAXCASSA) || mov.get_char(MOV_TIPO) < 'C')
|
||||||
{
|
return false;
|
||||||
}
|
|
||||||
|
tipo_movimento tm = (tipo_movimento)mov.get_int(MOV_TIPOMOV);
|
||||||
TInteressi_IVA_table::~TInteressi_IVA_table()
|
if (tm == tm_nessuno)
|
||||||
{
|
{
|
||||||
}
|
const TString& tipodoc = mov.get(MOV_TIPODOC);
|
||||||
|
if (tipodoc == "FV" || tipodoc == "FA")
|
||||||
int TInteressi_IVA_table::read(int anno, int mese)
|
tm = tm_fattura; else
|
||||||
{
|
if (tipodoc == "NC")
|
||||||
TString8 k; k.format("%04d%02d",anno,mese);
|
tm = tm_nota_credito;
|
||||||
zero(); put("CODTAB",k);
|
}
|
||||||
if (TTable::read(_isgteq) == NOERR)
|
if (tm != tm_fattura && tm != tm_nota_credito)
|
||||||
{
|
return false;
|
||||||
const TString& cod = TTable::get("CODTAB");
|
|
||||||
if (cod > k && prev() != NOERR)
|
const TRectype& clifo = cache().get_rec(LF_CLIFO, mov.get(MOV_TIPO), mov.get(MOV_CODCF));
|
||||||
zero();
|
int alleg = clifo.get_int(CLI_ALLEG);
|
||||||
}
|
if (alleg == 6) // privato?
|
||||||
else
|
{
|
||||||
if (last() != NOERR)
|
TString16 paiv, cofi;
|
||||||
zero();
|
if (clifo.get_bool(CLI_OCCAS))
|
||||||
return status();
|
{
|
||||||
}
|
const TRectype& occas = cache().get(LF_OCCAS, mov.get(MOV_OCFPI));
|
||||||
|
paiv = occas.get(OCC_PAIV);
|
||||||
real TInteressi_IVA_table::get(int what)
|
cofi = occas.get(OCC_COFI);
|
||||||
{
|
}
|
||||||
TString4 fieldname;
|
else
|
||||||
fieldname.format("R%d", what);
|
{
|
||||||
return get_real(fieldname);
|
paiv = clifo.get(CLI_PAIV);
|
||||||
}
|
cofi = clifo.get(CLI_COFI);
|
||||||
|
}
|
||||||
///////////////////////////////////////////////
|
if (paiv.full())
|
||||||
// TRigaiva_array
|
alleg = 0; // Falso allarme: NON è un privato avendo partita IVA
|
||||||
// Tabella per il calcolo degli imponibili Iva
|
}
|
||||||
///////////////////////////////////////////////
|
if (alleg == 7 || (clifo.get_bool(CLI_SPLITPAY) && is_split_payment(mov)))
|
||||||
|
{
|
||||||
const TString& TRigaiva::descr_det() const
|
return false;
|
||||||
{
|
}
|
||||||
TString& rig = get_tmp_string();
|
else
|
||||||
switch (_tipodet)
|
{
|
||||||
{
|
if (alleg == 5 || alleg == 6 || alleg == 9) // Niente IVA per cassa a privati o fallimentari
|
||||||
case 1 : rig = TR("Indetraib. su op.es."); break;
|
return false;
|
||||||
case 3 : rig = TR("Passaggi interni"); break;
|
}
|
||||||
case 9 : rig = TR("Indetraibile art.19"); break;
|
|
||||||
default: rig = TR("Detraibile"); break;
|
const TDate data_reg = mov.get(MOV_DATAREG);
|
||||||
}
|
const TDate data_doc = mov.get(MOV_DATADOC);
|
||||||
return rig;
|
const TDate data_rif = data_doc.ok() && data_doc < data_reg ? data_doc : data_reg;
|
||||||
}
|
return gestione_IVAxCassa(data_rif);
|
||||||
|
}
|
||||||
bool TRigaiva_array::add_riga(const real& imponibile, const real& imposta,
|
|
||||||
const real& imponibilep, const real& impostap,
|
|
||||||
const char* codiva, int tipodet, int tipocr,
|
// Anticamente TIPODET conteneva in tipo di indetraibilita,
|
||||||
bool intra, int tipoatt)
|
// ora invece trattasi di un codice di indetraibilità
|
||||||
{
|
// associato ad un motivo ed una percentuale di indetraibilita'
|
||||||
int i;
|
int get_tipodet_from_rmi(const TRectype& rmi, const TRectype& mov,real& percind, const bool is_liq)
|
||||||
for (i = items()-1; i >= 0; i--)
|
{
|
||||||
{
|
const int annodoc = mov.get_date(MOV_DATAREG).year();
|
||||||
TRigaiva& r = riga(i);
|
const TCausale caus(mov.get(MOV_CODCAUS), annodoc);
|
||||||
if (r._codiva==codiva && r._tipodet==tipodet && r._tipocr==tipocr && r._tipoatt==tipoatt)
|
|
||||||
{
|
int tipodet = 0;
|
||||||
r._imponibile += imponibile;
|
percind = indetraibile_al(rmi.get(RMI_TIPODET), caus, annodoc, tipodet, is_liq);
|
||||||
r._imposta += imposta;
|
|
||||||
r._imponibilep += imponibilep;
|
return tipodet;
|
||||||
r._impostap += impostap;
|
}
|
||||||
break;
|
|
||||||
}
|
///////////////////////////////////
|
||||||
}
|
// classe TInteressi_IVA_table //
|
||||||
if (i < 0)
|
// per la lettura versamenti e //
|
||||||
{
|
// e interessi IVA dalla tabella //
|
||||||
TRigaiva* r = new TRigaiva(imponibile,imposta,imponibilep,impostap,codiva,tipodet,tipocr,intra,tipoatt);
|
///////////////////////////////////
|
||||||
add(r);
|
|
||||||
}
|
TInteressi_IVA_table::TInteressi_IVA_table() : TTable("%VER")
|
||||||
return i >= 0;
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TRigaiva_array::add_riga(const TRectype& iva)
|
TInteressi_IVA_table::~TInteressi_IVA_table()
|
||||||
{
|
{
|
||||||
const real impo = iva.get_real(RMI_IMPONIBILE);
|
}
|
||||||
const real impos = iva.get_real(RMI_IMPOSTA);
|
|
||||||
bool ok = !impo.is_zero() || !impos.is_zero();
|
int TInteressi_IVA_table::read(int anno, int mese)
|
||||||
if (ok)
|
{
|
||||||
{
|
TString8 k; k.format("%04d%02d",anno,mese);
|
||||||
real percind;
|
zero(); put("CODTAB",k);
|
||||||
const TString& codind = iva.get(RMI_TIPODET);
|
if (TTable::read(_isgteq) == NOERR)
|
||||||
const int tipodet = codind2tipodet(codind, percind);
|
{
|
||||||
const TString4 codiva = iva.get(RMI_CODIVA);
|
const TString& cod = TTable::get("CODTAB");
|
||||||
const int tipocr = iva.get_int (RMI_TIPOCR);
|
if (cod > k && prev() != NOERR)
|
||||||
const bool intra = iva.get_bool(RMI_INTRA);
|
zero();
|
||||||
const int tipoatt = iva.get_int (RMI_TIPOATT);
|
}
|
||||||
|
else
|
||||||
if (percind > ZERO && percind < CENTO)
|
if (last() != NOERR)
|
||||||
{
|
zero();
|
||||||
const int dec = TCurrency::get_firm_dec();
|
return status();
|
||||||
real impo_ind = impo * percind / CENTO; impo_ind.round(dec);
|
}
|
||||||
const real impo_det = impo - impo_ind;
|
|
||||||
|
real TInteressi_IVA_table::get(int what)
|
||||||
const TCodiceIVA iva(codiva);
|
{
|
||||||
|
TString4 fieldname;
|
||||||
real impos_ind = iva.imposta(impo_ind, dec);
|
fieldname.format("R%d", what);
|
||||||
const real impos_det = impos - impos_ind;
|
return get_real(fieldname);
|
||||||
|
}
|
||||||
ok = add_riga(impo_det,impos_det,ZERO,ZERO,codiva,0,tipocr,intra,tipoatt);
|
|
||||||
ok &= add_riga(impo_ind,impos_ind,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt);
|
///////////////////////////////////////////////
|
||||||
}
|
// TRigaiva_array
|
||||||
else
|
// Tabella per il calcolo degli imponibili Iva
|
||||||
{
|
///////////////////////////////////////////////
|
||||||
ok = add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt);
|
|
||||||
}
|
const TString& TRigaiva::descr_det() const
|
||||||
}
|
{
|
||||||
return ok;
|
TString& rig = get_tmp_string();
|
||||||
}
|
switch (_tipodet)
|
||||||
|
{
|
||||||
///////////////////////////////////////////////
|
case 1 : rig = TR("Indetraib. su op.es."); break;
|
||||||
// TRiga_array
|
case 3 : rig = TR("Passaggi interni"); break;
|
||||||
///////////////////////////////////////////////
|
case 9 : rig = TR("Indetraibile art.19"); break;
|
||||||
|
default: rig = TR("Detraibile"); break;
|
||||||
bool TRiga_array::add_riga(const real& imponibile, const real& imposta, const real& implordo,
|
}
|
||||||
const real& imponibilep, const real& impostap, const real& implordop,
|
return rig;
|
||||||
const char* codiva)
|
}
|
||||||
{
|
|
||||||
bool found = false;
|
bool TRigaiva_array::add_riga(const real& imponibile, const real& imposta,
|
||||||
for (int i = 0; i < items(); i++)
|
const real& imponibilep, const real& impostap,
|
||||||
{
|
const char* codiva, int tipodet, int tipocr,
|
||||||
TRiga& r = riga(i);
|
bool intra, int tipoatt)
|
||||||
if (r._codiva==codiva)
|
{
|
||||||
{
|
int i;
|
||||||
found = true;
|
for (i = items()-1; i >= 0; i--)
|
||||||
r._imponibile += imponibile;
|
{
|
||||||
r._imposta += imposta;
|
TRigaiva& r = riga(i);
|
||||||
r._implordo += implordo;
|
if (r._codiva==codiva && r._tipodet==tipodet && r._tipocr==tipocr && r._tipoatt==tipoatt)
|
||||||
r._imponibilep += imponibilep;
|
{
|
||||||
r._impostap += impostap;
|
r._imponibile += imponibile;
|
||||||
r._implordop += implordop;
|
r._imposta += imposta;
|
||||||
break;
|
r._imponibilep += imponibilep;
|
||||||
}
|
r._impostap += impostap;
|
||||||
}
|
break;
|
||||||
if (!found)
|
}
|
||||||
{
|
}
|
||||||
TRiga* r = new TRiga(imponibile,imposta,implordo,imponibilep,impostap,implordop,codiva);
|
if (i < 0)
|
||||||
add(r);
|
{
|
||||||
}
|
TRigaiva* r = new TRigaiva(imponibile,imposta,imponibilep,impostap,codiva,tipodet,tipocr,intra,tipoatt);
|
||||||
return found;
|
add(r);
|
||||||
}
|
}
|
||||||
|
return i >= 0;
|
||||||
///////////////////////////////////////////////
|
}
|
||||||
// TDociva_array
|
|
||||||
///////////////////////////////////////////////
|
bool TRigaiva_array::add_riga(const TRectype& iva)
|
||||||
|
{
|
||||||
bool TDociva_array::add_riga(const char* _descrdociva, const real& _importo,const int _natdoc)
|
const real impo = iva.get_real(RMI_IMPONIBILE);
|
||||||
{
|
const real impos = iva.get_real(RMI_IMPOSTA);
|
||||||
bool found = false;
|
bool ok = !impo.is_zero() || !impos.is_zero();
|
||||||
for (int i = 0; i < items(); i++)
|
if (ok)
|
||||||
{
|
{
|
||||||
TDociva& r = riga(i);
|
real percind;
|
||||||
if (r._descrdoc==_descrdociva)
|
const TString& codind = iva.get(RMI_TIPODET);
|
||||||
{
|
const int tipodet = codind2tipodet(codind, percind);
|
||||||
found = true;
|
const TString4 codiva = iva.get(RMI_CODIVA);
|
||||||
if ((r._ndoc == 1)||(r._ndoc == 2)||(r._ndoc == 9))//||(r._ndoc == 4))
|
const int tipocr = iva.get_int (RMI_TIPOCR);
|
||||||
r._totdociva += _importo;
|
const bool intra = iva.get_bool(RMI_INTRA);
|
||||||
}
|
const int tipoatt = iva.get_int (RMI_TIPOATT);
|
||||||
}
|
|
||||||
if (!found)
|
if (percind > ZERO && percind < CENTO)
|
||||||
{
|
{
|
||||||
if ((_natdoc == 1)||(_natdoc == 2)||(_natdoc == 9))//||(_natdoc == 4))
|
const int dec = TCurrency::get_firm_dec();
|
||||||
{
|
real impo_ind = impo * percind / CENTO; impo_ind.round(dec);
|
||||||
TDociva* r = new TDociva(_descrdociva,_importo,_natdoc);
|
const real impo_det = impo - impo_ind;
|
||||||
add(r);
|
|
||||||
}
|
const TCodiceIVA iva(codiva);
|
||||||
}
|
|
||||||
return found;
|
real impos_ind = iva.imposta(impo_ind, dec);
|
||||||
}
|
const real impos_det = impos - impos_ind;
|
||||||
|
|
||||||
bool TTipodoc_array::add_riga(const char* tipodoc, const char* descrdoc, const real& totdoc)
|
ok = add_riga(impo_det,impos_det,ZERO,ZERO,codiva,0,tipocr,intra,tipoatt);
|
||||||
{
|
ok &= add_riga(impo_ind,impos_ind,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt);
|
||||||
bool found = false;
|
}
|
||||||
for (int i = 0; i < items(); i++)
|
else
|
||||||
{
|
{
|
||||||
TTipodoc& r = (TTipodoc&)(*this)[i];
|
ok = add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt);
|
||||||
if (r._tipodoc==tipodoc)
|
}
|
||||||
{
|
}
|
||||||
found = true;
|
return ok;
|
||||||
r._totdoc += totdoc;
|
}
|
||||||
}
|
|
||||||
}
|
///////////////////////////////////////////////
|
||||||
if (!found)
|
// TRiga_array
|
||||||
{
|
///////////////////////////////////////////////
|
||||||
TTipodoc* r = new TTipodoc(tipodoc,descrdoc,totdoc);
|
|
||||||
add(r);
|
bool TRiga_array::add_riga(const real& imponibile, const real& imposta, const real& implordo,
|
||||||
}
|
const real& imponibilep, const real& impostap, const real& implordop,
|
||||||
return found;
|
const char* codiva)
|
||||||
}
|
{
|
||||||
|
bool found = false;
|
||||||
///////////////////////////////////////////////////////////
|
for (int i = 0; i < items(); i++)
|
||||||
// Arrotondamenti iva
|
{
|
||||||
///////////////////////////////////////////////////////////
|
TRiga& r = riga(i);
|
||||||
|
if (r._codiva==codiva)
|
||||||
TRound_mode TIva_round::_def_mode = rm_unknown;
|
{
|
||||||
int TIva_round::_def_decimals = 0;
|
found = true;
|
||||||
|
r._imponibile += imponibile;
|
||||||
void TIva_round::set_default_mode(TRound_mode m, int d)
|
r._imposta += imposta;
|
||||||
{
|
r._implordo += implordo;
|
||||||
_def_mode = _mode = m;
|
r._imponibilep += imponibilep;
|
||||||
_def_decimals = _decimals = d;
|
r._impostap += impostap;
|
||||||
}
|
r._implordop += implordop;
|
||||||
|
break;
|
||||||
void TIva_round::set_mode(TRound_mode m, int d)
|
}
|
||||||
{
|
}
|
||||||
_mode = m;
|
if (!found)
|
||||||
_decimals = d;
|
{
|
||||||
}
|
TRiga* r = new TRiga(imponibile,imposta,implordo,imponibilep,impostap,implordop,codiva);
|
||||||
|
add(r);
|
||||||
void TIva_round::set_default_iva_mode(int year, bool declaration, long ditta)
|
}
|
||||||
{
|
return found;
|
||||||
if (year < 1990)
|
}
|
||||||
year = TDate(TODAY).year();
|
|
||||||
|
///////////////////////////////////////////////
|
||||||
if (year >= 2002 && is_euro_value(NULL))
|
// TDociva_array
|
||||||
{
|
///////////////////////////////////////////////
|
||||||
if (ditta <= 0)
|
|
||||||
ditta = prefix().get_codditta();
|
bool TDociva_array::add_riga(const char* _descrdociva, const real& _importo,const int _natdoc)
|
||||||
TString16 key; key.format("%05ld%04d", ditta, year);
|
{
|
||||||
const TRectype& lia = cache().get("%LIA", key);
|
bool found = false;
|
||||||
const int dec = lia.get_int(declaration ? "I2" : "I1");
|
for (int i = 0; i < items(); i++)
|
||||||
set_default_mode(rm_round, dec);
|
{
|
||||||
}
|
TDociva& r = riga(i);
|
||||||
else
|
if (r._descrdoc==_descrdociva)
|
||||||
set_default_mode(rm_millelire, -3);
|
{
|
||||||
}
|
found = true;
|
||||||
|
if ((r._ndoc == 1)||(r._ndoc == 2)||(r._ndoc == 9))//||(r._ndoc == 4))
|
||||||
void TIva_round::round(real& n) const
|
r._totdociva += _importo;
|
||||||
{
|
}
|
||||||
CHECK(_mode != rm_unknown, "Non è stato impostato il metodo di arrotondamento");
|
}
|
||||||
switch (_mode)
|
if (!found)
|
||||||
{
|
{
|
||||||
case rm_ceil:
|
if ((_natdoc == 1)||(_natdoc == 2)||(_natdoc == 9))//||(_natdoc == 4))
|
||||||
n.ceil(_decimals);
|
{
|
||||||
break;
|
TDociva* r = new TDociva(_descrdociva,_importo,_natdoc);
|
||||||
case rm_millelire:
|
add(r);
|
||||||
n -= 0.0001; // Le 500 lire vanno arrontondate per difetto
|
}
|
||||||
default:
|
}
|
||||||
n.round(_decimals);
|
return found;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
bool TTipodoc_array::add_riga(const char* tipodoc, const char* descrdoc, const real& totdoc)
|
||||||
|
{
|
||||||
TIva_round::TIva_round()
|
bool found = false;
|
||||||
{
|
for (int i = 0; i < items(); i++)
|
||||||
_mode = _def_mode;
|
{
|
||||||
_decimals = _def_decimals;
|
TTipodoc& r = (TTipodoc&)(*this)[i];
|
||||||
}
|
if (r._tipodoc==tipodoc)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
r._totdoc += totdoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
TTipodoc* r = new TTipodoc(tipodoc,descrdoc,totdoc);
|
||||||
|
add(r);
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Arrotondamenti iva
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TRound_mode TIva_round::_def_mode = rm_unknown;
|
||||||
|
int TIva_round::_def_decimals = 0;
|
||||||
|
|
||||||
|
void TIva_round::set_default_mode(TRound_mode m, int d)
|
||||||
|
{
|
||||||
|
_def_mode = _mode = m;
|
||||||
|
_def_decimals = _decimals = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TIva_round::set_mode(TRound_mode m, int d)
|
||||||
|
{
|
||||||
|
_mode = m;
|
||||||
|
_decimals = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TIva_round::set_default_iva_mode(int year, bool declaration, long ditta)
|
||||||
|
{
|
||||||
|
if (year < 1990)
|
||||||
|
year = TDate(TODAY).year();
|
||||||
|
|
||||||
|
if (year >= 2002 && is_euro_value(NULL))
|
||||||
|
{
|
||||||
|
if (ditta <= 0)
|
||||||
|
ditta = prefix().get_codditta();
|
||||||
|
TString16 key; key.format("%05ld%04d", ditta, year);
|
||||||
|
const TRectype& lia = cache().get("%LIA", key);
|
||||||
|
const int dec = lia.get_int(declaration ? "I2" : "I1");
|
||||||
|
set_default_mode(rm_round, dec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
set_default_mode(rm_millelire, -3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TIva_round::round(real& n) const
|
||||||
|
{
|
||||||
|
CHECK(_mode != rm_unknown, "Non è stato impostato il metodo di arrotondamento");
|
||||||
|
switch (_mode)
|
||||||
|
{
|
||||||
|
case rm_ceil:
|
||||||
|
n.ceil(_decimals);
|
||||||
|
break;
|
||||||
|
case rm_millelire:
|
||||||
|
n -= 0.0001; // Le 500 lire vanno arrontondate per difetto
|
||||||
|
default:
|
||||||
|
n.round(_decimals);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TIva_round::TIva_round()
|
||||||
|
{
|
||||||
|
_mode = _def_mode;
|
||||||
|
_decimals = _def_decimals;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -158,5 +158,7 @@ int analizza_IVA(const real& imptot, const real& ivatot, const real perc_ind,
|
|||||||
int get_tipodet_from_rmi(const TRectype& rmi, const TRectype& mv, real& percind, const bool is_liq = false);
|
int get_tipodet_from_rmi(const TRectype& rmi, const TRectype& mv, real& percind, const bool is_liq = false);
|
||||||
|
|
||||||
bool gestione_IVAxCassa(const TDate& data, long firm = 0);
|
bool gestione_IVAxCassa(const TDate& data, long firm = 0);
|
||||||
|
bool is_split_payment(const TRectype& mov);
|
||||||
|
bool is_IVAxCassa(const TRectype& mov);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1908,7 +1908,7 @@ void TPagamento::adjust_refused_scad()
|
|||||||
|
|
||||||
CHECK(_tipocf == 'C' || _tipocf == 'F', "Bad tipocf in pagament");
|
CHECK(_tipocf == 'C' || _tipocf == 'F', "Bad tipocf in pagament");
|
||||||
|
|
||||||
TString16 codice;
|
TString8 codice;
|
||||||
codice << _tipocf << '|' << _codcf;
|
codice << _tipocf << '|' << _codcf;
|
||||||
const TRectype& clifo = cache().get(LF_CFVEN, codice);
|
const TRectype& clifo = cache().get(LF_CFVEN, codice);
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
17
|
17
|
||||||
0
|
0
|
||||||
$cfven|0|0|496|0|Clienti/Fornitori per vendite|||
|
$cfven|0|0|502|0|Clienti/Fornitori per vendite|||
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
17
|
17
|
||||||
81
|
82
|
||||||
TIPOCF|1|1|0|Tipo <C>liente, <F>ornitore
|
TIPOCF|1|1|0|Tipo <C>liente, <F>ornitore
|
||||||
CODCF|3|6|0|Codice
|
CODCF|3|6|0|Codice
|
||||||
CODINDDOC|2|3|0|Codice indirizzo documenti
|
CODINDDOC|2|3|0|Codice indirizzo documenti
|
||||||
@ -81,5 +81,6 @@ RIFDOC|8|1|0|Riferimenti sui documenti
|
|||||||
IMPMINFAT|4|18|3|Importo minimo Fatture
|
IMPMINFAT|4|18|3|Importo minimo Fatture
|
||||||
PADESTIN|1|6|0|Codice ufficio amministrazione
|
PADESTIN|1|6|0|Codice ufficio amministrazione
|
||||||
PARIFAMM|1|20|0|Codice riferimento amministrativo
|
PARIFAMM|1|20|0|Codice riferimento amministrativo
|
||||||
|
PRODCONAI|1|6|0|Produttore CONAI[6]: acc,all,car,pla,leg,vet
|
||||||
1
|
1
|
||||||
TIPOCF+CODCF|
|
TIPOCF+CODCF|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
20
|
20
|
||||||
0
|
0
|
||||||
$clifo|0|0|742|0|Clienti/Fornitori|||
|
$clifo|0|0|743|0|Clienti/Fornitori|||
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
20
|
20
|
||||||
60
|
61
|
||||||
TIPOCF|1|1|0|Tipo <C>liente <F>ornitore
|
TIPOCF|1|1|0|Tipo <C>liente <F>ornitore
|
||||||
CODCF|3|6|0|Codice
|
CODCF|3|6|0|Codice
|
||||||
RAGSOC|1|50|0|Ragione sociale
|
RAGSOC|1|50|0|Ragione sociale
|
||||||
@ -60,6 +60,7 @@ CODCFASS|3|6|0|Codice cliente (fornitori) o fornitore (clienti) associato
|
|||||||
CODCFFATT|3|6|0|Codice cliente (fornitore) cui fatturare
|
CODCFFATT|3|6|0|Codice cliente (fornitore) cui fatturare
|
||||||
DIPPUBB|8|1|0|Dipendente Pubblico
|
DIPPUBB|8|1|0|Dipendente Pubblico
|
||||||
ENTE|1|4|0|Codice ente pubblico di appartenenza (Dipendente Pubblico)
|
ENTE|1|4|0|Codice ente pubblico di appartenenza (Dipendente Pubblico)
|
||||||
|
SPLITPAY|8|1|0|Ente pubblico soggetto a split payment
|
||||||
6
|
6
|
||||||
TIPOCF+CODCF|
|
TIPOCF+CODCF|
|
||||||
TIPOCF+UPPER(RAGSOC)|X
|
TIPOCF+UPPER(RAGSOC)|X
|
||||||
|
Loading…
x
Reference in New Issue
Block a user