Nuova gestione ritenute, reverse charge e split payment

git-svn-id: svn://10.65.10.50/branches/R_10_00@23120 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2015-07-10 14:50:35 +00:00
parent b3087bdca7
commit 4537d255f5
19 changed files with 3834 additions and 3721 deletions

View File

@ -639,7 +639,6 @@ HIDDEN bool contrlav_handler(TMask_field& f, KEY key)
}
TString commandline;
commandline.format("lv0 -3 /i%s",(const char*)tempfile);
TExternal_app lv(commandline);
@ -652,7 +651,7 @@ HIDDEN bool contrlav_handler(TMask_field& f, KEY key)
void TClifo_application::on_config_change()
{
TConfig cnf(CONFIG_DITTA);
TConfig cnf(CONFIG_DITTA, "cg");
_gesven = !_has_cg || (cnf.get_bool("GesVen") || main_app().has_module(PAAUT));
_gessal = !_has_cg || cnf.get_bool("GesSal");
_lbcn = cnf.get_bool("GsLbCn");
@ -662,8 +661,8 @@ void TClifo_application::on_config_change()
init_pages(*_msk);
_msk->show(-9, _gessal); // Mostra campi Estratti conto
_msk->enable(DLG_CONTRLAV, main_app().has_module(LVAUT));
if (_msk->id2pos(DLG_ALTNEWCLI) >= 0)
_msk->set_handler(DLG_ALTNEWCLI, altnewcli_handler);
if (_msk->id2pos(DLG_ALTNEWCLI) >= 0)
_msk->set_handler(DLG_ALTNEWCLI, altnewcli_handler);
}

View File

@ -72,7 +72,7 @@ class TStampa_bilanci : public TPrintapp
TRelation* _rel;
TCursor * _cur;
TProgind * _prog;
TProgress_monitor * _prog;
TSaldi_list* _listacf, * _lista;
TLocalisamfile* _com, * _pcn, * _mov, * _rmov, * _clifo, * _saldi, * _nditte,* _anag,* _caus;
TIsamtempfile * _tmp_saldi_att, * _tmp_saldi_pass, * _tmp_saldi_conti_uno;
@ -2488,7 +2488,7 @@ void TStampa_bilanci::crea_sort_clifo()
//serve solo per la progind: stima alla meno peggio
if (_situazione.empty()) ncur /= 2;
long nitems = ncur*(_clienti.items()+_fornitori.items());
_prog = new TProgind(nitems,TR("Elaborazione in corso... prego attendere"),FALSE);
_prog = new TProgress_monitor(nitems,TR("Elaborazione clienti/fornitori"),false);
_prog->addstatus(1);
init_sort();
if (_situazione == "C") leggi_clifo(_clienti);
@ -3695,7 +3695,7 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
if (_bilancio == 1) //bilancio a sezioni contrapposte
{
printer().footerlen(3);
_prog = new TProgind(_pcn->items(),TR("Elaborazione in corso..."),FALSE);
_prog = new TProgress_monitor(_pcn->items(),TR("Elaborazione conti"), false);
_totali = m.get_bool(F_TOTALI);
_codici = m.get_bool(F_CODICI);
_saldo = m.get_bool(F_SALDO);
@ -3726,7 +3726,7 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
_verifica = m.get_int(F_VERIFICA); //tipo di bilancio di verifica da stampare
_print_full_code = _verifica == 1 && m.get_bool(F_PRINT_FULL_CODE);
if ( (_verifica == 1)||(_verifica == 2) )
_prog = new TProgind(_pcn->items(),TR("Elaborazione in corso..."),FALSE);
_prog = new TProgress_monitor(_pcn->items(),TR("Elaborazione conti"),false);
_tipo_stampa1 = m.get_int(F_STAMPA1);
if (_tipo_stampa1 == 1)
{

View File

@ -8,6 +8,7 @@
#include <execp.h>
#include <mailbox.h>
#include <modaut.h>
#include <recset.h>
#include <urldefid.h>
#include <utility.h>
@ -94,6 +95,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(F_IVAXCASSA, ivaxcassa_handler);
m->set_handler(F_OCCASEDIT, occas_handler);
m->set_handler(F_SOLAIVA, solaiva_handler);
m->set_handler(F_REVCHARGE, revcharge_handler);
m->set_handler(F_SHEETIVA, iva_handler);
m->show(F_LIQDIFF, _liqdiff);
@ -397,7 +399,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
}
else
{
if (nriga >= 2 && nriga <= RIGA_IVA_PER_CASSA)
if (nriga >= 2 && nriga <= RIGA_REVERSE_CHARGE)
continue; // Conti per IVA detraibile e non, ritenute sociali e fiscali
const char tipo = nriga == 1 ? 'T' : ' ';
@ -567,7 +569,8 @@ void TPrimanota_application::init_mask(TMask& m)
}
else
{
const bool corrisp = causale().corrispettivi();
const TCausale& cc = causale();
const bool corrisp = cc.corrispettivi();
bool clig = false, forg = false;
if (_iva == iva_acquisti)
@ -597,8 +600,8 @@ void TPrimanota_application::init_mask(TMask& m)
}
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRISPETTIVO, F_CORRVAL (GROUP 4)
m.show(-4, causale().valintra());
m.show(F_DATAINTRA, causale().intra());
m.show(-4, cc.valintra());
m.show(F_DATAINTRA, cc.intra());
m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard
@ -633,6 +636,11 @@ void TPrimanota_application::init_mask(TMask& m)
const TDate dr = m.get(F_DATAREG);
ixc->enable(gestione_IVAxCassa(dr));
}
TEdit_field& rc = m.efield(F_REVCHARGE);
rc.show(cc.iva() == iva_acquisti && cc.reverse_charge());
activate_split_payment(m);
}
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3)
@ -966,6 +974,8 @@ void TPrimanota_application::init_modify_mode(TMask& m)
// Abilito il bottone di collegamento ai documenti se possibile
const long numdoc = mov.get_long(MOV_DNDOC);
m.show(F_LINKDOC, numdoc > 0 && has_module(VEAUT));
activate_split_payment(m);
}
}
@ -1535,7 +1545,7 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
// Solo regolarizzazioni IVA
if (_automatico->_tipo == 2)
{
_automatico->_totale += m.get_real(F_RITFIS);
_automatico->_totale += m.get_real(F_REVCHARGE);
_automatico->_codiva = m.get(F_CODIVA);
if (_automatico->_codiva.blank() && _rel->iva_items() > 0)
_automatico->_codiva = _rel->iva(0).get(RMI_CODIVA);

View File

@ -76,6 +76,7 @@
#define F_DATAINC 149
#define F_LIQDIFF 150
#define F_IVAXCASSA 167
#define F_SPLITPAY 173
#define F_GRUPPO 180
#define F_CONTO 181

View File

@ -207,7 +207,7 @@ BEGIN
PROMPT 1 9 "Cliente "
FIELD CODCF
GROUP 1
USE LF_CLIFO KEY 1
USE LF_CLIFO
INPUT TIPOCF "C"
INPUT CODCF F_CLIENTE
DISPLAY "Codice" CODCF
@ -233,7 +233,7 @@ BEGIN
PROMPT 1 9 "Fornitore "
FIELD CODCF
GROUP 2
USE LF_CLIFO KEY 1
USE LF_CLIFO
INPUT TIPOCF "F"
INPUT CODCF F_FORNITORE
DISPLAY "Codice" CODCF
@ -570,9 +570,19 @@ BEGIN
FIELD LIQDIFF
MESSAGE FALSE CLEAR,F_DATAINC
MESSAGE TRUE ENABLE,F_DATAINC
FLAGS "H"
FLAGS "HG"
END
LIST F_SPLITPAY 1 2
BEGIN
PROMPT 51 18 "Scissione pagamenti "
FIELD SPLITPAY
ITEM "| "
ITEM "S|Si"
ITEM "N|No"
END
DATE F_DATAINC
BEGIN
PROMPT 52 17 "Data incasso "

View File

@ -47,3 +47,6 @@
#define S_MODOPAG 120
#define S_NREG 121
#define S_NRIG 122
#define S_BLOCCO 123
#define S_MOTIVO 124
#define S_NOTE 125

View File

@ -244,6 +244,9 @@ BEGIN
ITEM "Modalità di\npagamento@30"
ITEM "N.reg."
ITEM "N.riga"
ITEM "Blocco"
ITEM "Motivo"
ITEM "Note@50"
END
ENDPAGE
@ -285,7 +288,7 @@ ENDPAGE
ENDMASK
PAGE "Riga" -1 -1 78 13
PAGE "Riga" -1 -1 78 15
GROUPBOX DLG_NULL 76 6
BEGIN
@ -461,6 +464,21 @@ BEGIN
PROMPT 2 10 "Data "
END
BOOLEAN S_BLOCCO
BEGIN
PROMPT 2 11 "Rata Bloccata"
END
STRING S_MOTIVO 6
BEGIN
PROMPT 24 11 "Motivo "
END
STRING S_NOTE 50
BEGIN
PROMPT 2 12 "Note "
END
ENDPAGE
TOOLBAR "topbar" 0 0 0 2

View File

@ -316,7 +316,7 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
case 'R': // Ritenute professionali
case 'S': // Ritenute Sociali
case 'V': // Reverse charge
case '2': // IVA per scissione pagamenti art, 17-ter DPR 633/72
case '2': // IVA per scissione pagamenti art.17-ter DPR 633/72
last = 3;
break;
case 'K': // Riga cliente/fornitore per saldaconto
@ -324,7 +324,7 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
break;
first = 2;
case 'I': // Imponibile o contropartita saldaconto
case '1': // Cliente per scissione pagamenti art, 17-ter DPR 633/72
case '1': // Cliente per scissione pagamenti art.17-ter DPR 633/72
last = 7;
break;
default:
@ -388,8 +388,7 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
}
else
{
const char contro_type = tipo == '2' ? 'D' : 'T';
const int pos = type2pos(contro_type);
const int pos = type2pos('T');
if (pos >= 0)
{
TBill contro(cg.row(pos), 2, 0x3);
@ -1390,7 +1389,9 @@ real TPrimanota_application::calcola_imp() const
// Se e' attiva la terza pagina allora riporta i totali in testata
if (is_fattura())
{
real tot = m.get(F_TOTALE); tot -= imposte;
real tot = m.get(F_TOTALE);
if (!m.efield(F_REVCHARGE).active())
tot -= imposte;
m.set(FS_IMPONIBILI, tot);
m.set(FS_IMPOSTE, imposte);
}
@ -2160,21 +2161,21 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
if (mov.get_bool(MOV_STAMPATO))
{
ok = f.yesno_box(TR("Il movimento e' gia' stato stampato sul libro giornale:\n"
ok = f.yesno_box(TR("Il movimento è già stato stampato sul libro giornale:\n"
"si desidera continuare ugualmente?"));
a._skip_giornale_check = ok;
}
if (ok && mov.get_bool(MOV_REGST))
{
ok = f.yesno_box(TR("Il movimento e' gia' stato stampato sul bollato:\n"
ok = f.yesno_box(TR("Il movimento è già stato stampato sul bollato:\n"
"si desidera continuare ugualmente?"));
a._skip_bollato_check = ok;
}
if (ok && mov.get_bool(MOV_INVIATO))
{
ok = f.yesno_box(TR("Il movimento e' stato inviato ad un'altra contabilita':\n"
ok = f.yesno_box(TR("Il movimento è stato inviato ad un'altra contabilità:\n"
"si desidera continuare ugualmente?"));
}
@ -2235,9 +2236,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
if (!suspended_handler(f, key))
return false;
TMask& m = f.mask();
const int ann = m.get_int(F_ANNOIVA);
const TString& cau = f.get();
@ -2245,21 +2244,25 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
if (!c.ok())
return false;
const TCausale& k = app().causale();
TPrimanota_application& a = app();
const TCausale& k = a.causale();
const TString& msg = c.compatible(k);
if (msg.not_empty()) // La causale non e' compatibile
{
if (m.insert_mode() && !app()._sal_dirty)
if (m.insert_mode() && !a._sal_dirty)
{
// Cambio la maschera al volo
if (app().force_mask_swap(k, c))
if (a.force_mask_swap(k, c))
{
TString4 provv;
provv << c.provvisorio();
m.set(F_PROVVISORIO, provv);
if (c.iva() != nessuna_iva && m.id2pos(F_SOLAIVA) > 0)
m.set(F_SOLAIVA, c.soloiva() ? "X" : " ");
{
m.set(F_SOLAIVA, c.soloiva() ? "X" : " ");
m.efield(F_REVCHARGE).show(c.iva() == iva_acquisti && c.reverse_charge());
}
return true;
}
}
@ -2268,15 +2271,17 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
if (key == K_TAB)
{
app().read_caus(cau, ann);
app().cgs().force_update();
a.read_caus(cau, ann);
a.cgs().force_update();
TString4 provv;
provv << c.provvisorio();
TString4 provv; provv << c.provvisorio();
m.set(F_PROVVISORIO, provv);
if (c.iva() != nessuna_iva)
{
m.set(F_SOLAIVA, c.soloiva() ? "X" : " ");
m.efield(F_REVCHARGE).show(c.iva() == iva_acquisti && c.reverse_charge());
a.activate_split_payment(m);
}
}
}
@ -2323,12 +2328,12 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
return f.error_box(TR("La data dell'operazione non appartiene a nessun esercizio"));
TLibro_giornale& gio = a.giornale();
const int ar = dr.year(); // Anno per registri
if (m.query_mode() || gio.year() != ar)
const int ag = a._esercizi[ae].inizio().year(); // Anno libro giornale
if (m.query_mode() || gio.year() != ag)
{
ok = gio.read(ar);
ok = gio.read(ag);
if (!ok)
return f.error_box(FR("Non esiste il libro giornale del %d"), ar);
return f.error_box(FR("Non esiste il libro giornale del %d"), ag);
}
else
ok = true;
@ -2343,16 +2348,17 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
if (dr < gio.last_print())
{
f.error_box(FR("La data dell'operazione è antecedente al %s,\n"
"ultima stampa del libro giornale del %d"),
gio.last_print().string(), ar);
"ultima stampa del libro giornale del %d"),
gio.last_print().string(), ag);
if (error) return false;
}
if (key == K_TAB && dr < gio.last_reg())
f.warning_box(FR("La data dell'operazione è antecedente al %s,\n"
"ultima registrazione sul libro giornale del %d"),
gio.last_reg().string(), ar);
gio.last_reg().string(), ag);
}
const int ar = dr.year(); // Anno solare registri
if (m.query_mode())
a.read_caus(m.get(F_CODCAUS), ar);
@ -2896,6 +2902,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
f.set_dirty(); // warning_box cleans the field!
}
a.activate_numrif(m, true);
a.activate_split_payment(m);
if (f.focusdirty())
{
@ -3036,31 +3043,68 @@ static void force_iva_det_bill()
cgs.force_update();
}
bool TPrimanota_application::is_split_payment() const
bool TPrimanota_application::activate_split_payment(TMask& m)
{
bool yes = false;
const TMask& m = curr_mask();
if (clifo() == 'C' && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
TMask_field* sp = m.find_by_id(F_SPLITPAY);
if (sp != NULL)
{
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CLIENTE));
if (cliente.get_bool(CLI_SPLITPAY))
if (clifo() == 'C' && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
{
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
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CLIENTE));
yes = cliente.get_bool(CLI_SPLITPAY);
}
if (yes)
{
sp->show();
if (sp->get().blank())
sp->set("S"); // Set
}
else
{
sp->hide();
sp->reset();
}
}
return yes;
}
bool TPrimanota_application::is_split_payment() const
{
const TMask& m = curr_mask();
char s = ' ';
TMask_field* sp = m.find_by_id(F_SPLITPAY);
if (sp != NULL)
{
if (sp->shown())
s = sp->get()[0];
else
return false;
}
if (s != 'N' && s != 'S')
{
s = 'N';
if (clifo() == 'C' && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
{
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);
if (::is_split_payment(rel.curr()))
s = 'S';
}
}
}
return s == 'S';
}
bool TPrimanota_application::is_fattura_split() const
{
return is_fattura() && is_split_payment();
}
// Handler of the F_LIQDIFF
// Certified 99%
bool TPrimanota_application::liqdiff_handler(TMask_field& f, KEY key)

View File

@ -214,6 +214,7 @@ protected:
bool is_fattura() const { return is_saldaconto() && causale().tipomov() == 1; }
bool is_nota_credito() const { return is_saldaconto() && causale().tipomov() == 2; }
bool is_pagamento() const { return is_saldaconto() && causale().tipomov() >= 3; }
bool activate_split_payment(TMask& m);
bool is_split_payment() const;
bool is_fattura_split() const;

View File

@ -97,7 +97,7 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
break;
case K_DEL:
doit = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(14) != 'X'; // non cancellabile
doit = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(15) != 'X'; // non cancellabile
if (doit)
{
pag.remove_rata(r);
@ -829,7 +829,7 @@ bool TPrimanota_application::read_scadenze(TMask& m)
const bool is_split = !in_valuta && clifo.tipo() == 'C' && anno >= 2015 && is_split_payment();
const real totale_cg = m.get_real(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
real totale_sc = partita.importo(in_valuta).valore() + partita.get_real(PART_SPESE);
real totale_sc = partita.importo(in_valuta).valore();
if (is_split)
totale_sc += m.get_real(F_IMPOSTE);
@ -894,9 +894,15 @@ bool TPrimanota_application::read_scadenze(TMask& m)
m.set(FS_AGENTE, scadenza.get(SCAD_CODAG));
}
str.add(scadenza.get(SCAD_DESCR), 11);
str.add(scadenza.get(SCAD_BLOCCATA), 12);
str.add(scadenza.get(SCAD_MOTIVO), 13);
str.add(prot ? "X" : " ", 14);
bool bloc = scadenza.get_bool(SCAD_BLOCCATA);
const TString8 motivo = scadenza.get(SCAD_MOTIVO);
if (bloc || motivo.full())
{
str.add("X", 12);
str.add(motivo, 13);
str.add(cache().get("%CBP", motivo, "S0"), 14);
}
str.add(prot ? "X" : " ", 15);
}
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
m.set(FS_NAMEPAG, pag.name());

View File

@ -775,19 +775,7 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
if (level == 3)
{
if (good_rat)
{
good_rat = nrigp <= 0 && !scad->chiusa() && !scad->get_bool(SCAD_BLOCCATA);
/* Commentato in quanto impedisce di saldare le note di credito
if (good_rat)
{
const char expected_section = scad->get_char(SCAD_TIPOCF) == 'C' ? 'D' : 'A';
TImporto res = scad->residuo(true);
res.normalize(expected_section); // res.normalize(scad->riga().sezione());
if (res.valore () <= ZERO) // In realtà è chiusa!
good_rat = false;
}
*/
}
good_rat = nrigp <= 0 && !scad->chiusa();
}
else
good_rat &= good_pag;
@ -844,6 +832,19 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
const TRiga_partite& riga = game.riga(nriga);
set_row_str(sheet, row, S_NUMDOC, riga.get(PART_NUMDOC));
set_row_str(sheet, row, S_DATADOC, riga.get(PART_DATADOC));
set_row_str(sheet, row, S_NOTE, scad->get(SCAD_DESCR));
if (scad->get_bool(SCAD_BLOCCATA))
{
set_row_bool(sheet, row, S_BLOCCO, true);
sheet.disable_cell(sheet.items()-1, -1);
const TString8 cbp = scad->get(SCAD_MOTIVO);
if (cbp.full())
{
set_row_str(sheet, row, S_MOTIVO, cbp);
set_row_str(sheet, row, S_NOTE, cache().get("%CBP", cbp, "S0"));
}
}
}
// Propone data di pagamento per le RIBA
@ -907,7 +908,7 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
}
else
{
// Nota di credito non assegnata e senza pagamenti n questo movimento
// Nota di credito non assegnata e senza pagamenti in questo movimento
if (level == 4 && nriga == TPartita::UNASSIGNED && nrigp == 0 && has_lonely_nc(game))
{
const TImporto sld = game.calcola_saldo(true);

View File

@ -1,4 +1,4 @@
PAGE "Rata pagamento" -1 -1 51 15
PAGE "Rata pagamento" -1 -1 51 16
DATE 101
BEGIN
@ -154,24 +154,30 @@ END
BOOLEAN 113
BEGIN
PROMPT 12 11 "Bloccata"
PROMPT 1 13 "Bloccata"
MESSAGE FALSE CLEAR,114
MESSAGE TRUE ENABLE,114
END
STRING 114 6
BEGIN
PROMPT 30 11 "Motivo "
PROMPT 17 13 "Motivazione del blocco "
USE %CBP
INPUT CODTAB 114
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 114 CODTAB
OUTPUT 115 S0
CHECKTYPE NORMAL
END
STRING 115 50 47
BEGIN
PROMPT 1 14 ""
FLAGS "D"
END
BOOLEAN 115
BOOLEAN 116
BEGIN
PROMPT 1 -1 "Non cancellabile"
FLAGS "D"

View File

@ -232,7 +232,8 @@ BEGIN
ITEM "Vs.CAB"
ITEM "Note@50"
ITEM "Bloccata"
ITEM "Motivo"
ITEM "Codice"
ITEM "Motivazione@50"
ITEM "Non cancellabile"
END

View File

@ -6,7 +6,6 @@
#include <relation.h>
#include <tabutil.h>
class TAp_eser : public TSkeleton_application
{
int _anno, _newanno;
@ -38,7 +37,7 @@ bool TAp_eser::mask_newanno (TMask_field& f, KEY k)
const int newanno = f.mask().get_int(F_NUOVOANNO);
if (app()._esc->exist(newanno))
return f.warning_box (FR("Il codice %04d e' gia' presente nella tabella degli esercizi!"),
return f.warning_box (FR("Il codice %04d è già presente nella tabella degli esercizi!"),
newanno);
}
return TRUE;
@ -52,9 +51,9 @@ bool TAp_eser::mask_dataini (TMask_field& f, KEY k)
TDate fine(f.mask().get(F_DATAFINC));
if ( data <= fine )
return f.warning_box (TR("La data di inizio del nuovo esercizio deve essere superiore alla data di fine esercizio precedente"));
return f.error_box (TR("La data di inizio del nuovo esercizio deve essere superiore alla data di fine esercizio precedente"));
}
return TRUE;
return true;
}
bool TAp_eser::create()
@ -69,13 +68,12 @@ bool TAp_eser::create()
bool TAp_eser::destroy()
{
delete _esc;
return TSkeleton_application::destroy();
}
void TAp_eser::main_loop()
{
int anno = _esc->last();
int anno = _esc->last();
if (anno > 0)
{
@ -109,17 +107,16 @@ void TAp_eser::main_loop()
}
}
else
error_box(TR("Non e' ancora stato aperto alcun esercizio!"));
error_box(TR("Non è ancora stato aperto alcun esercizio!"));
}
bool TAp_eser::apertura_es()
{
TString8 anno;
TString8 annonew;
TString4 anno, annonew;
TDate data;
TRelation reg("REG");
TRectype & tabreg = reg.curr();
bool ok = FALSE;
bool ok = false;
//viene aggiornata la tabella dei registri. Se esisteva gia' un record relativo al nuovo esercizio, viene cancellato.
//In ogni caso ne viene creato uno nuovo relativo al nuovo esercizio.
@ -150,7 +147,7 @@ bool TAp_eser::apertura_es()
{
TString16 cod(tabreg.get("CODTAB"));
ok = TRUE;
ok = true;
annonew.format("%04d", _datafin.year());
cod.overwrite(annonew);
tabreg.put("CODTAB", cod);

View File

@ -600,8 +600,8 @@ bool TLibro_giornale::read(int y)
if (y <= 0)
{
const TDate oggi(TODAY);
y = oggi.year();
TEsercizi_contabili esc;
y = esc[esc.last()].inizio().year();
}
TString4 anno; anno.format("%04d", y);

View File

@ -168,29 +168,34 @@ bool is_reverse_charge(const TRectype& mov)
bool is_split_payment(const TRectype& mov)
{
bool yes = false;
if (mov.get_char(MOV_TIPO) == 'C' && mov.get_int(MOV_ANNOIVA) >= 2015 &&
mov.get_real(MOV_RITFIS).is_zero() && mov_has_imposte(mov))
char s = mov.get_char(MOV_SPLITPAY);
if (s != 'N' && s != 'S') // Auto
{
const TRectype& clifo = cache().get_rec(LF_CLIFO, "C", mov.get(MOV_CODCF));
if (clifo.get_bool(CLI_SPLITPAY)) // Ente pubblico con split payment
bool yes = false;
if (mov.get_char(MOV_TIPO) == 'C' && mov.get_int(MOV_ANNOIVA) >= 2015 &&
mov.get_real(MOV_RITFIS).is_zero() && mov_has_imposte(mov))
{
yes = !is_reverse_charge(mov);
if (yes && get_tipo_movimento(mov) == tm_nota_credito) // Controlla le N.C.
const TRectype& clifo = cache().get_rec(LF_CLIFO, "C", mov.get(MOV_CODCF));
if (clifo.get_bool(CLI_SPLITPAY)) // Ente pubblico con split payment
{
if (mov.get_bool(MOV_LIQDIFF))
yes = false;
else
yes = !is_reverse_charge(mov);
if (yes && get_tipo_movimento(mov) == tm_nota_credito) // Controlla le N.C.
{
TISAM_recordset par("USE PART KEY 2 SELECT ANNO<2015\nFROM NREG=#NR\nTO NREG=#NR");
par.set_var("#NR", mov.get_long(MOV_NUMREG));
if (!par.empty()) // Se la nota si rifersice a partite vecchie non ha lo split payment
if (mov.get_bool(MOV_LIQDIFF))
yes = false;
else
{
TISAM_recordset par("USE PART KEY 2 SELECT ANNO<2015\nFROM NREG=#NR\nTO NREG=#NR");
par.set_var("#NR", mov.get_long(MOV_NUMREG));
if (!par.empty()) // Se la nota si rifersice a partite vecchie non ha lo split payment
yes = false;
}
}
}
}
s = yes ? 'S' : 'N';
}
return yes;
return s == 'S';
}
bool is_IVA_diff(const TRectype& mov)

View File

@ -628,8 +628,18 @@ TFieldtypes TSolder_tree::get_var(const TString& name, TVariant& var) const
const TRiga_scadenze& rata = fatt.rata(nrata);
if (name == PART_DESCR)
{
TString16 desc;
desc << nrata << '/' << fatt.rate();
TString80 desc;
desc.format("%d/%d ", nrata, fatt.rate());
if (rata.get_bool(SCAD_BLOCCATA))
{
const TString8 cbp = rata.get(SCAD_MOTIVO);
if (cbp.full())
desc << cache().get("%CBP", cbp, "S0");
else
desc << TR("Bloccata");
}
else
desc << rata.get(SCAD_DESCR);
var = desc;
} else
if (name == PART_NUMDOC)

View File

@ -1,3 +1,3 @@
23
0
$mov|0|0|460|0|Movimenti di prima nota|||
$mov|0|0|461|0|Movimenti di prima nota|||

View File

@ -1,5 +1,5 @@
23
53
54
ANNOES|9|4|0|Codice esercizio
NUMREG|3|7|0|Numero di operazione
DATAREG|5|8|0|Data operazione
@ -50,6 +50,7 @@ DNDOC|3|7|0|Documento originale NDOC
DATAINC|5|8|0|Data di incasso per liquidazione differita
LIQDIFF|8|1|0|Flag di movimento a liquidazione differita
IVAXCASSA|8|1|0|Flag di movimento IVA per cassa
SPLITPAY|1|1|0|Flag di scissione pagamenti [_=Auto,S=Split,N=Normale]
NOLEGGIO|1|1|0|Tipo veicolo Auto, Camper, Altro, Diporto, aEreo
INVIOFE|5|8|0|Data invio definitivo dati rilevanti
CONTSEP|1|6|0|Contabilità separata