git-svn-id: svn://10.65.10.50/branches/R_10_00@23111 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9c648a2557
commit
79e92e731f
@ -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]
|
||||
|
@ -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)
|
||||
|
@ -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))
|
||||
|
118
cg/cg2102.cpp
118
cg/cg2102.cpp
@ -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);
|
||||
|
||||
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"));
|
||||
numreg.browse()->cursor()->setfilter(filter, true);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,8 @@ 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);
|
||||
|
||||
void fill_sheet(TMask& m) const;
|
||||
|
604
cg/cg2103.cpp
604
cg/cg2103.cpp
@ -1,299 +1,305 @@
|
||||
#include "cg2103.h"
|
||||
|
||||
#include <diction.h>
|
||||
#include <recarray.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <causali.h>
|
||||
#include <rcausali.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Causale
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TCausale::TCausale(const char* cod, int year)
|
||||
: TArray(12), _rec(LF_CAUSALI),
|
||||
_iva(iva_errata), _corrisp(false),
|
||||
_sezione_clifo(' '), _sezione_ritsoc(' '), _sezione_ritfis(' '),
|
||||
_provvisorio(' ')
|
||||
{
|
||||
if (cod && *cod)
|
||||
read(cod, year);
|
||||
}
|
||||
|
||||
// Legge le righe della causale attualmente selezionata sulla maschera
|
||||
bool TCausale::read(const char* cod, int year)
|
||||
{
|
||||
_rec.zero(); // Delete header
|
||||
destroy(); // Delete all rows
|
||||
_iva = iva_errata; // Delete misc info
|
||||
_sezione_clifo = _sezione_ritsoc = _provvisorio = ' ';
|
||||
_corrisp = false;
|
||||
|
||||
if (cod && *cod > ' ')
|
||||
{
|
||||
_rec = cache().get(LF_CAUSALI, cod);
|
||||
if (_rec.empty())
|
||||
return false;
|
||||
|
||||
_provvisorio = _rec.get_char(CAU_PROVV);
|
||||
TLocalisamfile rcaus(LF_RCAUSALI);
|
||||
rcaus.put(CAU_CODCAUS, cod);
|
||||
rcaus.put(CAU_NRIGA, 0);
|
||||
|
||||
int err;
|
||||
for (err = rcaus.read(_isgteq); // Find first line
|
||||
err == NOERR && rcaus.get(CAU_CODCAUS) == cod;
|
||||
err = rcaus.next()) // Read next line
|
||||
{
|
||||
const int riga = rcaus.get_int(CAU_NRIGA);
|
||||
add(rcaus.curr(), riga);
|
||||
}
|
||||
|
||||
const TString4 codreg(_rec.get(CAU_REG));
|
||||
const bool ok = _reg.read(codreg, year); // Read register
|
||||
if (!ok && codreg.not_empty())
|
||||
return error_box(FR("Non esiste il registro '%s' del %d"),
|
||||
(const char*)codreg, year);
|
||||
calcIVA();
|
||||
}
|
||||
else
|
||||
{
|
||||
_iva = nessuna_iva; // Clear IVA data
|
||||
_corrisp = false;
|
||||
_reg.read("", year);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TBill& TCausale::bill(int num, TBill& conto) const
|
||||
{
|
||||
const TRectype* rec = row(num);
|
||||
if (rec != NULL)
|
||||
conto.set(rec->get_int(RCA_GRUPPO), rec->get_int(RCA_CONTO),
|
||||
rec->get_long(RCA_SOTTOCONTO), rec->get_char(RCA_TIPOCF));
|
||||
return conto;
|
||||
}
|
||||
|
||||
const char* TCausale::desc_agg(int num) const
|
||||
{
|
||||
const char* deag = "";
|
||||
|
||||
const TRectype* rec = row(num);
|
||||
if (rec != NULL)
|
||||
{
|
||||
const TString& cod = rec->get(RCA_CODDESC);
|
||||
deag = cache().get("%DPN", cod, "S0");
|
||||
}
|
||||
|
||||
return deag;
|
||||
}
|
||||
|
||||
const char* TCausale::descrizione() const
|
||||
{ return _rec.get(CAU_DESCR); }
|
||||
|
||||
const char* TCausale::codice() const
|
||||
{ return _rec.get(CAU_CODCAUS); }
|
||||
|
||||
bool TCausale::data_doc() const
|
||||
{ return _rec.get_bool(CAU_DATADOC); }
|
||||
|
||||
bool TCausale::num_doc() const
|
||||
{ return _rec.get_bool(CAU_NUMDOC); }
|
||||
|
||||
bool TCausale::apertura() const
|
||||
{ return _rec.get_char(CAU_MOVAP) == 'A'; }
|
||||
|
||||
bool TCausale::chiusura() const
|
||||
{ return _rec.get_char(CAU_MOVAP) == 'C'; }
|
||||
|
||||
bool TCausale::sezionale() const
|
||||
{ return _rec.get_bool(CAU_MOVSEZ); }
|
||||
|
||||
bool TCausale::valuta() const
|
||||
{ return _rec.get_bool(CAU_MOVVAL); }
|
||||
|
||||
bool TCausale::intra() const
|
||||
{ return _rec.get_bool(CAU_INTRACOM); }
|
||||
|
||||
bool TCausale::valintra() const
|
||||
{ return _rec.get_bool(CAU_VALINTRA); }
|
||||
|
||||
bool TCausale::soloiva() const
|
||||
{ return _rec.get_bool(CAU_SOLOIVA); }
|
||||
|
||||
int TCausale::regime_speciale() const
|
||||
{ return _rec.get_int(CAU_REGSPIVA); }
|
||||
|
||||
bool TCausale::esclusione_allegati() const
|
||||
{ return _rec.get_bool(CAU_ALLEG); }
|
||||
|
||||
const TString& TCausale::causale_collegata() const
|
||||
{ return _rec.get(CAU_CODCAUSIM); }
|
||||
|
||||
const TString& TCausale::causale_reg_iva() const
|
||||
{ return _rec.get(CAU_CODCAUREG); }
|
||||
|
||||
const TString& TCausale::tipo_doc() const
|
||||
{ return _rec.get(CAU_TIPODOC); }
|
||||
|
||||
tipo_movimento TCausale::tipomov() const
|
||||
{ return tipo_movimento(_rec.get_int(CAU_TIPOMOV)); }
|
||||
|
||||
const TString& TCausale::tipodoc() const
|
||||
{ return _rec.get(CAU_TIPODOC); }
|
||||
|
||||
bool TCausale::saldaconto(const TDate& datareg) const
|
||||
{
|
||||
bool yes = tipomov() > 0;
|
||||
if (yes && datareg.ok())
|
||||
{
|
||||
static TDate _data_sal = ini_get_string(CONFIG_DITTA, "cg", "DatSal");
|
||||
yes = datareg >= _data_sal;
|
||||
}
|
||||
return yes;
|
||||
}
|
||||
|
||||
int TCausale::link_m770() const
|
||||
{ return _rec.get_int(CAU_M770); }
|
||||
|
||||
char TCausale::link_cespiti() const
|
||||
{ return _rec.get_char(CAU_COLLCESP); }
|
||||
|
||||
bool TCausale::link_analitica() const
|
||||
{ return _rec.get_bool(CAU_MOVIND); }
|
||||
|
||||
bool TCausale::link_industriale() const
|
||||
{ return _rec.exist(CAU_MOVCGIND) && _rec.get_bool(CAU_MOVCGIND); }
|
||||
|
||||
bool TCausale::ok() const
|
||||
{ return iva() != iva_errata; }
|
||||
|
||||
char TCausale::sezione(int riga) const
|
||||
{
|
||||
const TRectype* rec = row(riga);
|
||||
char sez = rec ? toupper(rec->get_char(RCA_SEZIONE)) : ' ';
|
||||
if (sez <= ' ') // Guess section on tipocf
|
||||
{
|
||||
const TRectype* uno = row(1);
|
||||
char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' ';
|
||||
if (tipocf <= ' ')
|
||||
tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA
|
||||
sez = (tipocf == 'C') ? 'D' : 'A';
|
||||
}
|
||||
return sez;
|
||||
}
|
||||
|
||||
char TCausale::sezione_clifo() const
|
||||
{
|
||||
if (_sezione_clifo <= ' ')
|
||||
(char&)_sezione_clifo = sezione(1);
|
||||
return _sezione_clifo;
|
||||
}
|
||||
|
||||
char TCausale::sezione_ritsoc() const
|
||||
{
|
||||
if (_sezione_ritsoc <= ' ')
|
||||
{
|
||||
// Fatture o Pagamenti?
|
||||
const int tm = _rec.get_int(CAU_TIPOMOV);
|
||||
(char&)_sezione_ritsoc = sezione(tm <= 2 ? 9 : 14);
|
||||
}
|
||||
return _sezione_ritsoc;
|
||||
}
|
||||
|
||||
char TCausale::sezione_ritfis()
|
||||
|
||||
{
|
||||
if (_sezione_ritfis == ' ')
|
||||
{
|
||||
if (_rec.get_int(CAU_TIPOMOV) <= 2)
|
||||
_sezione_ritfis = sezione(8); // Fatture
|
||||
else
|
||||
_sezione_ritfis = sezione(12); // Pagamenti
|
||||
}
|
||||
return _sezione_ritfis;
|
||||
}
|
||||
|
||||
void TCausale::calcIVA()
|
||||
{
|
||||
TipoIVA i = nessuna_iva; // Tipo IVA di default
|
||||
bool c = false; // Corrispettivi di default
|
||||
|
||||
const TString& td = tipo_doc();
|
||||
if (td.full())
|
||||
{
|
||||
const TRectype& tpd = cache().get("%TPD", td);
|
||||
if (!tpd.empty())
|
||||
{
|
||||
i = (TipoIVA)tpd.get_int("I0"); // IVA acquisti, vendite, generica
|
||||
const TipoIVA ri = _reg.iva();
|
||||
if (i == iva_generica)
|
||||
i = ri;
|
||||
if (i != ri)
|
||||
{
|
||||
error_box(FR("Tipo documento '%s' incompatibile con tipo registro"), (const char*)td);
|
||||
i = iva_errata;
|
||||
}
|
||||
c = tpd.get_bool("B0"); // B0 flag corrispettivi
|
||||
}
|
||||
else
|
||||
error_box(FR("Tipo documento sconosciuto: '%s'"), (const char*)td);
|
||||
}
|
||||
_iva = i;
|
||||
_corrisp = c;
|
||||
}
|
||||
|
||||
const TString& TCausale::compatible(const TCausale& c) const
|
||||
{
|
||||
const char* err = NULL;
|
||||
if (sezionale() != c.sezionale())
|
||||
err = TR("il segnale di sezionale");
|
||||
if (intra() != c.intra())
|
||||
err = TR("la gestione dei movimenti intra");
|
||||
if (valuta() != c.valuta())
|
||||
err = TR("la gestione valuta");
|
||||
if (valintra() != c.valintra())
|
||||
err = TR("la gestione valuta intracomunitaria");
|
||||
if (corrispettivi() != c.corrispettivi())
|
||||
err = TR("la gestione dei corrispettivi");
|
||||
if (iva() != c.iva())
|
||||
err = TR("il tipo di IVA");
|
||||
if (tipomov() != c.tipomov())
|
||||
err = TR("il tipo di movimento");
|
||||
|
||||
if (err != NULL)
|
||||
{
|
||||
TString& msg = get_tmp_string();
|
||||
msg.format(FR("La causale e' incompatibile per %s"), err);
|
||||
return msg;
|
||||
}
|
||||
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
|
||||
{
|
||||
const TString& tipo = iva.tipo();
|
||||
|
||||
if (tipo.not_empty())
|
||||
{
|
||||
if (tipo == "ES") bill(5, c); else
|
||||
if (tipo == "NI") bill(6, c); else
|
||||
if (tipo == "NS") bill(7, c);
|
||||
}
|
||||
|
||||
if (!c.ok())
|
||||
bill(2, c);
|
||||
|
||||
const int spric = c.tipo_cr();
|
||||
if (spric == 2 || spric == 3)
|
||||
{
|
||||
const TString& td = tipo_doc();
|
||||
if (td == "FV" || td == "NC")
|
||||
c.tipo_cr(4);
|
||||
}
|
||||
|
||||
return c.ok();
|
||||
}
|
||||
#include "cg2103.h"
|
||||
|
||||
#include <diction.h>
|
||||
#include <recarray.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <causali.h>
|
||||
#include <rcausali.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Causale
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TCausale::TCausale(const char* cod, int year)
|
||||
: TArray(12), _rec(LF_CAUSALI),
|
||||
_iva(iva_errata), _corrisp(false),
|
||||
_sezione_clifo(' '), _sezione_ritsoc(' '), _sezione_ritfis(' '),
|
||||
_provvisorio(' ')
|
||||
{
|
||||
if (cod && *cod)
|
||||
read(cod, year);
|
||||
}
|
||||
|
||||
// Legge le righe della causale attualmente selezionata sulla maschera
|
||||
bool TCausale::read(const char* cod, int year)
|
||||
{
|
||||
_rec.zero(); // Delete header
|
||||
destroy(); // Delete all rows
|
||||
_iva = iva_errata; // Delete misc info
|
||||
_sezione_clifo = _sezione_ritsoc = _provvisorio = ' ';
|
||||
_corrisp = false;
|
||||
|
||||
if (cod && *cod > ' ')
|
||||
{
|
||||
_rec = cache().get(LF_CAUSALI, cod);
|
||||
if (_rec.empty())
|
||||
return false;
|
||||
|
||||
_provvisorio = _rec.get_char(CAU_PROVV);
|
||||
TLocalisamfile rcaus(LF_RCAUSALI);
|
||||
rcaus.put(CAU_CODCAUS, cod);
|
||||
rcaus.put(CAU_NRIGA, 0);
|
||||
|
||||
int err;
|
||||
for (err = rcaus.read(_isgteq); // Find first line
|
||||
err == NOERR && rcaus.get(CAU_CODCAUS) == cod;
|
||||
err = rcaus.next()) // Read next line
|
||||
{
|
||||
const int riga = rcaus.get_int(CAU_NRIGA);
|
||||
add(rcaus.curr(), riga);
|
||||
}
|
||||
|
||||
const TString4 codreg(_rec.get(CAU_REG));
|
||||
const bool ok = _reg.read(codreg, year); // Read register
|
||||
if (!ok && codreg.not_empty())
|
||||
return error_box(FR("Non esiste il registro '%s' del %d"),
|
||||
(const char*)codreg, year);
|
||||
calcIVA();
|
||||
}
|
||||
else
|
||||
{
|
||||
_iva = nessuna_iva; // Clear IVA data
|
||||
_corrisp = false;
|
||||
_reg.read("", year);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TBill& TCausale::bill(int num, TBill& conto) const
|
||||
{
|
||||
const TRectype* rec = row(num);
|
||||
if (rec != NULL)
|
||||
conto.set(rec->get_int(RCA_GRUPPO), rec->get_int(RCA_CONTO),
|
||||
rec->get_long(RCA_SOTTOCONTO), rec->get_char(RCA_TIPOCF));
|
||||
return conto;
|
||||
}
|
||||
|
||||
const char* TCausale::desc_agg(int num) const
|
||||
{
|
||||
const char* deag = "";
|
||||
|
||||
const TRectype* rec = row(num);
|
||||
if (rec != NULL)
|
||||
{
|
||||
const TString& cod = rec->get(RCA_CODDESC);
|
||||
deag = cache().get("%DPN", cod, "S0");
|
||||
}
|
||||
|
||||
return deag;
|
||||
}
|
||||
|
||||
const char* TCausale::descrizione() const
|
||||
{ return _rec.get(CAU_DESCR); }
|
||||
|
||||
const char* TCausale::codice() const
|
||||
{ return _rec.get(CAU_CODCAUS); }
|
||||
|
||||
bool TCausale::data_doc() const
|
||||
{ return _rec.get_bool(CAU_DATADOC); }
|
||||
|
||||
bool TCausale::num_doc() const
|
||||
{ return _rec.get_bool(CAU_NUMDOC); }
|
||||
|
||||
bool TCausale::apertura() const
|
||||
{ return _rec.get_char(CAU_MOVAP) == 'A'; }
|
||||
|
||||
bool TCausale::chiusura() const
|
||||
{ return _rec.get_char(CAU_MOVAP) == 'C'; }
|
||||
|
||||
bool TCausale::sezionale() const
|
||||
{ return _rec.get_bool(CAU_MOVSEZ); }
|
||||
|
||||
bool TCausale::valuta() const
|
||||
{ return _rec.get_bool(CAU_MOVVAL); }
|
||||
|
||||
bool TCausale::intra() const
|
||||
{ return _rec.get_bool(CAU_INTRACOM); }
|
||||
|
||||
bool TCausale::valintra() const
|
||||
{ return _rec.get_bool(CAU_VALINTRA); }
|
||||
|
||||
bool TCausale::soloiva() const
|
||||
{ return _rec.get_bool(CAU_SOLOIVA); }
|
||||
|
||||
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); }
|
||||
|
||||
const TString& TCausale::causale_collegata() const
|
||||
{ return _rec.get(CAU_CODCAUSIM); }
|
||||
|
||||
const TString& TCausale::causale_reg_iva() const
|
||||
{ return _rec.get(CAU_CODCAUREG); }
|
||||
|
||||
const TString& TCausale::tipo_doc() const
|
||||
{ return _rec.get(CAU_TIPODOC); }
|
||||
|
||||
tipo_movimento TCausale::tipomov() const
|
||||
{ return tipo_movimento(_rec.get_int(CAU_TIPOMOV)); }
|
||||
|
||||
const TString& TCausale::tipodoc() const
|
||||
{ return _rec.get(CAU_TIPODOC); }
|
||||
|
||||
bool TCausale::saldaconto(const TDate& datareg) const
|
||||
{
|
||||
bool yes = tipomov() > 0;
|
||||
if (yes && datareg.ok())
|
||||
{
|
||||
static TDate _data_sal = ini_get_string(CONFIG_DITTA, "cg", "DatSal");
|
||||
yes = datareg >= _data_sal;
|
||||
}
|
||||
return yes;
|
||||
}
|
||||
|
||||
int TCausale::link_m770() const
|
||||
{ return _rec.get_int(CAU_M770); }
|
||||
|
||||
char TCausale::link_cespiti() const
|
||||
{ return _rec.get_char(CAU_COLLCESP); }
|
||||
|
||||
bool TCausale::link_analitica() const
|
||||
{ return _rec.get_bool(CAU_MOVIND); }
|
||||
|
||||
bool TCausale::link_industriale() const
|
||||
{ return _rec.exist(CAU_MOVCGIND) && _rec.get_bool(CAU_MOVCGIND); }
|
||||
|
||||
bool TCausale::ok() const
|
||||
{ return iva() != iva_errata; }
|
||||
|
||||
char TCausale::sezione(int riga) const
|
||||
{
|
||||
const TRectype* rec = row(riga);
|
||||
char sez = rec ? toupper(rec->get_char(RCA_SEZIONE)) : ' ';
|
||||
if (sez <= ' ') // Guess section on tipocf
|
||||
{
|
||||
const TRectype* uno = row(1);
|
||||
char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' ';
|
||||
if (tipocf <= ' ')
|
||||
tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA
|
||||
sez = (tipocf == 'C') ? 'D' : 'A';
|
||||
}
|
||||
return sez;
|
||||
}
|
||||
|
||||
char TCausale::sezione_clifo() const
|
||||
{
|
||||
if (_sezione_clifo <= ' ')
|
||||
(char&)_sezione_clifo = sezione(1);
|
||||
return _sezione_clifo;
|
||||
}
|
||||
|
||||
char TCausale::sezione_ritsoc() const
|
||||
{
|
||||
if (_sezione_ritsoc <= ' ')
|
||||
{
|
||||
// Fatture o Pagamenti?
|
||||
const int tm = _rec.get_int(CAU_TIPOMOV);
|
||||
(char&)_sezione_ritsoc = sezione(tm <= 2 ? 9 : 14);
|
||||
}
|
||||
return _sezione_ritsoc;
|
||||
}
|
||||
|
||||
char TCausale::sezione_ritfis()
|
||||
|
||||
{
|
||||
if (_sezione_ritfis == ' ')
|
||||
{
|
||||
if (_rec.get_int(CAU_TIPOMOV) <= 2)
|
||||
_sezione_ritfis = sezione(8); // Fatture
|
||||
else
|
||||
_sezione_ritfis = sezione(12); // Pagamenti
|
||||
}
|
||||
return _sezione_ritfis;
|
||||
}
|
||||
|
||||
void TCausale::calcIVA()
|
||||
{
|
||||
TipoIVA i = nessuna_iva; // Tipo IVA di default
|
||||
bool c = false; // Corrispettivi di default
|
||||
|
||||
const TString& td = tipo_doc();
|
||||
if (td.full())
|
||||
{
|
||||
const TRectype& tpd = cache().get("%TPD", td);
|
||||
if (!tpd.empty())
|
||||
{
|
||||
i = (TipoIVA)tpd.get_int("I0"); // IVA acquisti, vendite, generica
|
||||
const TipoIVA ri = _reg.iva();
|
||||
if (i == iva_generica)
|
||||
i = ri;
|
||||
if (i != ri)
|
||||
{
|
||||
error_box(FR("Tipo documento '%s' incompatibile con tipo registro"), (const char*)td);
|
||||
i = iva_errata;
|
||||
}
|
||||
c = tpd.get_bool("B0"); // B0 flag corrispettivi
|
||||
}
|
||||
else
|
||||
error_box(FR("Tipo documento sconosciuto: '%s'"), (const char*)td);
|
||||
}
|
||||
_iva = i;
|
||||
_corrisp = c;
|
||||
}
|
||||
|
||||
const TString& TCausale::compatible(const TCausale& c) const
|
||||
{
|
||||
const char* err = NULL;
|
||||
if (sezionale() != c.sezionale())
|
||||
err = TR("il segnale di sezionale");
|
||||
if (intra() != c.intra())
|
||||
err = TR("la gestione dei movimenti intra");
|
||||
if (valuta() != c.valuta())
|
||||
err = TR("la gestione valuta");
|
||||
if (valintra() != c.valintra())
|
||||
err = TR("la gestione valuta intracomunitaria");
|
||||
if (corrispettivi() != c.corrispettivi())
|
||||
err = TR("la gestione dei corrispettivi");
|
||||
if (iva() != c.iva())
|
||||
err = TR("il tipo di IVA");
|
||||
if (tipomov() != c.tipomov())
|
||||
err = TR("il tipo di movimento");
|
||||
|
||||
if (err != NULL)
|
||||
{
|
||||
TString& msg = get_tmp_string();
|
||||
msg.format(FR("La causale e' incompatibile per %s"), err);
|
||||
return msg;
|
||||
}
|
||||
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
|
||||
{
|
||||
const TString& tipo = iva.tipo();
|
||||
|
||||
if (tipo.not_empty())
|
||||
{
|
||||
if (tipo == "ES") bill(5, c); else
|
||||
if (tipo == "NI") bill(6, c); else
|
||||
if (tipo == "NS") bill(7, c);
|
||||
}
|
||||
|
||||
if (!c.ok())
|
||||
bill(2, c);
|
||||
|
||||
const int spric = c.tipo_cr();
|
||||
if (spric == 2 || spric == 3)
|
||||
{
|
||||
const TString& td = tipo_doc();
|
||||
if (td == "FV" || td == "NC")
|
||||
c.tipo_cr(4);
|
||||
}
|
||||
|
||||
return c.ok();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -1975,13 +1975,8 @@ 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);
|
||||
// Se non esistono contropartite devo espandere le righe
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
|
@ -1,7 +1,6 @@
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
|
||||
|
||||
#define F_CODATT 105
|
||||
#define F_DESCATT 106
|
||||
#define F_PRORATA 107
|
||||
|
@ -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" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user