git-svn-id: svn://10.65.10.50/branches/R_10_00@23111 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2015-06-17 07:14:27 +00:00
parent 9c648a2557
commit 79e92e731f
25 changed files with 492 additions and 521 deletions

View File

@ -2368,7 +2368,7 @@ BEGIN
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Progr." CODTAB[11,12]
DISPLAY "IBAN@25" S3
DISPLAY "IBAN@27" S3
DISPLAY "Denominazione@50" 100@->S0
OUTPUT F_BBAN_ABI CODTAB[1,5]
OUTPUT F_BBAN_CAB CODTAB[6,10]

View File

@ -119,45 +119,46 @@ int TStampa_deleghe_IVA::select()
TToken_string d(80);
_ditte->destroy();
begin_wait();
for (_nditte->first(); _nditte->good(); _nditte->next())
{
TLocalisamfile& anag = _nditte->lfile(LF_ANAG);
TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale
const TString16 con = com.get("UFFCONC");
if (_concessione.not_empty() && _concessione != con) continue;
const bool cf = anag.get_bool("TITCF");
if (contofis != cf) continue;
const int tstdel = anag.get_int("TIPOSTDEL");
if (tstdel != del_dis_bol) continue;
const long dit = _nditte->lfile().get_long("CODDITTA");
chiave.format("%05ld%04d%02d%d", dit, _anno, _mese, _tipo);
deleghe.put("CODTAB", chiave);
if (deleghe.read() == NOERR && deleghe.get_bool("B0") == FALSE) // Da stampare
TWait_cursor hourglass;
const TRectype& anag = _nditte->curr(LF_ANAG);
const TRectype& com = _nditte->curr(LF_COMUNI); // Comune residenza fiscale
for (_nditte->first(); _nditte->good(); _nditte->next())
{
const long abi = deleghe.get_long("S7");
const long cab = deleghe.get_long("S8");
if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab))
const TString16 con = com.get("UFFCONC");
if (_concessione.full() && _concessione != con)
continue;
const bool cf = anag.get_bool("TITCF");
if (contofis != cf) continue;
const int tstdel = anag.get_int("TIPOSTDEL");
if (tstdel != del_dis_bol) continue;
const long dit = _nditte->lfile().get_long("CODDITTA");
chiave.format("%05ld%04d%02d%d", dit, _anno, _mese, _tipo);
deleghe.put("CODTAB", chiave);
if (deleghe.read() == NOERR && deleghe.get_bool("B0") == FALSE) // Da stampare
{
d = " "; // Selezione
d.add(dit); // Codice ditta
d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome
d.add(deleghe.get_real("R0").string(".")); // Importo
d.add(deleghe.get_real("R1").string(".")); // Interesse
d.add(abi ? format("%05ld", abi) : ""); // Azienda
d.add(cab ? format("%05ld", cab) : ""); // Dipendenza
d.add(con); // Concessione
d.add(cf ? "X" : " "); // Conto fiscale
_ditte->add(d);
const long abi = deleghe.get_long("S7");
const long cab = deleghe.get_long("S8");
if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab))
{
d = " "; // Selezione
d.add(dit); // Codice ditta
d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome
d.add(deleghe.get_real("R0").string(".")); // Importo
d.add(deleghe.get_real("R1").string(".")); // Interesse
d.add(abi ? format("%05ld", abi) : ""); // Azienda
d.add(cab ? format("%05ld", cab) : ""); // Dipendenza
d.add(con); // Concessione
d.add(cf ? "X" : " "); // Conto fiscale
_ditte->add(d);
}
}
}
}
end_wait();
int res = 1;
if (_ditte->items() > 0)

View File

@ -2209,7 +2209,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
if (!fexist("in0.exe"))
return false;
const bool bModify = xvt_str_compare_ignoring_case(action, "Modify") == 0;
const BOOLEAN bModify = xvt_str_same(action, "Modify");
TFilename intrini;
intrini.tempdir();
@ -2306,7 +2306,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
}
// Inserisci il totale documento solo in inserimento!
if (xvt_str_compare_ignoring_case(action, "Insert") == 0)
if (xvt_str_same(action, "Insert"))
{
real totdoc = m.get_real(valintra ? F_CORRISPETTIVO : F_IMPONIBILI);
if (test_swap(false))

View File

@ -316,15 +316,16 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
case 'R': // Ritenute professionali
case 'S': // Ritenute Sociali
case 'V': // Reverse charge
case '1': // 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
if (curr_mask().is_running() && n == cg.items()-1) // Sono in inserimento di una riga nuova
break;
first = 2;
case 'I':
last = 7; // Imponibile o contropartita saldaconto
case 'I': // Imponibile o contropartita saldaconto
case '1': // Cliente per scissione pagamenti art, 17-ter DPR 633/72
last = 7;
break;
default:
last = 0; // Solo contabile
@ -387,7 +388,8 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
}
else
{
const int pos = type2pos('T');
const char contro_type = tipo == '2' ? 'D' : 'T';
const int pos = type2pos(contro_type);
if (pos >= 0)
{
TBill contro(cg.row(pos), 2, 0x3);
@ -409,13 +411,13 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
HIDDEN int compare_rows(const TSortable& o1, const TSortable& o2, void* jolly)
{
// Totale, Rit.Fisc., Rit.Soc., Rev.Charge, da riga IVA, riga contabile, IVA detr., IVA non detr.
const char* const sort_order = "TFSVI DN1APRC";
const char* const sort_order = "TFSVI DN12APRC";
const TToken_string& r1 = (const TToken_string&)o1;
const TToken_string& r2 = (const TToken_string&)o2;
const TPrimanota_application& a = *(TPrimanota_application*)jolly;
const char c1 = a.row_type(*r1);
const char c2 = a.row_type(*r2);
const char c1 = a.row_type(r1);
const char c2 = a.row_type(r2);
return int(strchr(sort_order, c1) - strchr(sort_order, c2));
}
@ -537,8 +539,7 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
TImporto residuo(imptot); residuo -= cassa; residuo.normalize(imptot.sezione());
bool ok = true;
// if (!residuo.is_zero())
if (abs(residuo.valore()) >= 0.001)
if (abs(residuo.valore()) >= 0.001) // if (!residuo.is_zero())
{
TPrimanota_application& a = app();
const TMask& m = a.curr_mask();
@ -1650,26 +1651,43 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
// Controllo split-payment (dalla versione 12)
if (m.get_int(F_ANNOIVA) >= 2015 && a.clifo() == 'C' && a.get_version() >= 12)
{
const int r_norm = type2pos('D');
const int r_split = type2pos('1');
const int r_norm = type2pos('D');
const bool split_needed = r_norm >= 0 && a.is_split_payment();
if (split_needed)
{
TImporto imp_split = a.get_cgs_imp(r_norm); imp_split.swap_section();
if (r_split < 0)
TImporto imp_split = a.get_cgs_imp(r_norm);
const int r_split1 = type2pos('1');
if (r_split1 < 0)
{
const int r_tot = max(0, type2pos('T'));
TToken_string row_tot = a.cgs().row(r_tot);
TBill cliente_split(row_tot, 2, 0x1); // Imposta anche tipo = Cliente
const char* desc = TR("IVA art.17-ter D.P.R. 633/1972");
a.set_cgs_row(-1, imp_split, cliente_split, desc, '1');
}
else
a.set_cgs_imp(r_split1, imp_split);
const int r_split2 = type2pos('2');
imp_split.swap_section();
if (r_split2 < 0)
{
TToken_string row_norm = a.cgs().row(r_norm);
TBill iva_split(row_norm, 3);
const char* desc = TR("IVA art. 17-ter D.P.R. 633/1972)");
a.set_cgs_row(-1, imp_split, iva_split, desc, '1');
const char* desc = TR("IVA art.17-ter D.P.R. 633/1972");
a.set_cgs_row(-1, imp_split, iva_split, desc, '2');
}
else
a.set_cgs_imp(r_split, imp_split);
a.set_cgs_imp(r_split2, imp_split);
}
else
{
if (r_split >= 0)
a.reset_cgs_row(r_split);
const int r_split2 = type2pos('2');
if (r_split2 >= 0)
a.reset_cgs_row(r_split2);
const int r_split1 = type2pos('1');
if (r_split1 >= 0)
a.reset_cgs_row(r_split1);
}
}
@ -1712,7 +1730,6 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
if (pimposta != imposta || pimponibile != imponibile)
a.set_scadenze(m); // Ricalcola rate
}
}
return true;
}
@ -2187,24 +2204,23 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
// Certified 99%
bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
{
const TMask& m = f.mask();
if (!m.is_running())
return true;
if (f.to_check(key))
if (key == K_TAB || key == K_ENTER)
{
const TMask& m = f.mask();
const TString& cau = f.get();
const int ann = m.get_int(F_ANNOIVA);
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo
if (i == iva_errata && m.is_running())
return f.error_box(TR("Causale non presente in archivio"));
TEdit_field& numreg = m.efield(F_NUMREG);
TString16 filter; if (cau.full()) filter << MOV_CODCAUS << "==\"" << cau << '"';
TString16 filter;
if (cau.full())
filter << MOV_CODCAUS << "==\"" << cau << '"';
numreg.browse()->set_filter(filter);
numreg.browse()->cursor()->setfilter(filter, true);
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo
if (i != iva_errata)
return suspended_handler(f, key); // Controlla sospensione
else
return error_box(TR("Causale non presente in archivio"));
return suspended_handler(f, key); // Controlla sospensione
}
return true;
@ -2728,13 +2744,6 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
else
{
// Creazione/Aggiornamento riga totale
real tot = m.get(F_TOTALE);
if (app().is_split_payment())
{
calcola_imp(); // Ricalcola totale IVA
tot -= m.get_real(F_IMPOSTE);
}
TString80 descr;
if (riga_totale >= 0)
{
@ -2743,9 +2752,8 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
}
if (descr.blank())
descr = m.get(F_DESCR);
TImporto imp = real2imp(tot, 'T');
imp.normalize();
set_cgs_row(riga_totale, imp, nuovo, descr, 'T');
TImporto imp = real2imp(m.get_real(F_TOTALE), 'T');
set_cgs_row(riga_totale, imp.normalize(), nuovo, descr, 'T');
}
calcola_imp(); // Ricalcola totale IVA
@ -2921,7 +2929,7 @@ bool TPrimanota_application::IVA2bill(const TCodiceIVA& iva, TBill& bill)
}
// Handler of the F_CODIVA
// Handler of the F_CODIVA di testa (insert mode only)
// Certified 99%
bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
{
@ -2937,15 +2945,17 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
TPrimanota_application& a = app();
const real imp(a.ivas().row(1).get(0));
if (a.iva() == iva_acquisti && a.causale().intra())
//if (a.iva() == iva_acquisti && a.causale().intra())
if (a.iva() == iva_acquisti && a.causale().reverse_charge()) // 16-06-2015
{
const real iva(f.mask().get_real(F_RITFIS));
const real iva = f.mask().get(F_REVCHARGE);
if (iva.is_zero())
{
TCodiceIVA codiva(f.get());
const real totale = f.mask().get_real(F_TOTALE);
TMask& mm = f.mask(); // Main mask
const TCodiceIVA codiva(f.get());
const real totale = mm.get_real(F_TOTALE);
const real imposta = codiva.imposta(totale);
f.mask().set(F_RITFIS, imposta, true);
mm.set(F_REVCHARGE, imposta, true);
}
}
if (imp.is_zero()) // Se il totale documento non è stato spezzato
@ -3030,7 +3040,7 @@ bool TPrimanota_application::is_split_payment() const
{
bool yes = false;
const TMask& m = curr_mask();
if (clifo() == 'C' && m.get_int(F_ANNOIVA) >= 2015)
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))
@ -3045,6 +3055,12 @@ bool TPrimanota_application::is_split_payment() const
return yes;
}
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)
@ -3056,7 +3072,7 @@ bool TPrimanota_application::liqdiff_handler(TMask_field& f, KEY key)
{
if (f.mask().get_bool(F_IVAXCASSA))
return f.error_box(TR("Non è ammessa IVA per cassa a liquidazione differita"));
if (app().is_fattura() && app().is_split_payment())
if (app().is_fattura_split())
return f.error_box(TR("Non è ammessa la liquidazione differita con split payment"));
}
@ -3072,7 +3088,7 @@ bool TPrimanota_application::ivaxcassa_handler(TMask_field& f, KEY key)
if (key == K_ENTER && f.get().full())
{
if (app().is_fattura() && app().is_split_payment())
if (app().is_fattura_split())
return f.error_box(TR("Non è ammessa IVA per cassa con split payment"));
}
@ -3311,9 +3327,7 @@ bool TPrimanota_application::dataintra_handler(TMask_field& f, KEY key)
{
// Se la data INTRA e' vuota allora copiala dalla data di competenza normale
if (key == K_ENTER && f.empty())
{
f.set(f.mask().get(F_DATAREG));
}
return true;
}

View File

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

View File

@ -126,6 +126,12 @@ bool TCausale::soloiva() const
int TCausale::regime_speciale() const
{ return _rec.get_int(CAU_REGSPIVA); }
bool TCausale::reverse_charge() const
{
const int rsi = regime_speciale();
return rsi == 13 || rsi == 50 || rsi == 51; // Reverse charge!
}
bool TCausale::esclusione_allegati() const
{ return _rec.get_bool(CAU_ALLEG); }

View File

@ -38,6 +38,7 @@ public:
bool intra() const;
bool valintra() const;
bool soloiva() const;
bool reverse_charge() const;
char provvisorio() const { return _provvisorio; }
const TString& causale_collegata() const;
const TString& causale_reg_iva() const;

View File

@ -828,23 +828,23 @@ bool TPrimanota_application::read_scadenze(TMask& m)
const bool in_valuta = ::is_true_value(m.get(SK_VALUTA));
const bool is_split = !in_valuta && clifo.tipo() == 'C' && anno >= 2015 && is_split_payment();
real totale = m.get_real(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
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);
if (is_split)
totale -= m.get_real(F_IMPOSTE);
totale_sc += m.get_real(F_IMPOSTE);
if (totale != partita.importo(in_valuta).valore())
if (totale_cg != totale_sc)
{
const TString& codval = m.get(SK_VALUTA);
const TCurrency totdoc_c(totale, codval);
const TCurrency totdoc_s(partita.importo(in_valuta).valore(), codval);
const TString i1 = totdoc_c.string(true);
const TString i2 = totdoc_s.string(true);
warning_box(FR("Il totale documento (%s) non corrisponde a quello del saldaconto (%s)."),
(const char*)i1, (const char*)i2);
const TCurrency totdoc_c(totale_cg, codval);
const TCurrency totdoc_s(totale_sc, codval);
const char* i1 = totdoc_c.string(true);
const char* i2 = totdoc_s.string(true);
warning_box(FR("Il totale documento (%s) non corrisponde a quello del saldaconto (%s)."), i1, i2);
}
if (iva() != nessuna_iva)
if (iva() != nessuna_iva && !is_split)
{
const real imposte_cg = is_split ? ZERO : m.get_real(F_IMPOSTE);
const real imposte_cg = m.get_real(F_IMPOSTE);
const real imposte_sc = partita.get_real(PART_IMPOSTA);
if (imposte_cg != imposte_sc)
{

View File

@ -44,7 +44,7 @@ END
BOOLEAN F_RECALC
BEGIN
PROMPT 53 5 "Ricalcolo automatico"
MESSAGE true ENABLE,F_RDIFFER|ENABLE,F_MCOMM
MESSAGE TRUE ENABLE,F_RDIFFER|ENABLE,F_MCOMM
MESSAGE FALSE DISABLE,F_RDIFFER|DISABLE,F_MCOMM
END

View File

@ -385,7 +385,8 @@ BEGIN
ITEM "S|Ritenute sociali"
ITEM "T|Totale documento"
ITEM "V|IVA Reverse charge"
ITEM "1|IVA scissione pag."
ITEM "1|Cliente scissione pag."
ITEM "2|IVA scissione pag."
FLAGS "D"
FIELD ROWTYPE
END

View File

@ -156,7 +156,7 @@ BOOLEAN 113
BEGIN
PROMPT 12 11 "Bloccata"
MESSAGE FALSE CLEAR,114
MESSAGE true ENABLE,114
MESSAGE TRUE ENABLE,114
END
STRING 114 6

View File

@ -410,7 +410,7 @@ int TStampa_giornale::set_totali_giorno(const TDate& data, const int righeiva)
TString80 td; real2currency(td, _tot_dare_gg);
TString80 ta; real2currency(ta, _tot_avere_gg);
sprintf(dep, FR("@b@%dgTotale operazioni del %s @%dg%c %s @%dg%c @%dg%s"),
sprintf_s(dep, sizeof(dep), FR("@b@%dgTotale operazioni del %s @%dg%c %s @%dg%c @%dg%s"),
_stampa_width == 132 ? SCRITTA : DARE198-STACC,
data.string(),
_stampa_width == 132 ? TOTDARE132 : DARE198-2,
@ -431,7 +431,7 @@ int TStampa_giornale::set_totali_giorno(const TDate& data, const int righeiva)
TString80 tdp; real2currency(tdp, _tot_dare_gg_ap);
TString80 tap; real2currency(tap, _tot_avere_gg_ap);
sprintf (dep, FR("@b@%dgTotale operazioni del %s Anno precedente @%dg%c %s @%dg%c @%dg%s"),
sprintf_s(dep, sizeof(dep), FR("@b@%dgTotale operazioni del %s Anno precedente @%dg%c %s @%dg%c @%dg%s"),
_stampa_width == 132 ? SCRITTA : DARE198-STACC,
data.string(),
_stampa_width == 132 ? TOTDARE132 : DARE198-2,
@ -1368,18 +1368,15 @@ int TStampa_giornale::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
if (viacf.not_empty())
{
sprintf (riga, "@%dg%s %s",
POSCONTO,
(const char*) viacf,
(const char*) civcf
);
sprintf_s(riga, sizeof(riga), "@%dg%s %s",
POSCONTO, (const char*)viacf, (const char*)civcf);
set_row (r++, riga);
}
if (comune.not_empty() || prov.not_empty() || capcf.not_empty())
{
sprintf (riga, "@%dg%s %s %s",
sprintf_s(riga, sizeof(riga), "@%dg%s %s %s",
POSCONTO,
(const char*) capcf, (const char*) comune,
(const char*) prov
@ -1391,7 +1388,8 @@ int TStampa_giornale::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
if (tipoa == 'F')
{
TString80 comna;
TString16 datana, codcomna, provna, capna, statona;
TString16 datana, codcomna;
TString8 provna, capna, statona;
datana = clifo.get("DATANASC");
@ -1405,9 +1403,8 @@ int TStampa_giornale::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
provna = dep.get(COM_PROVCOM);
capna = dep.get(COM_CAPCOM);
sprintf (riga, "@%dg%s %s %s %s", POSCONTO,
(const char*)datana,
(const char*)comna,
sprintf_s(riga, sizeof(riga), "@%dg%s %s %s %s", POSCONTO,
(const char*)datana, (const char*)comna,
(const char*)provna, (const char*) capna);
set_row(r++, riga);

View File

@ -1975,12 +1975,7 @@ void TMastrini_grid::on_grid_button()
const long total = _mastrino.items();
if (total > 0)
{
TProgind* pi = NULL;
if (total > 50)
pi = new TProgind(total, TR("Aggiornamento contropartite ..."), false, true, 48);
else
begin_wait();
TProgress_monitor pi(total, TR("Aggiornamento contropartite ..."), false);
// Cerca l'ultima contropartita
const long last_con = _mastrino.last(riga_contropartita);
@ -1999,22 +1994,19 @@ void TMastrini_grid::on_grid_button()
{
if (_mastrino.expandable(n))
_mastrino.expand(n);
if (pi)
{
pi->setstatus(++step);
pi.set_status(++step);
#ifdef DBG
if ((step & 0x7F) == 0)
if ((step & 0x7F) == 0)
{
const double sec = (clock() - clock_start) / CLOCKS_PER_SEC;
if (sec > 0.0)
{
const double sec = (clock() - clock_start) / CLOCKS_PER_SEC;
if (sec > 0.0)
{
TString80 msg;
msg.format(FR("%ld records at %ld rec/sec"), step, long(step/sec));
pi->set_text(msg);
}
TString80 msg;
msg.format(FR("%ld records at %ld rec/sec"), step, long(step/sec));
pi.set_text(msg);
}
#endif
}
#endif
}
}
else
@ -2022,16 +2014,10 @@ void TMastrini_grid::on_grid_button()
for (long n = last_con; n > 0; n = _mastrino.pred(n, riga_contropartita))
{
_mastrino.collapse(n);
if (pi)
pi->setstatus(total - n + 1);
pi.set_status(total - n + 1);
}
}
if (pi)
delete pi;
else
end_wait();
update();
}
}

View File

@ -332,7 +332,7 @@ bool TLiquidazione_app::user_create()
TApplication::set_firm(ditta);
if (!look_lia())
{ end_wait(); return false; }
return false;
TIva_round ir; // Imposta arrotondamento iva
ir.set_default_iva_mode(atoi(_year), _month > 12, ditta);

View File

@ -1321,13 +1321,11 @@ int TStampa_registri_app::stampa_prospetto_IVA(int rr, int tipo_prosp)
}
}
if (_esiste_riga_iva && _stampa)
{
if (tipo_prosp == 2)
{
set_row(++rr, FR("@30g-------- S C I S S I O N E ---------"));
set_row(++rr, FR("@30g P A G A M E N T I"));
set_row(++rr, FR("@30g---- DI CUI SCISSIONE PAGAMENTI ----"));
}
else
{

View File

@ -71,10 +71,8 @@ bool LiqAcc_app::create()
_lia = new TTable("%LIA");
_lam = new TTable("LAM");
begin_wait();
build_nomiditte();
build_ditte_sheet();
end_wait();
dispatch_e_menu(BAR_ITEM_ID(1));

View File

@ -29,18 +29,11 @@ const char* Visliq_app::itoname(int m)
switch(m)
{
case 3:
mn = TR("1 Trimestre");
break;
case 6:
mn = TR("2 Trimestre");
break;
case 9:
mn = TR("3 Trimestre");
break;
case 12:
mn = TR("4 Trimestre");
break;
case 3: mn = TR("1 Trimestre"); break;
case 6: mn = TR("2 Trimestre"); break;
case 9: mn = TR("3 Trimestre"); break;
case 12: mn = TR("4 Trimestre"); break;
default: break;
}
return mn;
@ -85,10 +78,8 @@ bool Visliq_app::create()
_lam_anno = new TRecfield(*_lam_r,"CODTAB",0,3);
_lam_mese = new TRecfield(*_lam_r,"CODTAB",4,6);
begin_wait();
build_nomiditte();
build_ditte_sheet();
end_wait();
return TSkeleton_application::create();
}
@ -601,7 +592,6 @@ bool Visliq_app::vis_all()
bool Visliq_app::vis_one(int m)
{
begin_wait();
TMask msk("cg5500d");
bool recorded = true;
@ -636,7 +626,6 @@ bool Visliq_app::vis_one(int m)
TExternal_app liq("cg4 -2");
end_wait();
TProgind* pp = new TProgind(10,TR("Estrazione liquidazione: prego attendere"),false,false);
liq.run();
if (liq.exitcode())
@ -699,7 +688,6 @@ bool Visliq_app::vis_one(int m)
msk.set(F_IMPNONVER, impnonver);
msk.set(F_CREDSPEC, credspec);
begin_wait();
brw.set_text(f, TR("CALCOLO LIQUIDAZIONE D'IMPOSTA"));
brw.goto_pos(brw.lines()-16l, 9);
delete pp;
@ -724,8 +712,6 @@ bool Visliq_app::vis_one(int m)
msk.field(F_DELCAB).set(cab);
msk.field(F_DELCON).set(con);
end_wait();
bool l_mod = false;
bool d_mod = false;

View File

@ -131,16 +131,11 @@ bool TRipristino_liq::do_restore()
switch(k)
{
case K_ENTER:
begin_wait();
for(i = 0; i < _ditte->items(); i++)
for(i = 0; i < _ditte->items(); i++) if (_ditte->checked(i))
{
if (_ditte->checked(i))
{
TToken_string& rw = _ditte->row(i);
restore_firm(rw.get_long(1));
}
TToken_string& rw = _ditte->row(i);
restore_firm(rw.get_long(1));
}
end_wait();
break;
case DLG_SELECT:
_ditte->run();

View File

@ -1,6 +1,6 @@
#include "cg5800.h"
PAGE "Quadro VT" -1 -1 72 8
PAGE "Quadro VT" -1 -1 72 10
NUMBER F_YEAR 4
BEGIN

View File

@ -170,8 +170,9 @@ bool TProrata_rep::set_recordset(const TString& sql)
TProrata_rep::TProrata_rep()
{
if (!load("cg5900a"))
cantread_box("cg5900a.rep");
const char* name = "cg5900a.rep";
if (!load(name))
cantread_box(name);
}
///////////////////////////////////////////////////////////
@ -227,7 +228,7 @@ bool TProrata_msk::genera_mov(TFilename& ininame)
TProrata_rep rep;
rep.mask2report(*this);
TRecordset& recset = *rep.recordset();
TProgind pi(recset.items(), TR("Calcolo pro-rata"), false, true);
TProgress_monitor pi(recset.items(), TR("Calcolo pro-rata"), false);
TAssoc_array mconti;
TString80 key;
@ -236,7 +237,8 @@ bool TProrata_msk::genera_mov(TFilename& ininame)
for (bool good = recset.move_first(); good; good = recset.move_next())
{
pi.addstatus(1);
if (!pi.add_status())
break;
const real impdet = recset.get(RMI_IMPOSTA).as_real(); // Imposta detraibile
if (!impdet.is_zero())

View File

@ -1,7 +1,6 @@
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_CODATT 105
#define F_DESCATT 106
#define F_PRORATA 107

View File

@ -92,13 +92,10 @@
<field border="2" x="69" type="Linea" pattern="1" />
<field border="2" x="86" type="Linea" pattern="1" />
<field type="Numero" align="right" width="3" id="101" pattern="1">
<prescript description="F2.101 PRESCRIPT">MESSAGE COPY,F2.101</prescript>
</field>
<field x="4" type="Numero" align="right" width="3" id="102" pattern="1">
<prescript description="F2.102 PRESCRIPT">MESSAGE COPY,F2.102</prescript>
</field>
<field x="8" type="Numero" align="right" width="6" id="103" pattern="1">
<prescript description="F2.103 PRESCRIPT">MESSAGE COPY,F2.103</prescript>
</field>
<field x="16" type="Stringa" width="4" id="104" pattern="1" />
<field x="20" type="Numero" align="right" width="3" id="105" pattern="1" />

View File

@ -712,15 +712,17 @@ const TBill& TBill::get(TToken_string& s, int from, int mode)
{
_tipo = first ? char(toupper(*first)) : ' ';
first = s.get();
} else _tipo = ' ';
}
else
_tipo = ' ';
#ifdef DBG
if (strchr(" CF", _tipo) == NULL)
{
#ifdef DBG
error_box(FR("Tipo conto errato: '%c'"), _tipo);
#endif
_tipo = ' ';
}
#endif
_gruppo = first ? atoi(first) : 0;
_conto = s.get_int();
@ -1155,9 +1157,9 @@ bool TBill::is_analitico() const
return false;
}
const char* num2str(const TString & s)
const char* num2str(const TString& s)
{
TString & str = get_tmp_string(20);
TString& str = get_tmp_string(20);
str = s;
str.trim();
@ -1165,34 +1167,19 @@ const char* num2str(const TString & s)
{
str = s.left(2);
const int sub = atoi(s.mid(2, 2));
const TString4 sotsub(s.mid(4));
switch (sub)
{
case 0:
case 1:
break;
case 2:
str << " bis";
break;
case 3:
str << " ter";
break;
case 4:
str << " quater";
break;
case 5:
str << " quinquies";
break;
case 6:
str << " sexies";
break;
default:
break;
case 2: str << " bis"; break;
case 3: str << " ter";break;
case 4: str << " quater"; break;
case 5: str << " quinquies"; break;
case 6: str << " sexies"; break;
default: break;
}
const TString& sotsub = s.mid(4);
if (sotsub.full())
str << " " << sotsub;
str << ' ' << sotsub;
}
return (const char *) str;
return (const char*)str;
}

View File

@ -159,22 +159,23 @@ static bool mov_has_imposte(const TRectype& mov)
return tm == tm_fattura || tm == tm_nota_credito;
}
bool is_reverse_charge(const TRectype& mov)
{
const TRectype& rcs = cache().get(LF_CAUSALI, mov.get(MOV_CODCAUS));
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
return rsi == 13 || rsi == 50 || rsi == 51; // Reverse charge!
}
bool is_split_payment(const TRectype& mov)
{
bool yes = false;
if (mov.get_char(MOV_TIPO) != 'C')
return yes;
if (mov.get_int(MOV_ANNOIVA) >= 2015 && mov.get_real(MOV_RITFIS).is_zero() && mov_has_imposte(mov))
if (mov.get_char(MOV_TIPO) == 'C' && mov.get_int(MOV_ANNOIVA) >= 2015 &&
mov.get_real(MOV_RITFIS).is_zero() && mov_has_imposte(mov))
{
const TRectype& clifo = cache().get_rec(LF_CLIFO, "C", mov.get(MOV_CODCF));
if (clifo.get_bool(CLI_SPLITPAY)) // Ente pubblico con split payment
{
const TRectype& rcs = cache().get(LF_CAUSALI, mov.get(MOV_CODCAUS));
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
if (rsi != 13 && rsi != 50 && rsi != 51) // No reverse charge!
yes = true;
yes = !is_reverse_charge(mov);
if (yes && get_tipo_movimento(mov) == tm_nota_credito) // Controlla le N.C.
{
if (mov.get_bool(MOV_LIQDIFF))

View File

@ -160,6 +160,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);
bool gestione_IVAxCassa(const TDate& data, long firm = 0);
bool is_reverse_charge(const TRectype& mov);
bool is_split_payment(const TRectype& mov);
bool is_IVA_diff(const TRectype& mov);
bool is_IVAxCassa(const TRectype& mov);