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
if (i != iva_errata) return suspended_handler(f, key); // Controlla sospensione
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,7 +215,8 @@ 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);
void fill_sheet(TMask& m) const; void fill_sheet(TMask& m) const;

View File

@ -1,299 +1,305 @@
#include "cg2103.h" #include "cg2103.h"
#include <diction.h> #include <diction.h>
#include <recarray.h> #include <recarray.h>
#include <tabutil.h> #include <tabutil.h>
#include <causali.h> #include <causali.h>
#include <rcausali.h> #include <rcausali.h>
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Causale // Causale
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TCausale::TCausale(const char* cod, int year) TCausale::TCausale(const char* cod, int year)
: TArray(12), _rec(LF_CAUSALI), : TArray(12), _rec(LF_CAUSALI),
_iva(iva_errata), _corrisp(false), _iva(iva_errata), _corrisp(false),
_sezione_clifo(' '), _sezione_ritsoc(' '), _sezione_ritfis(' '), _sezione_clifo(' '), _sezione_ritsoc(' '), _sezione_ritfis(' '),
_provvisorio(' ') _provvisorio(' ')
{ {
if (cod && *cod) if (cod && *cod)
read(cod, year); read(cod, year);
} }
// Legge le righe della causale attualmente selezionata sulla maschera // Legge le righe della causale attualmente selezionata sulla maschera
bool TCausale::read(const char* cod, int year) bool TCausale::read(const char* cod, int year)
{ {
_rec.zero(); // Delete header _rec.zero(); // Delete header
destroy(); // Delete all rows destroy(); // Delete all rows
_iva = iva_errata; // Delete misc info _iva = iva_errata; // Delete misc info
_sezione_clifo = _sezione_ritsoc = _provvisorio = ' '; _sezione_clifo = _sezione_ritsoc = _provvisorio = ' ';
_corrisp = false; _corrisp = false;
if (cod && *cod > ' ') if (cod && *cod > ' ')
{ {
_rec = cache().get(LF_CAUSALI, cod); _rec = cache().get(LF_CAUSALI, cod);
if (_rec.empty()) if (_rec.empty())
return false; return false;
_provvisorio = _rec.get_char(CAU_PROVV); _provvisorio = _rec.get_char(CAU_PROVV);
TLocalisamfile rcaus(LF_RCAUSALI); TLocalisamfile rcaus(LF_RCAUSALI);
rcaus.put(CAU_CODCAUS, cod); rcaus.put(CAU_CODCAUS, cod);
rcaus.put(CAU_NRIGA, 0); rcaus.put(CAU_NRIGA, 0);
int err; int err;
for (err = rcaus.read(_isgteq); // Find first line for (err = rcaus.read(_isgteq); // Find first line
err == NOERR && rcaus.get(CAU_CODCAUS) == cod; err == NOERR && rcaus.get(CAU_CODCAUS) == cod;
err = rcaus.next()) // Read next line err = rcaus.next()) // Read next line
{ {
const int riga = rcaus.get_int(CAU_NRIGA); const int riga = rcaus.get_int(CAU_NRIGA);
add(rcaus.curr(), riga); add(rcaus.curr(), riga);
} }
const TString4 codreg(_rec.get(CAU_REG)); const TString4 codreg(_rec.get(CAU_REG));
const bool ok = _reg.read(codreg, year); // Read register const bool ok = _reg.read(codreg, year); // Read register
if (!ok && codreg.not_empty()) if (!ok && codreg.not_empty())
return error_box(FR("Non esiste il registro '%s' del %d"), return error_box(FR("Non esiste il registro '%s' del %d"),
(const char*)codreg, year); (const char*)codreg, year);
calcIVA(); calcIVA();
} }
else else
{ {
_iva = nessuna_iva; // Clear IVA data _iva = nessuna_iva; // Clear IVA data
_corrisp = false; _corrisp = false;
_reg.read("", year); _reg.read("", year);
} }
return true; return true;
} }
TBill& TCausale::bill(int num, TBill& conto) const TBill& TCausale::bill(int num, TBill& conto) const
{ {
const TRectype* rec = row(num); const TRectype* rec = row(num);
if (rec != NULL) if (rec != NULL)
conto.set(rec->get_int(RCA_GRUPPO), rec->get_int(RCA_CONTO), conto.set(rec->get_int(RCA_GRUPPO), rec->get_int(RCA_CONTO),
rec->get_long(RCA_SOTTOCONTO), rec->get_char(RCA_TIPOCF)); rec->get_long(RCA_SOTTOCONTO), rec->get_char(RCA_TIPOCF));
return conto; return conto;
} }
const char* TCausale::desc_agg(int num) const const char* TCausale::desc_agg(int num) const
{ {
const char* deag = ""; const char* deag = "";
const TRectype* rec = row(num); const TRectype* rec = row(num);
if (rec != NULL) if (rec != NULL)
{ {
const TString& cod = rec->get(RCA_CODDESC); const TString& cod = rec->get(RCA_CODDESC);
deag = cache().get("%DPN", cod, "S0"); deag = cache().get("%DPN", cod, "S0");
} }
return deag; return deag;
} }
const char* TCausale::descrizione() const const char* TCausale::descrizione() const
{ return _rec.get(CAU_DESCR); } { return _rec.get(CAU_DESCR); }
const char* TCausale::codice() const const char* TCausale::codice() const
{ return _rec.get(CAU_CODCAUS); } { return _rec.get(CAU_CODCAUS); }
bool TCausale::data_doc() const bool TCausale::data_doc() const
{ return _rec.get_bool(CAU_DATADOC); } { return _rec.get_bool(CAU_DATADOC); }
bool TCausale::num_doc() const bool TCausale::num_doc() const
{ return _rec.get_bool(CAU_NUMDOC); } { return _rec.get_bool(CAU_NUMDOC); }
bool TCausale::apertura() const bool TCausale::apertura() const
{ return _rec.get_char(CAU_MOVAP) == 'A'; } { return _rec.get_char(CAU_MOVAP) == 'A'; }
bool TCausale::chiusura() const bool TCausale::chiusura() const
{ return _rec.get_char(CAU_MOVAP) == 'C'; } { return _rec.get_char(CAU_MOVAP) == 'C'; }
bool TCausale::sezionale() const bool TCausale::sezionale() const
{ return _rec.get_bool(CAU_MOVSEZ); } { return _rec.get_bool(CAU_MOVSEZ); }
bool TCausale::valuta() const bool TCausale::valuta() const
{ return _rec.get_bool(CAU_MOVVAL); } { return _rec.get_bool(CAU_MOVVAL); }
bool TCausale::intra() const bool TCausale::intra() const
{ return _rec.get_bool(CAU_INTRACOM); } { return _rec.get_bool(CAU_INTRACOM); }
bool TCausale::valintra() const bool TCausale::valintra() const
{ return _rec.get_bool(CAU_VALINTRA); } { return _rec.get_bool(CAU_VALINTRA); }
bool TCausale::soloiva() const bool TCausale::soloiva() const
{ return _rec.get_bool(CAU_SOLOIVA); } { return _rec.get_bool(CAU_SOLOIVA); }
int TCausale::regime_speciale() const int TCausale::regime_speciale() const
{ return _rec.get_int(CAU_REGSPIVA); } { return _rec.get_int(CAU_REGSPIVA); }
bool TCausale::esclusione_allegati() const bool TCausale::reverse_charge() const
{ return _rec.get_bool(CAU_ALLEG); } {
const int rsi = regime_speciale();
const TString& TCausale::causale_collegata() const return rsi == 13 || rsi == 50 || rsi == 51; // Reverse charge!
{ return _rec.get(CAU_CODCAUSIM); } }
const TString& TCausale::causale_reg_iva() const bool TCausale::esclusione_allegati() const
{ return _rec.get(CAU_CODCAUREG); } { return _rec.get_bool(CAU_ALLEG); }
const TString& TCausale::tipo_doc() const const TString& TCausale::causale_collegata() const
{ return _rec.get(CAU_TIPODOC); } { return _rec.get(CAU_CODCAUSIM); }
tipo_movimento TCausale::tipomov() const const TString& TCausale::causale_reg_iva() const
{ return tipo_movimento(_rec.get_int(CAU_TIPOMOV)); } { return _rec.get(CAU_CODCAUREG); }
const TString& TCausale::tipodoc() const const TString& TCausale::tipo_doc() const
{ return _rec.get(CAU_TIPODOC); } { return _rec.get(CAU_TIPODOC); }
bool TCausale::saldaconto(const TDate& datareg) const tipo_movimento TCausale::tipomov() const
{ { return tipo_movimento(_rec.get_int(CAU_TIPOMOV)); }
bool yes = tipomov() > 0;
if (yes && datareg.ok()) const TString& TCausale::tipodoc() const
{ { return _rec.get(CAU_TIPODOC); }
static TDate _data_sal = ini_get_string(CONFIG_DITTA, "cg", "DatSal");
yes = datareg >= _data_sal; bool TCausale::saldaconto(const TDate& datareg) const
} {
return yes; bool yes = tipomov() > 0;
} if (yes && datareg.ok())
{
int TCausale::link_m770() const static TDate _data_sal = ini_get_string(CONFIG_DITTA, "cg", "DatSal");
{ return _rec.get_int(CAU_M770); } yes = datareg >= _data_sal;
}
char TCausale::link_cespiti() const return yes;
{ return _rec.get_char(CAU_COLLCESP); } }
bool TCausale::link_analitica() const int TCausale::link_m770() const
{ return _rec.get_bool(CAU_MOVIND); } { return _rec.get_int(CAU_M770); }
bool TCausale::link_industriale() const char TCausale::link_cespiti() const
{ return _rec.exist(CAU_MOVCGIND) && _rec.get_bool(CAU_MOVCGIND); } { return _rec.get_char(CAU_COLLCESP); }
bool TCausale::ok() const bool TCausale::link_analitica() const
{ return iva() != iva_errata; } { return _rec.get_bool(CAU_MOVIND); }
char TCausale::sezione(int riga) const bool TCausale::link_industriale() const
{ { return _rec.exist(CAU_MOVCGIND) && _rec.get_bool(CAU_MOVCGIND); }
const TRectype* rec = row(riga);
char sez = rec ? toupper(rec->get_char(RCA_SEZIONE)) : ' '; bool TCausale::ok() const
if (sez <= ' ') // Guess section on tipocf { return iva() != iva_errata; }
{
const TRectype* uno = row(1); char TCausale::sezione(int riga) const
char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' '; {
if (tipocf <= ' ') const TRectype* rec = row(riga);
tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA char sez = rec ? toupper(rec->get_char(RCA_SEZIONE)) : ' ';
sez = (tipocf == 'C') ? 'D' : 'A'; if (sez <= ' ') // Guess section on tipocf
} {
return sez; const TRectype* uno = row(1);
} char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' ';
if (tipocf <= ' ')
char TCausale::sezione_clifo() const tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA
{ sez = (tipocf == 'C') ? 'D' : 'A';
if (_sezione_clifo <= ' ') }
(char&)_sezione_clifo = sezione(1); return sez;
return _sezione_clifo; }
}
char TCausale::sezione_clifo() const
char TCausale::sezione_ritsoc() const {
{ if (_sezione_clifo <= ' ')
if (_sezione_ritsoc <= ' ') (char&)_sezione_clifo = sezione(1);
{ return _sezione_clifo;
// Fatture o Pagamenti? }
const int tm = _rec.get_int(CAU_TIPOMOV);
(char&)_sezione_ritsoc = sezione(tm <= 2 ? 9 : 14); char TCausale::sezione_ritsoc() const
} {
return _sezione_ritsoc; if (_sezione_ritsoc <= ' ')
} {
// Fatture o Pagamenti?
char TCausale::sezione_ritfis() const int tm = _rec.get_int(CAU_TIPOMOV);
(char&)_sezione_ritsoc = sezione(tm <= 2 ? 9 : 14);
{ }
if (_sezione_ritfis == ' ') return _sezione_ritsoc;
{ }
if (_rec.get_int(CAU_TIPOMOV) <= 2)
_sezione_ritfis = sezione(8); // Fatture char TCausale::sezione_ritfis()
else
_sezione_ritfis = sezione(12); // Pagamenti {
} if (_sezione_ritfis == ' ')
return _sezione_ritfis; {
} if (_rec.get_int(CAU_TIPOMOV) <= 2)
_sezione_ritfis = sezione(8); // Fatture
void TCausale::calcIVA() else
{ _sezione_ritfis = sezione(12); // Pagamenti
TipoIVA i = nessuna_iva; // Tipo IVA di default }
bool c = false; // Corrispettivi di default return _sezione_ritfis;
}
const TString& td = tipo_doc();
if (td.full()) void TCausale::calcIVA()
{ {
const TRectype& tpd = cache().get("%TPD", td); TipoIVA i = nessuna_iva; // Tipo IVA di default
if (!tpd.empty()) bool c = false; // Corrispettivi di default
{
i = (TipoIVA)tpd.get_int("I0"); // IVA acquisti, vendite, generica const TString& td = tipo_doc();
const TipoIVA ri = _reg.iva(); if (td.full())
if (i == iva_generica) {
i = ri; const TRectype& tpd = cache().get("%TPD", td);
if (i != ri) if (!tpd.empty())
{ {
error_box(FR("Tipo documento '%s' incompatibile con tipo registro"), (const char*)td); i = (TipoIVA)tpd.get_int("I0"); // IVA acquisti, vendite, generica
i = iva_errata; const TipoIVA ri = _reg.iva();
} if (i == iva_generica)
c = tpd.get_bool("B0"); // B0 flag corrispettivi i = ri;
} if (i != ri)
else {
error_box(FR("Tipo documento sconosciuto: '%s'"), (const char*)td); error_box(FR("Tipo documento '%s' incompatibile con tipo registro"), (const char*)td);
} i = iva_errata;
_iva = i; }
_corrisp = c; c = tpd.get_bool("B0"); // B0 flag corrispettivi
} }
else
const TString& TCausale::compatible(const TCausale& c) const error_box(FR("Tipo documento sconosciuto: '%s'"), (const char*)td);
{ }
const char* err = NULL; _iva = i;
if (sezionale() != c.sezionale()) _corrisp = c;
err = TR("il segnale di sezionale"); }
if (intra() != c.intra())
err = TR("la gestione dei movimenti intra"); const TString& TCausale::compatible(const TCausale& c) const
if (valuta() != c.valuta()) {
err = TR("la gestione valuta"); const char* err = NULL;
if (valintra() != c.valintra()) if (sezionale() != c.sezionale())
err = TR("la gestione valuta intracomunitaria"); err = TR("il segnale di sezionale");
if (corrispettivi() != c.corrispettivi()) if (intra() != c.intra())
err = TR("la gestione dei corrispettivi"); err = TR("la gestione dei movimenti intra");
if (iva() != c.iva()) if (valuta() != c.valuta())
err = TR("il tipo di IVA"); err = TR("la gestione valuta");
if (tipomov() != c.tipomov()) if (valintra() != c.valintra())
err = TR("il tipo di movimento"); err = TR("la gestione valuta intracomunitaria");
if (corrispettivi() != c.corrispettivi())
if (err != NULL) err = TR("la gestione dei corrispettivi");
{ if (iva() != c.iva())
TString& msg = get_tmp_string(); err = TR("il tipo di IVA");
msg.format(FR("La causale e' incompatibile per %s"), err); if (tipomov() != c.tipomov())
return msg; err = TR("il tipo di movimento");
}
if (err != NULL)
return EMPTY_STRING; {
} TString& msg = get_tmp_string();
msg.format(FR("La causale e' incompatibile per %s"), err);
bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const return msg;
{ }
const TString& tipo = iva.tipo();
return EMPTY_STRING;
if (tipo.not_empty()) }
{
if (tipo == "ES") bill(5, c); else bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
if (tipo == "NI") bill(6, c); else {
if (tipo == "NS") bill(7, c); const TString& tipo = iva.tipo();
}
if (tipo.not_empty())
if (!c.ok()) {
bill(2, c); if (tipo == "ES") bill(5, c); else
if (tipo == "NI") bill(6, c); else
const int spric = c.tipo_cr(); if (tipo == "NS") bill(7, c);
if (spric == 2 || spric == 3) }
{
const TString& td = tipo_doc(); if (!c.ok())
if (td == "FV" || td == "NC") bill(2, c);
c.tipo_cr(4);
} const int spric = c.tipo_cr();
if (spric == 2 || spric == 3)
return c.ok(); {
} const TString& td = tipo_doc();
if (td == "FV" || td == "NC")
c.tipo_cr(4);
}
return c.ok();
}

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,13 +1975,8 @@ 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);
// Se non esistono contropartite devo espandere le righe // Se non esistono contropartite devo espandere le righe
@ -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);