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 "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10] DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Progr." CODTAB[11,12] DISPLAY "Progr." CODTAB[11,12]
DISPLAY "IBAN@25" S3 DISPLAY "IBAN@27" S3
DISPLAY "Denominazione@50" 100@->S0 DISPLAY "Denominazione@50" 100@->S0
OUTPUT F_BBAN_ABI CODTAB[1,5] OUTPUT F_BBAN_ABI CODTAB[1,5]
OUTPUT F_BBAN_CAB CODTAB[6,10] OUTPUT F_BBAN_CAB CODTAB[6,10]

View File

@ -119,45 +119,46 @@ int TStampa_deleghe_IVA::select()
TToken_string d(80); TToken_string d(80);
_ditte->destroy(); _ditte->destroy();
begin_wait();
for (_nditte->first(); _nditte->good(); _nditte->next())
{ {
TLocalisamfile& anag = _nditte->lfile(LF_ANAG); TWait_cursor hourglass;
TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale const TRectype& anag = _nditte->curr(LF_ANAG);
const TRectype& com = _nditte->curr(LF_COMUNI); // Comune residenza fiscale
const TString16 con = com.get("UFFCONC"); for (_nditte->first(); _nditte->good(); _nditte->next())
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
{ {
const long abi = deleghe.get_long("S7"); const TString16 con = com.get("UFFCONC");
const long cab = deleghe.get_long("S8"); if (_concessione.full() && _concessione != con)
if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab)) 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 const long abi = deleghe.get_long("S7");
d.add(dit); // Codice ditta const long cab = deleghe.get_long("S8");
d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab))
d.add(deleghe.get_real("R0").string(".")); // Importo {
d.add(deleghe.get_real("R1").string(".")); // Interesse d = " "; // Selezione
d.add(abi ? format("%05ld", abi) : ""); // Azienda d.add(dit); // Codice ditta
d.add(cab ? format("%05ld", cab) : ""); // Dipendenza d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome
d.add(con); // Concessione d.add(deleghe.get_real("R0").string(".")); // Importo
d.add(cf ? "X" : " "); // Conto fiscale d.add(deleghe.get_real("R1").string(".")); // Interesse
_ditte->add(d); 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; int res = 1;
if (_ditte->items() > 0) 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")) if (!fexist("in0.exe"))
return false; return false;
const bool bModify = xvt_str_compare_ignoring_case(action, "Modify") == 0; const BOOLEAN bModify = xvt_str_same(action, "Modify");
TFilename intrini; TFilename intrini;
intrini.tempdir(); intrini.tempdir();
@ -2306,7 +2306,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
} }
// Inserisci il totale documento solo in inserimento! // 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); real totdoc = m.get_real(valintra ? F_CORRISPETTIVO : F_IMPONIBILI);
if (test_swap(false)) 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 'R': // Ritenute professionali
case 'S': // Ritenute Sociali case 'S': // Ritenute Sociali
case 'V': // Reverse charge 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; last = 3;
break; break;
case 'K': // Riga cliente/fornitore per saldaconto case 'K': // Riga cliente/fornitore per saldaconto
if (curr_mask().is_running() && n == cg.items()-1) // Sono in inserimento di una riga nuova if (curr_mask().is_running() && n == cg.items()-1) // Sono in inserimento di una riga nuova
break; break;
first = 2; first = 2;
case 'I': case 'I': // Imponibile o contropartita saldaconto
last = 7; // Imponibile o contropartita saldaconto case '1': // Cliente per scissione pagamenti art, 17-ter DPR 633/72
last = 7;
break; break;
default: default:
last = 0; // Solo contabile last = 0; // Solo contabile
@ -387,7 +388,8 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
} }
else else
{ {
const int pos = type2pos('T'); const char contro_type = tipo == '2' ? 'D' : 'T';
const int pos = type2pos(contro_type);
if (pos >= 0) if (pos >= 0)
{ {
TBill contro(cg.row(pos), 2, 0x3); 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) 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. // 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& r1 = (const TToken_string&)o1;
const TToken_string& r2 = (const TToken_string&)o2; const TToken_string& r2 = (const TToken_string&)o2;
const TPrimanota_application& a = *(TPrimanota_application*)jolly; const TPrimanota_application& a = *(TPrimanota_application*)jolly;
const char c1 = a.row_type(*r1); const char c1 = a.row_type(r1);
const char c2 = a.row_type(*r2); const char c2 = a.row_type(r2);
return int(strchr(sort_order, c1) - strchr(sort_order, c2)); 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()); TImporto residuo(imptot); residuo -= cassa; residuo.normalize(imptot.sezione());
bool ok = true; bool ok = true;
// if (!residuo.is_zero()) if (abs(residuo.valore()) >= 0.001) // if (!residuo.is_zero())
if (abs(residuo.valore()) >= 0.001)
{ {
TPrimanota_application& a = app(); TPrimanota_application& a = app();
const TMask& m = a.curr_mask(); 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) // Controllo split-payment (dalla versione 12)
if (m.get_int(F_ANNOIVA) >= 2015 && a.clifo() == 'C' && a.get_version() >= 12) if (m.get_int(F_ANNOIVA) >= 2015 && a.clifo() == 'C' && a.get_version() >= 12)
{ {
const int r_norm = type2pos('D'); const int r_norm = type2pos('D');
const int r_split = type2pos('1');
const bool split_needed = r_norm >= 0 && a.is_split_payment(); const bool split_needed = r_norm >= 0 && a.is_split_payment();
if (split_needed) if (split_needed)
{ {
TImporto imp_split = a.get_cgs_imp(r_norm); imp_split.swap_section(); TImporto imp_split = a.get_cgs_imp(r_norm);
if (r_split < 0) 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); TToken_string row_norm = a.cgs().row(r_norm);
TBill iva_split(row_norm, 3); TBill iva_split(row_norm, 3);
const char* desc = TR("IVA art. 17-ter D.P.R. 633/1972)"); const char* desc = TR("IVA art.17-ter D.P.R. 633/1972");
a.set_cgs_row(-1, imp_split, iva_split, desc, '1'); a.set_cgs_row(-1, imp_split, iva_split, desc, '2');
} }
else else
a.set_cgs_imp(r_split, imp_split); a.set_cgs_imp(r_split2, imp_split);
} }
else else
{ {
if (r_split >= 0) const int r_split2 = type2pos('2');
a.reset_cgs_row(r_split); 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) if (pimposta != imposta || pimponibile != imponibile)
a.set_scadenze(m); // Ricalcola rate a.set_scadenze(m); // Ricalcola rate
} }
} }
return true; return true;
} }
@ -2187,24 +2204,23 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
// Certified 99% // Certified 99%
bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key) bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
{ {
const TMask& m = f.mask(); if (key == K_TAB || key == K_ENTER)
if (!m.is_running())
return true;
if (f.to_check(key))
{ {
const TMask& m = f.mask();
const TString& cau = f.get(); const TString& cau = f.get();
const int ann = m.get_int(F_ANNOIVA); 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); 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()->set_filter(filter);
numreg.browse()->cursor()->setfilter(filter, true);
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo return suspended_handler(f, key); // Controlla sospensione
if (i != iva_errata)
return suspended_handler(f, key); // Controlla sospensione
else
return error_box(TR("Causale non presente in archivio"));
} }
return true; return true;
@ -2728,13 +2744,6 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
else else
{ {
// Creazione/Aggiornamento riga totale // 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; TString80 descr;
if (riga_totale >= 0) if (riga_totale >= 0)
{ {
@ -2743,9 +2752,8 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
} }
if (descr.blank()) if (descr.blank())
descr = m.get(F_DESCR); descr = m.get(F_DESCR);
TImporto imp = real2imp(tot, 'T'); TImporto imp = real2imp(m.get_real(F_TOTALE), 'T');
imp.normalize(); set_cgs_row(riga_totale, imp.normalize(), nuovo, descr, 'T');
set_cgs_row(riga_totale, imp, nuovo, descr, 'T');
} }
calcola_imp(); // Ricalcola totale IVA 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% // Certified 99%
bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key) 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(); TPrimanota_application& a = app();
const real imp(a.ivas().row(1).get(0)); 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()) if (iva.is_zero())
{ {
TCodiceIVA codiva(f.get()); TMask& mm = f.mask(); // Main mask
const real totale = f.mask().get_real(F_TOTALE); const TCodiceIVA codiva(f.get());
const real totale = mm.get_real(F_TOTALE);
const real imposta = codiva.imposta(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 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; bool yes = false;
const TMask& m = curr_mask(); 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)); const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CLIENTE));
if (cliente.get_bool(CLI_SPLITPAY)) if (cliente.get_bool(CLI_SPLITPAY))
@ -3045,6 +3055,12 @@ bool TPrimanota_application::is_split_payment() const
return yes; return yes;
} }
bool TPrimanota_application::is_fattura_split() const
{
return is_fattura() && is_split_payment();
}
// 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)
@ -3056,7 +3072,7 @@ bool TPrimanota_application::liqdiff_handler(TMask_field& f, KEY key)
{ {
if (f.mask().get_bool(F_IVAXCASSA)) if (f.mask().get_bool(F_IVAXCASSA))
return f.error_box(TR("Non è ammessa IVA per cassa a liquidazione differita")); 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")); 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 (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")); 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 // Se la data INTRA e' vuota allora copiala dalla data di competenza normale
if (key == K_ENTER && f.empty()) if (key == K_ENTER && f.empty())
{
f.set(f.mask().get(F_DATAREG)); f.set(f.mask().get(F_DATAREG));
}
return true; return true;
} }

View File

@ -215,6 +215,7 @@ protected:
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 is_split_payment() const;
bool is_fattura_split() const;
bool activate_numrif(TMask& m, bool set_pag); bool activate_numrif(TMask& m, bool set_pag);

View File

@ -126,6 +126,12 @@ bool TCausale::soloiva() const
int TCausale::regime_speciale() const int TCausale::regime_speciale() const
{ return _rec.get_int(CAU_REGSPIVA); } { 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 bool TCausale::esclusione_allegati() const
{ return _rec.get_bool(CAU_ALLEG); } { return _rec.get_bool(CAU_ALLEG); }

View File

@ -38,6 +38,7 @@ public:
bool intra() const; bool intra() const;
bool valintra() const; bool valintra() const;
bool soloiva() const; bool soloiva() const;
bool reverse_charge() const;
char provvisorio() const { return _provvisorio; } char provvisorio() const { return _provvisorio; }
const TString& causale_collegata() const; const TString& causale_collegata() const;
const TString& causale_reg_iva() 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 in_valuta = ::is_true_value(m.get(SK_VALUTA));
const bool is_split = !in_valuta && clifo.tipo() == 'C' && anno >= 2015 && is_split_payment(); 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) 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 TString& codval = m.get(SK_VALUTA);
const TCurrency totdoc_c(totale, codval); const TCurrency totdoc_c(totale_cg, codval);
const TCurrency totdoc_s(partita.importo(in_valuta).valore(), codval); const TCurrency totdoc_s(totale_sc, codval);
const TString i1 = totdoc_c.string(true); const char* i1 = totdoc_c.string(true);
const TString i2 = totdoc_s.string(true); const char* i2 = totdoc_s.string(true);
warning_box(FR("Il totale documento (%s) non corrisponde a quello del saldaconto (%s)."), warning_box(FR("Il totale documento (%s) non corrisponde a quello del saldaconto (%s)."), i1, i2);
(const char*)i1, (const char*)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); const real imposte_sc = partita.get_real(PART_IMPOSTA);
if (imposte_cg != imposte_sc) if (imposte_cg != imposte_sc)
{ {

View File

@ -44,7 +44,7 @@ END
BOOLEAN F_RECALC BOOLEAN F_RECALC
BEGIN BEGIN
PROMPT 53 5 "Ricalcolo automatico" 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 MESSAGE FALSE DISABLE,F_RDIFFER|DISABLE,F_MCOMM
END END

View File

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

View File

@ -156,7 +156,7 @@ BOOLEAN 113
BEGIN BEGIN
PROMPT 12 11 "Bloccata" PROMPT 12 11 "Bloccata"
MESSAGE FALSE CLEAR,114 MESSAGE FALSE CLEAR,114
MESSAGE true ENABLE,114 MESSAGE TRUE ENABLE,114
END END
STRING 114 6 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 td; real2currency(td, _tot_dare_gg);
TString80 ta; real2currency(ta, _tot_avere_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, _stampa_width == 132 ? SCRITTA : DARE198-STACC,
data.string(), data.string(),
_stampa_width == 132 ? TOTDARE132 : DARE198-2, _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 tdp; real2currency(tdp, _tot_dare_gg_ap);
TString80 tap; real2currency(tap, _tot_avere_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, _stampa_width == 132 ? SCRITTA : DARE198-STACC,
data.string(), data.string(),
_stampa_width == 132 ? TOTDARE132 : DARE198-2, _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()) if (viacf.not_empty())
{ {
sprintf (riga, "@%dg%s %s", sprintf_s(riga, sizeof(riga), "@%dg%s %s",
POSCONTO, POSCONTO, (const char*)viacf, (const char*)civcf);
(const char*) viacf,
(const char*) civcf
);
set_row (r++, riga); set_row (r++, riga);
} }
if (comune.not_empty() || prov.not_empty() || capcf.not_empty()) 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, POSCONTO,
(const char*) capcf, (const char*) comune, (const char*) capcf, (const char*) comune,
(const char*) prov (const char*) prov
@ -1391,7 +1388,8 @@ int TStampa_giornale::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
if (tipoa == 'F') if (tipoa == 'F')
{ {
TString80 comna; TString80 comna;
TString16 datana, codcomna, provna, capna, statona; TString16 datana, codcomna;
TString8 provna, capna, statona;
datana = clifo.get("DATANASC"); 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); provna = dep.get(COM_PROVCOM);
capna = dep.get(COM_CAPCOM); capna = dep.get(COM_CAPCOM);
sprintf (riga, "@%dg%s %s %s %s", POSCONTO, sprintf_s(riga, sizeof(riga), "@%dg%s %s %s %s", POSCONTO,
(const char*)datana, (const char*)datana, (const char*)comna,
(const char*)comna,
(const char*)provna, (const char*) capna); (const char*)provna, (const char*) capna);
set_row(r++, riga); set_row(r++, riga);

View File

@ -1975,12 +1975,7 @@ void TMastrini_grid::on_grid_button()
const long total = _mastrino.items(); const long total = _mastrino.items();
if (total > 0) if (total > 0)
{ {
TProgind* pi = NULL; TProgress_monitor pi(total, TR("Aggiornamento contropartite ..."), false);
if (total > 50)
pi = new TProgind(total, TR("Aggiornamento contropartite ..."), false, true, 48);
else
begin_wait();
// Cerca l'ultima contropartita // Cerca l'ultima contropartita
const long last_con = _mastrino.last(riga_contropartita); const long last_con = _mastrino.last(riga_contropartita);
@ -1999,22 +1994,19 @@ void TMastrini_grid::on_grid_button()
{ {
if (_mastrino.expandable(n)) if (_mastrino.expandable(n))
_mastrino.expand(n); _mastrino.expand(n);
if (pi) pi.set_status(++step);
{
pi->setstatus(++step);
#ifdef DBG #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; TString80 msg;
if (sec > 0.0) 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 else
@ -2022,16 +2014,10 @@ void TMastrini_grid::on_grid_button()
for (long n = last_con; n > 0; n = _mastrino.pred(n, riga_contropartita)) for (long n = last_con; n > 0; n = _mastrino.pred(n, riga_contropartita))
{ {
_mastrino.collapse(n); _mastrino.collapse(n);
if (pi) pi.set_status(total - n + 1);
pi->setstatus(total - n + 1);
} }
} }
if (pi)
delete pi;
else
end_wait();
update(); update();
} }
} }

View File

@ -332,7 +332,7 @@ bool TLiquidazione_app::user_create()
TApplication::set_firm(ditta); TApplication::set_firm(ditta);
if (!look_lia()) if (!look_lia())
{ end_wait(); return false; } return false;
TIva_round ir; // Imposta arrotondamento iva TIva_round ir; // Imposta arrotondamento iva
ir.set_default_iva_mode(atoi(_year), _month > 12, ditta); 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 (_esiste_riga_iva && _stampa)
{ {
if (tipo_prosp == 2) if (tipo_prosp == 2)
{ {
set_row(++rr, FR("@30g-------- S C I S S I O N E ---------")); set_row(++rr, FR("@30g---- DI CUI SCISSIONE PAGAMENTI ----"));
set_row(++rr, FR("@30g P A G A M E N T I"));
} }
else else
{ {

View File

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

View File

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

View File

@ -131,16 +131,11 @@ bool TRipristino_liq::do_restore()
switch(k) switch(k)
{ {
case K_ENTER: case K_ENTER:
begin_wait(); for(i = 0; i < _ditte->items(); i++) if (_ditte->checked(i))
for(i = 0; i < _ditte->items(); 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; break;
case DLG_SELECT: case DLG_SELECT:
_ditte->run(); _ditte->run();

View File

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

View File

@ -170,8 +170,9 @@ bool TProrata_rep::set_recordset(const TString& sql)
TProrata_rep::TProrata_rep() TProrata_rep::TProrata_rep()
{ {
if (!load("cg5900a")) const char* name = "cg5900a.rep";
cantread_box("cg5900a.rep"); if (!load(name))
cantread_box(name);
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -227,7 +228,7 @@ bool TProrata_msk::genera_mov(TFilename& ininame)
TProrata_rep rep; TProrata_rep rep;
rep.mask2report(*this); rep.mask2report(*this);
TRecordset& recset = *rep.recordset(); 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; TAssoc_array mconti;
TString80 key; TString80 key;
@ -236,7 +237,8 @@ bool TProrata_msk::genera_mov(TFilename& ininame)
for (bool good = recset.move_first(); good; good = recset.move_next()) 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 const real impdet = recset.get(RMI_IMPOSTA).as_real(); // Imposta detraibile
if (!impdet.is_zero()) if (!impdet.is_zero())

View File

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

View File

@ -92,13 +92,10 @@
<field border="2" x="69" type="Linea" pattern="1" /> <field border="2" x="69" type="Linea" pattern="1" />
<field border="2" x="86" type="Linea" pattern="1" /> <field border="2" x="86" type="Linea" pattern="1" />
<field type="Numero" align="right" width="3" id="101" 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>
<field x="4" type="Numero" align="right" width="3" id="102" pattern="1"> <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>
<field x="8" type="Numero" align="right" width="6" id="103" pattern="1"> <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>
<field x="16" type="Stringa" width="4" id="104" pattern="1" /> <field x="16" type="Stringa" width="4" id="104" pattern="1" />
<field x="20" type="Numero" align="right" width="3" id="105" 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)) : ' '; _tipo = first ? char(toupper(*first)) : ' ';
first = s.get(); first = s.get();
} else _tipo = ' '; }
else
_tipo = ' ';
#ifdef DBG
if (strchr(" CF", _tipo) == NULL) if (strchr(" CF", _tipo) == NULL)
{ {
#ifdef DBG
error_box(FR("Tipo conto errato: '%c'"), _tipo); error_box(FR("Tipo conto errato: '%c'"), _tipo);
#endif
_tipo = ' '; _tipo = ' ';
} }
#endif
_gruppo = first ? atoi(first) : 0; _gruppo = first ? atoi(first) : 0;
_conto = s.get_int(); _conto = s.get_int();
@ -1155,9 +1157,9 @@ bool TBill::is_analitico() const
return false; 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 = s;
str.trim(); str.trim();
@ -1165,34 +1167,19 @@ const char* num2str(const TString & s)
{ {
str = s.left(2); str = s.left(2);
const int sub = atoi(s.mid(2, 2)); const int sub = atoi(s.mid(2, 2));
const TString4 sotsub(s.mid(4));
switch (sub) switch (sub)
{ {
case 0: case 2: str << " bis"; break;
case 1: case 3: str << " ter";break;
break; case 4: str << " quater"; break;
case 2: case 5: str << " quinquies"; break;
str << " bis"; case 6: str << " sexies"; break;
break; default: 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()) 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; 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 is_split_payment(const TRectype& mov)
{ {
bool yes = false; bool yes = false;
if (mov.get_char(MOV_TIPO) != 'C') if (mov.get_char(MOV_TIPO) == 'C' && mov.get_int(MOV_ANNOIVA) >= 2015 &&
return yes; mov.get_real(MOV_RITFIS).is_zero() && mov_has_imposte(mov))
if (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)); 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 (clifo.get_bool(CLI_SPLITPAY)) // Ente pubblico con split payment
{ {
const TRectype& rcs = cache().get(LF_CAUSALI, mov.get(MOV_CODCAUS)); yes = !is_reverse_charge(mov);
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
if (rsi != 13 && rsi != 50 && rsi != 51) // No reverse charge!
yes = true;
if (yes && get_tipo_movimento(mov) == tm_nota_credito) // Controlla le N.C. if (yes && get_tipo_movimento(mov) == tm_nota_credito) // Controlla le N.C.
{ {
if (mov.get_bool(MOV_LIQDIFF)) 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); 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_reverse_charge(const TRectype& mov);
bool is_split_payment(const TRectype& mov); bool is_split_payment(const TRectype& mov);
bool is_IVA_diff(const TRectype& mov); bool is_IVA_diff(const TRectype& mov);
bool is_IVAxCassa(const TRectype& mov); bool is_IVAxCassa(const TRectype& mov);