Merge branch 'R_10_00' of http://10.65.20.33/sirio/CAMPO/campo into R_10_00

This commit is contained in:
Simone Palacino 2020-09-15 16:59:01 +02:00
commit ec90dcb698
30 changed files with 719 additions and 498 deletions

View File

@ -1,5 +1,6 @@
sql\fp0\fp0118.sql
fp0.exe
fp0400a.msk
sql\fp0\fp0118.sql
Aggiornamento codici per nuovo tracciato in vigore dall'1 Ottobre: TipoDocSDI TipoRitenute Pagamenti.
Modificata esportazione fp per lettura Nuovi codici per le ritenute dalle SPESE.

View File

@ -3,8 +3,9 @@ Demo=0
[fp0]
File(0) = fp0.exe|X
File(15) = sql\fp0\fp0118.sql|X
Patch = 0996
File(4) = fp0400a.msk|X
File(12) = sql\fp0\fp0118.sql|X
Patch = 996
Versione = 21511200
[fp]
@ -13,7 +14,7 @@ Descrizione = Fattura Elettronica
Dischi = 1
Moduli = cg,ve
OEM =
Patch = 996
Patch = 0996
PostProcess =
PreProcess =
Versione = 21511200

Binary file not shown.

View File

@ -1,7 +1,9 @@
ve0300a.ini
vemenu.men
vetbspp.msk
vetbtip.msk
ve5.exe
ve5700.msk
Aggiornamento codici per nuovo tracciato in vigore dall'1 Ottobre: TipoDocSDI TipoRitenute Pagamenti.
Modificata esportazione fp per lettura Nuovi codici per le ritenute dalle SPESE.

View File

@ -10,6 +10,7 @@ Patch = 996
Versione = 21511200
[ve1]
File(101) = vemenu.men|X
File(209) = vetbspp.msk|X
File(213) = vetbtip.msk|X
Patch = 996
@ -17,116 +18,117 @@ Versione = 21511200
[ve5]
File(243) = ve5.exe|X
File(264) = ve5700.msk|X
Patch = 996
Versione = 21511200
[ve99]
Kill(0) = batbimb.msk|x
Kill(1) = batbacr.msk|x
Kill(2) = batbgsa.msk|x
Kill(3) = batbeld.msk|x
Kill(4) = batbcau.msk|x
Kill(5) = batbprv.msk|x
Kill(6) = ve7500a.msk|x
Kill(7) = efstbnp.msk|x
Kill(8) = batbbnp.msk|x
Kill(9) = batbcra.msk|x
Kill(10) = bastrfc.msk|x
Kill(11) = ve7200a.msk|x
Kill(12) = bastfca.rep|x
Kill(13) = bastums.rep|x
Kill(14) = bastnum.rep|x
Kill(15) = ve7.exe|x
Kill(16) = bastfrm.msk|x
Kill(17) = batbfrd.msk|x
Kill(18) = bastubi.rep|x
Kill(19) = bastprs.rep|x
Kill(20) = batbfrm.msk|x
Kill(21) = bastimb.rep|x
Kill(22) = bastcau.msk|x
Kill(23) = bastrfa.msk|x
Kill(2) = ve7400a.msk|x
Kill(3) = bastgmc.rep|x
Kill(4) = bastctr.msk|x
Kill(5) = bastcra.msk|x
Kill(6) = batbbnp.msk|x
Kill(7) = batbcra.msk|x
Kill(8) = bastprs.msk|x
Kill(9) = bastcra.rep|x
Kill(10) = bastums.msk|x
Kill(11) = efstbnp.rep|x
Kill(12) = batbnum.msk|x
Kill(13) = bastasf.rep|x
Kill(14) = batbgcg.msk|x
Kill(15) = bastfrr.msk|x
Kill(16) = bastfrd.msk|x
Kill(17) = batbgmc.msk|x
Kill(18) = batbtip.msk|x
Kill(19) = bastcaa.rep|x
Kill(20) = bastfrd.rep|x
Kill(21) = batbrfc.msk|x
Kill(22) = bastimb.rep|x
Kill(23) = bastgmc.msk|x
Kill(24) = basteld.rep|x
Kill(25) = ve7400a.ini|x
Kill(26) = ve7300a.msk|x
Kill(27) = batbabe.msk|x
Kill(28) = bastrfa.rep|x
Kill(29) = batbfsa.msk|x
Kill(30) = batbrfc.msk|x
Kill(31) = bastgcg.msk|x
Kill(32) = batbubi.msk|x
Kill(33) = batbfca.msk|x
Kill(34) = bastabe.msk|x
Kill(35) = basttag.msk|x
Kill(36) = batbgmc.msk|x
Kill(37) = bastubi.msk|x
Kill(38) = batbmre.msk|x
Kill(39) = bastfrm.rep|x
Kill(40) = batbrfa.msk|x
Kill(41) = ve7200a.frm|x
Kill(42) = bastfrd.msk|x
Kill(43) = ve7701a.ini|x
Kill(44) = ve7300a.frm|x
Kill(45) = baststd.rep|x
Kill(46) = bastrfc.rep|x
Kill(47) = basttri.rep|x
Kill(48) = batbctr.msk|x
Kill(49) = batbprs.msk|x
Kill(50) = bastasf.msk|x
Kill(51) = basttip.rep|x
Kill(52) = ve7600a.msk|x
Kill(53) = batbspp.msk|x
Kill(54) = ve7400conf.ini|x
Kill(55) = ve7100a.msk|x
Kill(56) = basttag.rep|x
Kill(57) = bastfca.msk|x
Kill(58) = eftbbnp.msk|x
Kill(59) = bastbnp.msk|x
Kill(60) = baststd.msk|x
Kill(61) = bastimb.msk|x
Kill(62) = bastspp.msk|x
Kill(63) = batbums.msk|x
Kill(64) = bastcaa.msk|x
Kill(65) = batbfrr.msk|x
Kill(66) = bastabe.rep|x
Kill(67) = batbfid.msk|x
Kill(68) = batbgcg.msk|x
Kill(69) = bastums.msk|x
Kill(70) = batbtag.msk|x
Kill(71) = bastfrr.rep|x
Kill(72) = bastcau.rep|x
Kill(73) = batbstd.msk|x
Kill(74) = batbnum.msk|x
Kill(75) = bastprs.msk|x
Kill(76) = ve7400a.msk|x
Kill(77) = bastctr.msk|x
Kill(78) = batbtip.msk|x
Kill(79) = bastcaa.rep|x
Kill(80) = batbspt.msk|x
Kill(81) = basttri.msk|x
Kill(82) = bastfrd.rep|x
Kill(83) = bastgmc.msk|x
Kill(84) = batbcaa.msk|x
Kill(85) = batbpro.msk|x
Kill(86) = basteld.msk|x
Kill(87) = bastgca.msk|x
Kill(88) = bastgca.rep|x
Kill(89) = bastnum.msk|x
Kill(90) = batbgca.msk|x
Kill(91) = basttip.msk|x
Kill(92) = batbasf.msk|x
Kill(93) = batbtri.msk|x
Kill(94) = ve7700a.msk|x
Kill(95) = bastbnp.rep|x
Kill(96) = bastgcg.rep|x
Kill(97) = bastctr.rep|x
Kill(25) = ve7.exe|x
Kill(26) = batbfca.msk|x
Kill(27) = batbfrm.msk|x
Kill(28) = batbabe.msk|x
Kill(29) = bastnum.rep|x
Kill(30) = batbasf.msk|x
Kill(31) = ve7400a.ini|x
Kill(32) = basteld.msk|x
Kill(33) = bastprs.rep|x
Kill(34) = batbspt.msk|x
Kill(35) = bastubi.rep|x
Kill(36) = basttri.msk|x
Kill(37) = bastgcg.msk|x
Kill(38) = batbgca.msk|x
Kill(39) = batbcaa.msk|x
Kill(40) = batbtri.msk|x
Kill(41) = bastgca.msk|x
Kill(42) = batbums.msk|x
Kill(43) = batbmre.msk|x
Kill(44) = ve7600a.msk|x
Kill(45) = bastfca.msk|x
Kill(46) = basttip.rep|x
Kill(47) = bastrfc.rep|x
Kill(48) = bastasf.msk|x
Kill(49) = basttag.msk|x
Kill(50) = ve7300a.frm|x
Kill(51) = batbfsa.msk|x
Kill(52) = batbstd.msk|x
Kill(53) = batbctr.msk|x
Kill(54) = bastspp.msk|x
Kill(55) = batbfid.msk|x
Kill(56) = bastimb.msk|x
Kill(57) = basttag.rep|x
Kill(58) = baststd.msk|x
Kill(59) = baststd.rep|x
Kill(60) = ve7400conf.ini|x
Kill(61) = bastfrm.rep|x
Kill(62) = bastrfc.msk|x
Kill(63) = eftbbnp.msk|x
Kill(64) = bastcau.rep|x
Kill(65) = ve7200a.msk|x
Kill(66) = bastfrr.rep|x
Kill(67) = bastabe.rep|x
Kill(68) = batbtag.msk|x
Kill(69) = ve7100a.msk|x
Kill(70) = bastcaa.msk|x
Kill(71) = batbprs.msk|x
Kill(72) = batbubi.msk|x
Kill(73) = bastrfa.msk|x
Kill(74) = bastfca.rep|x
Kill(75) = ve7300a.msk|x
Kill(76) = batbfrd.msk|x
Kill(77) = bastums.rep|x
Kill(78) = bastcau.msk|x
Kill(79) = batbfrr.msk|x
Kill(80) = bastfrm.msk|x
Kill(81) = bastbnp.msk|x
Kill(82) = ve7701a.ini|x
Kill(83) = bastubi.msk|x
Kill(84) = batbspp.msk|x
Kill(85) = bastrfa.rep|x
Kill(86) = basttri.rep|x
Kill(87) = ve7200a.frm|x
Kill(88) = batbrfa.msk|x
Kill(89) = bastabe.msk|x
Kill(90) = ve7500a.msk|x
Kill(91) = efstbnp.msk|x
Kill(92) = batbcau.msk|x
Kill(93) = batbprv.msk|x
Kill(94) = batbgsa.msk|x
Kill(95) = batbeld.msk|x
Kill(96) = basttip.msk|x
Kill(97) = batbpro.msk|x
Kill(98) = bastspp.rep|x
Kill(99) = batbcld.msk|x
Kill(100) = bastasf.rep|x
Kill(101) = bastfrr.msk|x
Kill(102) = bastgmc.rep|x
Kill(103) = bastcra.msk|x
Kill(104) = bastcra.rep|x
Kill(105) = efstbnp.rep|x
Kill(100) = ve7700a.msk|x
Kill(101) = bastgca.rep|x
Kill(102) = bastbnp.rep|x
Kill(103) = bastnum.msk|x
Kill(104) = bastgcg.rep|x
Kill(105) = bastctr.rep|x
[ve]
Data = 09-09-2020
@ -134,7 +136,7 @@ Descrizione = Vendite
Dischi = 1
Moduli = ba,cg9,pr9,mg9,sv9,in9,ef9
OEM =
Patch = 996
Patch = 0996
PostProcess = bainst -0 VE
PreProcess =
Prezzo(1) =

Binary file not shown.

View File

@ -12,6 +12,7 @@
#include "cg0.h"
#include "cg0400.h"
#include "cglib.h"
#include "cgpim.h"
@ -26,8 +27,6 @@ enum liste {
ListaPerPeriodo=2,
};
enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione };
struct Importi {
real imponibile;
real imposta;
@ -321,11 +320,9 @@ void TProgressivi_iva::look_pim()
if (tabiva.read() == NOERR)
soggetto = tabiva.get("S1") != "NS"; // I non soggetti non vanno sempre considerati
reg.put("CODTAB",codreg);
if (reg.read() != NOERR) reg.zero();
const bool corrisp = reg.get_bool("B0");
const tipo_sospensione sosp_imp = reg.get_bool("B1") ? (tipo_sospensione) reg.get_int("I9") : nessuna;
const TRegistro & reg = cached_registro(codreg);
const bool corrisp = reg.corrispettivi();
const tipo_sospensione sosp_imp = reg.sospensione();
// Se si decide di stampare i progressivi validi per la liquidazione
// i PIM validi solo per il volume d'affari vanno scartati
@ -413,7 +410,7 @@ void TProgressivi_iva::look_pim()
}
break;
default:
if (sosp_imp == normale || sosp_imp == nessuna) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati
if (sosp_imp == sospensione_normale || sosp_imp == nessuna_sospensione) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati
{
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO);

View File

@ -2335,11 +2335,12 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
static TString4 __trit;
if (__trit.blank())
__trit << cgrowtype_ritfis << cgrowtype_ritsoc << cgrowtype_revcharge;
__trit << (char) cgrowtype_ritfis << (char) cgrowtype_ritsoc << (char) cgrowtype_revcharge;
for (int i = 0; __frit[i]; i++)
{
TEdit_field& ritfld = msk.efield(__frit[i]);
if (!ritfld.empty() && ritfld.active())
add_cgs_ritenute(__trit[i]);
}

View File

@ -271,17 +271,14 @@ void TProvvisori_app::inizia_saldi(const TRectype& r)
_saldi.reset();
tiposal tsal = normale;
const TString4 c = r.get(MOV_CODCAUS);
if (c.not_empty())
tiposal tsal = saldo_normale;
const TString4 codcaus = r.get(MOV_CODCAUS);
if (codcaus.full())
{
const TRectype& cau = cache().get(LF_CAUSALI, c);
if (!cau.empty())
{
const char movap = cau.get_char(CAU_MOVAP);
if (movap == 'A') tsal = apertura; else
if (movap == 'C') tsal = chiusura;
}
const TCausale & cau = cached_causale(codcaus);
tsal = cau.tipo_saldo();
}
_saldi.set_tipo_saldo(tsal);

View File

@ -77,8 +77,7 @@ const real INVALID_PRORATA = 1999.0; // A Guy piacciono gli 883... a me p
enum recalc { one = 2, never = 4 };
enum wht { all = 1, mnt = 2, trimestre = 3};
enum tbc { precedente = 1, incorso = 2};
enum tiporeg { vendita = 1, acquisto = 2 };
enum tipo_sospensione { nessuna, sospensione_normale, vol_affari, liquidazione };
// flags per gli items di stampa
#define CHG_PARMS 1 // cambiato qualcosa (attivita', ditta...)

View File

@ -31,7 +31,20 @@
// Datemi un punto di appoggio ******************
// e mi ci appoggero' ******************
// ----------------------------------------------------- ******************
#ifdef DBG
bool check_nreg(long nreg)
{
long __nreg[] = { 41221L, 0L };
int i = 0;
while (__nreg[i] > 0L)
if (__nreg[i++] == nreg)
return true;
return false;
}
#endif
bool TLiquidazione_app::recalc_all()
{
TString msg;
@ -140,40 +153,6 @@ bool TLiquidazione_app::recalc_all()
* provocano il ricalcolo dei progressivi mensili ma non la stampa
*/
_canprint = is_month_ok_strict(_month) || _month == 13;
/* --------------------------------------------------------------
* Ricalcola i mesi necessari: annuale e' un mese unico da 1/1 al 31/12
* --------------------------------------------------------------
*/
/* int need_refresh = false;
if (_recalc != ever)
{
int m = _month == 13 ? _month : 1;
for (; m < _month; m++)
if (is_month_ok_strict(m))
{
const TRectype & lim = get_lim(m);
if (lim.empty() || !lim.get_bool("B0"))
{
need_refresh = true;
break;
}
}
if (need_refresh && yesno_box(TR("Alcuni mesi precedenti non "
"risultano ricalcolati. E' consigliabile il ricalcolo. "
"Si desidera eseguirlo?")))
_recalc = ever;
}
int m;
for (m = 1; m <= _month; m++) // fino a 13 compreso
{
if (is_month_plain(m) || _recalc == ever)
update_firm(m);
} */
if (_freqviva == "T")
{
for (int m = _month - 2; m <= _month; m++)
@ -550,9 +529,9 @@ bool TLiquidazione_app::update_att(int month, const char* codatt, TAssoc_array &
if (ok && !recalc)
return true;
bool calc = (_recalc == one && is_month_ok(month,_month));
if (!calc && _recalc != never)
calc = !ok;
if (calc || !recalc)
{
zero_att(month,codatt);
@ -924,27 +903,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
real esenti_b14 = ZERO;
real vendite_rev = ZERO; // Vendire in reverse charge (da escludere in prorata)
real cred_fattrit;
/* Comunicazione dati iva annuale dal 2016 calcolata in cg5
// Comunicazione dati iva annuale (dal 2003)
real cessioni_cd1_1 = ZERO; // Totale operazioni attive
real cessioni_cd1_2 = ZERO; // non imponibili
real cessioni_cd1_3 = ZERO; // esenti
real cessioni_cd1_4 = ZERO; // intra
real cessioni_cd1_5 = ZERO; // beni strumentali
real acquisti_cd2_1 = ZERO; // Totale operazioni passive
real acquisti_cd2_2 = ZERO; // non imponibili
real acquisti_cd2_3 = ZERO; // esenti
real acquisti_cd2_4 = ZERO; // intra
real acquisti_cd2_5 = ZERO; // beni strumentali
real oroargento_cd3_1 = ZERO; // imponibile acquisto oro e argento
real oroargento_cd3_2 = ZERO; // imposta acquisto oro e argento
real rottami_cd3_3 = ZERO; // imponibile acquisto rottami
real rottami_cd3_4 = ZERO; // imposta acquisto rottami
real cessioni_cd1_1s = ZERO; // Totale operazioni attive in split payment
*/
real esni_rimb = ZERO; // ci sommo tutti esenti e ni validi per rimborso
real esni_rimb = ZERO; // ci sommo tutti esenti e ni validi per rimborso
real corr_CEE = ZERO;
real corr_noCEE = ZERO;
real acq_CEE = ZERO;
@ -1154,6 +1113,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
}
TProgress_monitor pi(items, pimsg, false);
for (; _cur->pos() < items; ++(*_cur))
{
if (!pi.set_status(_cur->pos()))
@ -1163,17 +1123,19 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
#ifdef DBG
long nr = _mov->get_long(MOV_NUMREG);
if (nr == 18489 || nr == 27710)
int i = 1;
check_nreg(nr);
#endif
const int liqmonth = _mov->get_int(MOV_MESELIQ);
const TString4 reg = _mov->get("REG");
const bool isreg = look_reg(reg);
const TString4 tipodoc = _mov->get(MOV_TIPODOC);
const bool corrisp = _reg->get_bool("B0");
const tiporeg tipomov = (tiporeg)_reg->get_int("I0"); // 1=Vendite; 2=Acquisti
tipo_movimento tm = (tipo_movimento)_mov->get_int(MOV_TIPOMOV);
const TRegistro & r = cached_registro(_reg->curr());
const bool corrisp = r.corrispettivi();
const tiporeg tipomov = r.tipo_registro();
// const bool corrisp = _reg->get_bool("B0");
// const tiporeg tipomov = (tiporeg)_reg->get_int("I0"); // 1=Vendite; 2=Acquisti
tipo_movimento tm = (tipo_movimento) _mov->get_int(MOV_TIPOMOV);
real imp_split_payment;
if (tm == tm_nessuno)
@ -1202,36 +1164,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
const bool cau_intra = rcs.get_bool(CAU_INTRACOM);
const bool cau_valintra = rcs.get_bool(CAU_VALINTRA);
/*
// Gestione SPLIT PAYMENT dal 01-01-2015: movimenti a enti pubblici senza ritenuta e senza reverse charge
if (tipomov == vendita && (tm == tm_fattura || tm == tm_nota_credito) &&
!cau_intra && date.year() >= 2015 && is_split_payment(_mov->curr()))
{
Dal 2016 calcoliamo comunicazione annuale in cg5
// aggiunto il 27-01-2016: in tredicesima devo compilare anche CD1_1
if (month == 13 && date.year() == year_int)
{
do // scansione semplificata delle righe IVA
{
const int rmi_tipoatt = max(_rmoviva->get_int(RMI_TIPOATT), 1); // Poteva capitare tipoatt == 0
if (rmi_tipoatt != tipatt)
continue;
const TString& codiva = _rmoviva->get(RMI_CODIVA);
if (!look_iva(codiva))
continue;
const TString& iva_vpn = _iva->get("S10");
if (iva_vpn.full())
{
const real impZonibile_orig = _rmoviva->get(RMI_IMPONIBILE);
cessioni_cd1_1s += imponibile_orig;
cessioni_cd1_1 += imponibile_orig;
}
} while (_cur->next_match(LF_RMOVIVA));
}
continue; // Ignora movimento di split payment
} */
// Inizio gestione IVA differita
const bool iva_diff = _mov->get_bool(MOV_LIQDIFF) && is_IVA_diff(_mov->curr());
const bool iva_cass = !iva_diff && !_isviaggio && tm > tm_nessuno && is_IVAxCassa(_mov->curr());
@ -1242,7 +1174,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
TPointer_array pagscatt; // Righe di pagsca interessate
#ifdef DBG
int i = 1;
check_nreg(nr);
#endif
if (fattrit)
@ -1286,6 +1219,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
bool regular_month = orizzonte >= date;
bool first_month = regular_month && date > inizio + 1L;
#ifdef DBG
check_nreg(nr);
if (rp.get_long(PART_NREG) == 100616)
int i = 1;
#endif
@ -1297,7 +1231,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
{
const TRectype& p0 = (const TRectype&)pagscatt[p];
const TRectype& p1 = (const TRectype&)pagscatt[p - 1];
if (p0.get_int(PAGSCA_NRIGP) == p1.get_int(PAGSCA_NRIGP))
if (p0.get_int(PAGSCA_NRIGP) == p1.get_int(PAGSCA_NRIGP))
{
const real imp = p0.get_real(PAGSCA_IMPORTO);
((TRectype&)p1).add(PAGSCA_IMPORTO, imp);
@ -1432,10 +1367,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (!dok || sreg || rs8 || cmt)
continue;
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
const tipo_sospensione sosp_imp = cached_registro(_reg->curr()).sospensione();
/*
* Tipo documento da eliminare (Scudler 1994)
* Trattasi per lo piu' di non incassati
@ -1481,6 +1414,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
TCodiceIVA civa(codiva);
#ifdef DBG
check_nreg(nr);
if (tipomov == vendite)
int i = 1;
if (!bIsMovDiff && (civa.percentuale() == 20))
@ -1547,17 +1481,18 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
real impos_det; // Imposta detraibile
char sezfat;
TLocalisamfile id(LF_IVADIFF);
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
const tipo_sospensione sosp_imp = cached_registro(_reg->curr()).sospensione();
const TString & codcaus = rcs.get(CAU_CODCAUS);
TToken_string key = _rmoviva->get(RMI_NUMREG); key.add(1);
const bool soloiva = cached_causale(codcaus, atoi(_year)).reg().iva() != nessuna_iva && cache().get(LF_RMOV, key).empty();
const TRectype& clifo = cache().get_rec(LF_CLIFO, _mov->get(MOV_TIPO), _mov->get(MOV_CODCF));
const int tp = clifo.get_int(CLI_ALLEG);
TToken_string key = _rmoviva->get(RMI_NUMREG); key.add(1);
const TRectype & rmoviva = cache().get(LF_RMOV, key);
const bool soloiva = cached_causale(codcaus, atoi(_year)).reg().iva() != nessuna_iva && rmoviva.empty();
const TCli_for & clifo = cached_clifor(LF_MOV, _mov->curr());
const int tp = clifo.alleg();
// const TRectype& clifo = cache().get_rec(LF_CLIFO, _mov->get(MOV_TIPO), _mov->get(MOV_CODCF));
// const int tp = clifo.get_int(CLI_ALLEG);
#ifdef DBG
long nr = _mov->get_long(MOV_NUMREG);
int i = 1;
check_nreg(nr);
#endif
if ((soloiva &&
@ -1587,17 +1522,20 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
TDate datafat= _mov->get_date(MOV_DATAREG);
long numreg = _rmoviva->get_long(RMI_NUMREG);
sezfat = tipomov == vendita ? 'D' : 'A';
sezfat = tipomov == vendita ? 'D' : 'A';
if (is_detr_diff == 1 || civa.tipo() == "NS")
continue;
if (bIsMovDiff && tm == tm_fattura)
{
const TDate datareg = _mov->get_date(MOV_DATAREG);
int mesereg = datareg.month();
int mesereg = liqmonth == 0 ? datareg.month() : liqmonth;
bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year());
if (ok)
#ifdef DBG
check_nreg(nr);
#endif
if (ok)
{
datafat = datareg;
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
@ -1644,14 +1582,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
const TRectype& pagsca = *(TRectype*)obj;
const int nrigp = pagsca.get_int(PAGSCA_NRIGP);
TDate datapag;
if (nrigp > 0 && nrigp < 9999)
{
const TPartita& p = arrpart.partita(pagsca);
const TRiga_partite& rp = p.riga(nrigp);
datapag = rp.get(PART_DATAREG);
if (!datapag.ok())
datapag = rp.get(PART_DATADOC);
if (!datapag.ok())
datapag = rp.get(PART_DATADOC);
if (!datapag.ok())
datapag = rp.get(PART_DATAPAG);
if (datapag < datafat)
@ -1660,13 +1599,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
else
datapag = _mov->get_date(MOV_DATAINC) ;
bool ok = is_month_ok(datapag.month(), month) && (atoi(_year) == datapag.year());
bool ok = is_month_ok(liqmonth == 0 ? datapag.month() : liqmonth, month) && (atoi(_year) == datapag.year());
if (ok)
{
// if (!ok && (iva_cass && end_cassa && month < 13))
// ok = (datareg.year() < atoi(_year)) || (mesereg <= month);
id.zero();
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
@ -1684,8 +1620,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
TDate datareg = _mov->get(MOV_DATADOC);
if (datareg < datafat)
datareg = datafat;
if (liqmonth == 0)
{
if (datareg < datafat)
datareg = datafat;
}
else
if (liqmonth != datareg.month())
{
datareg.set_month(liqmonth);
datareg.set_end_month();
}
id.put(MOV_DATAREG, datareg);
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
id.put("TIPOATT", rmi_tipoatt);
@ -1711,14 +1656,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
id.put(PART_TIPOMOV, tipomov_pag);
id.put("NUMREGP", nregpag);
id.put("NUMRIGP", nrigpag);
/* TDate d = rp.get(PART_DATAPAG);
if (!d.ok())
d = rp.get(PART_DATADOC);
if (!d.ok())
d = rp.get(PART_DATAREG);
if (d < datafat)
d = datafat; */
id.put("DATAREGP", datapag);
id.put("ANNOLIQ", datapag.year());
pagtmp = p.importo_pagsca(pagsca);
@ -1943,87 +1880,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
}
}
}
/* Calcoli sprecati: dal 2016 calcolimao la comuncazione annuale direttamente in cg5
const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
// Aggiunto "&& is_detraibile==0" al test altrimenti somma due volte imponibile_orig (22/01/2015)
if (!bIsMovDiff && iva_vpn.full() && _mov->get_int(MOV_ANNOIVA) == year_int && is_detraibile == 0)
{
switch (tipomov)
{
case vendita: // CD1 - 1 2 3 4
{
// bool is_valid = !corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
// sosp_imp != normale && sosp_imp != liquidazione;
bool is_valid = tipodoc != "AF" && sosp_imp != normale && sosp_imp != liquidazione;
if (is_valid)
{
cessioni_cd1_1 += imponibile_orig;
if (iva_vpn.starts_with("CD1"))
{
if (tipocr == 4)
cessioni_cd1_5 += imponibile_orig;
}
if (!cau_intra)
{
if (iva_vpn == "CD12")
cessioni_cd1_2 += imponibile_orig; else
if (iva_vpn == "CD13")
cessioni_cd1_3 += imponibile_orig;
}
else
{
if (iva_vpn == "CD14")
cessioni_cd1_4 += imponibile_orig;
}
}
}
break;
case acquisto: // CD2 - 1 2 3 4
{
acquisti_cd2_1 += imponibile_orig;
if (iva_vpn.starts_with("CD2"))
{
if (tipocr == 2 || tipocr == 3 || tipocr == 8)
acquisti_cd2_5 += imponibile_orig;
}
if (!cau_intra)
{
if (iva_vpn == "CD22")
acquisti_cd2_2 += imponibile_orig;
else
if (iva_vpn == "CD23")
acquisti_cd2_3 += imponibile_orig;
}
else
{
if (iva_vpn == "CD24")
acquisti_cd2_4 += imponibile_orig;
}
if (iva_vpn == "CD31")
{
oroargento_cd3_1 += imponibile_orig;
oroargento_cd3_2 += imposta_orig;
}
if (iva_vpn == "CD33")
{
rottami_cd3_3 += imponibile_orig;
rottami_cd3_4 += imposta_orig;
}
}
break;
default:
break;
}
}
*/
}
bool bMovDiffToAdd = true;
#ifdef DBG
check_nreg(nr);
if (!bIsMovDiff && (civa.percentuale() == 20))
real p = imposta_orig / imponibile_orig * CENTO;
#endif
@ -2034,7 +1896,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
real imponibile = is_detraibile == 0 ? impon_det : impon_ind;
real imposta = is_detraibile == 0? impos_det : impos_ind;
const TDate datareg = _mov->get_date(MOV_DATAREG);
const bool ok = (is_month_ok(month, liqmonth == 0 ? datareg.month() : liqmonth) || month == 13) && (atoi(_year) == datareg.year());
const bool ok = (is_month_ok(month, liqmonth == 0 ? datareg.month() : liqmonth) || month == 13) &&
(atoi(_year) == datareg.year());
if (civa.senza_imposta() && !ok)
continue;
@ -2060,7 +1923,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
nin_imp = imponibile;
nin_iva = imposta;
}
else if (sosp_imp != nessuna) // sospensione di imposta
else if (sosp_imp != nessuna_sospensione) // sospensione di imposta
{
if (tipomov == vendita)
{
@ -2075,7 +1938,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
switch (sosp_imp)
{
case normale:
case sospensione_normale:
assp_imp += asimp_imp;
assp_iva += asimp_iva;
// no regolarizzazioni e reverse charge
@ -2217,7 +2080,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
{
if (tipomov == vendita)
{
if (sosp_imp != normale && sosp_imp != vol_affari) // CM500308
if (sosp_imp != sospensione_normale && sosp_imp != vol_affari) // CM500308
{
if (tipoes_v == "B1")
esenti_c1 += imponibile;
@ -2396,7 +2259,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
*/
const bool sosp_vaf = sosp_imp == vol_affari;
const bool sosp_liq = sosp_imp == liquidazione;
bool ign = sosp_imp == normale || (fattrit && month != 13) || noninc;
bool ign = sosp_imp == sospensione_normale || (fattrit && month != 13) || noninc;
/*
* se liq == false gli importi non contano ai fini
@ -2931,8 +2794,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
// Somma i vari prorata calcolati per gli anni precedenti
prorata += prorata_precedente1 + prorata_precedente2;
prorata += prorata_diff;
/* if (!lia.get_bool("B7"))
prorata = ZERO; */
acquisti_iva -= prorata; // Rettifica acquisti_iva
fdiffinc_iva_acq -= prorata_diff; // Rettifica acquisti_iva differiti incassati
}
@ -3043,24 +2904,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
_pum->put("R12", esni_rimb);
_pum->put("R28", vendite_rev); // Vendite in reverse charge da escludere da prorata
/* Dal 2016 calcoliamo comunicazione annuale in cg5
_pum->put("R14", cessioni_cd1_1);
_pum->put("R15", cessioni_cd1_2);
_pum->put("R16", cessioni_cd1_3);
_pum->put("R17", cessioni_cd1_4);
_pum->put("R18", acquisti_cd2_1);
_pum->put("R19", acquisti_cd2_2);
_pum->put("R20", acquisti_cd2_3);
_pum->put("R21", acquisti_cd2_4);
_pum->put("R22", oroargento_cd3_1);
_pum->put("R23", oroargento_cd3_2);
_pum->put("R24", rottami_cd3_3);
_pum->put("R25", rottami_cd3_4);
_pum->put("R26", acquisti_cd2_5);
_pum->put("R27", cessioni_cd1_5);
_pum->put("R29", cessioni_cd1_1s); // cessioni in split
*/
_pam->put("R0", acquisti);
_pam->put("R1", vendite);
_pam->put("R6", assp_imp);
@ -3107,30 +2950,31 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
{
// My God! Che 2 palle riestrarre tutte le informazioni
const TString4 tipodoc = _mov->get(MOV_TIPODOC);
const bool intra = _rmoviva->get_bool(RMI_INTRA);
const int tipocr = _rmoviva->get_int(RMI_TIPOCR);
const bool intra = _rmoviva->get_bool(RMI_INTRA);
const int tipocr = _rmoviva->get_int(RMI_TIPOCR);
// A partire dalla versione 3.1 la gestione dell'IVA 11 non viene piu' supportata ...
// ... ergo non stiamo a gestire la indetraibilita' parziale
real percind;
const int tipodet = get_tipodet_from_rmi(_rmoviva->curr(), _mov->curr(), percind);
real imponibile = _rmoviva->get_real(RMI_IMPONIBILE);
real imposta = _rmoviva->get_real(RMI_IMPOSTA);
const int tipodet = get_tipodet_from_rmi(_rmoviva->curr(), _mov->curr(), percind);
real imponibile = _rmoviva->get_real(RMI_IMPONIBILE);
real imposta = _rmoviva->get_real(RMI_IMPOSTA);
if (is_split_payment(_mov->curr()))
imposta = ZERO;
const TString4 codiva = _iva->get("CODTAB");
if (is_split_payment(_mov->curr()))
imposta = ZERO;
const TString4 codiva = _iva->get("CODTAB");
const TString4 tipoiva = _iva->get("S1");
const real ali = _iva->get_real("R0");
const TString4 tipoes_v = _iva->get("S2");
const TString4 tipoes_a = _iva->get("S9");
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4
const TRectype& rcs = _cur->curr(LF_CAUSALI);
const bool autofattura = rcs.get_bool("AUTOFATT");
const bool valintra = rcs.get_bool("VALINTRA");
const bool intracom = rcs.get_bool("INTRACOM");
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
const bool corrisp = _reg->get_bool("B0");
const tiporeg tipomov = (tiporeg)_reg->get_long("I0");
const real ali = _iva->get_real("R0");
const TString4 tipoes_v = _iva->get("S2");
const TString4 tipoes_a = _iva->get("S9");
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4
const TRectype& rcs = _cur->curr(LF_CAUSALI);
const bool autofattura = rcs.get_bool("AUTOFATT");
const bool valintra = rcs.get_bool("VALINTRA");
const bool intracom = rcs.get_bool("INTRACOM");
const TRegistro & reg = cached_registro(_reg->curr());
const tipo_sospensione sosp_imp = reg.sospensione();
const bool corrisp = reg.corrispettivi();
const tiporeg tipomov = reg.tipo_registro();
const bool is_vendita = tipomov == vendita;
const bool is_acquisto = tipomov == acquisto;
@ -3169,12 +3013,12 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
}
}
if (sosp_imp == nessuna && tipodet == 0 && (tipocr == 2 || tipocr == 8))
if (sosp_imp == nessuna_sospensione && tipodet == 0 && (tipocr == 2 || tipocr == 8))
{
array.add(imposta,TAB11_R6,LF_TAB1100B);
}
if (sosp_imp == nessuna || sosp_imp == vol_affari)
if (sosp_imp == nessuna_sospensione || sosp_imp == vol_affari)
{
if (tipodoc == "BD" && tipodet == 9)
{
@ -3354,7 +3198,7 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
array.add(imponibile,TAB11_R9,LF_TAB1100B);
}
if (tipocr == 4 && tipodoc != "AF" && (sosp_imp == nessuna || sosp_imp == vol_affari))
if (tipocr == 4 && tipodoc != "AF" && (sosp_imp == nessuna_sospensione || sosp_imp == vol_affari))
array.add(imponibile,TAB11_EC112);
}
@ -3372,7 +3216,7 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
array.add(imposta,TAB11_L2BIS,LF_TAB1100B);
}
if (!autofattura && (sosp_imp == nessuna || sosp_imp == vol_affari) && intra && tipoes_v == "22")
if (!autofattura && (sosp_imp == nessuna_sospensione || sosp_imp == vol_affari) && intra && tipoes_v == "22")
array.add(imponibile,TAB11_E52);
if (_isagricolo && (tipodoc != "CR" && tipodoc != "SC" && tipodoc != "RF" && tipodoc != "FS"))
@ -4434,10 +4278,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
* false per ditte mensili e liq. annuale
* Ulteriormente smentito e rettificato
*/
// bool true_trim = (month == 3 || month == 6 || month == 9);
// if (_isintr && ( true_trim || (month == 12 && _isbenzinaro && _gest4)
// || (month == 13 && !(_isbenzinaro && _gest4)) )) // cambiato 2019
if (_isintr && (month == 3 || month == 6 || month == 9 || month == 12)) // non più in 13 || month ==13))
{
const real interesse = interesse_trimestrale(_month);
@ -4670,16 +4510,18 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
reg = *_pim_codreg;
look_iva(codiva); look_reg(reg);
tiva = _iva->get("S1");
const tiporeg treg = (tiporeg)_reg->get_long("I0");
const bool corrisp = _reg->get_bool("B0");
const tipo_sospensione simp = _reg->get_bool("B1") ? (tipo_sospensione)_reg->get_int("I9") : nessuna;
const TRegistro & reg = cached_registro(_reg->curr());
const tipo_sospensione simp = reg.sospensione();
const tiporeg treg = reg.tipo_registro();
const bool corrisp = reg.corrispettivi();
if ( // ESCLUSI:
strcmp(att, *_pim_codatt) != 0 ||
treg != vendita || // non vendite
tipocr == 4 || // cessioni beni ammortizzabili
tiva == "NS" || // non soggetti
simp == normale ||
simp == sospensione_normale ||
simp == liquidazione) // sospensione di imposta
continue;

View File

@ -119,7 +119,6 @@ bool TLiquidazione_app::is_date_ok(const TDate& d, int month, int liqmonth, int
const int regmonth = d.month();
const int regyear = d.year();
// if (regyear() != year) return false;
if (year < 1998 || _recalc_regis) // Vecchia selezione o calcolo progressivi per stampa registri bollati
{
if (regyear != year || regmonth > month)

View File

@ -597,10 +597,11 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
diffinciva_acq = tab->get_real("R33");
const bool is_rit= tipodet != 0 && month == 13 && !rit_imp.is_zero(); //Se fattura in ritardo con tipo detr. != 0 e si sta calcolando l'annuale
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
issosp |= (sosp_imp != nessuna); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: normale, vol_affari, liquidazione)
// ACHTUNG! Corrispettivi da ventileer possono ventilare ad un altro codiva; in tal caso si scrive quello
const TRegistro & reg = cached_registro(_reg->curr());
const tipo_sospensione sosp_imp = reg.sospensione();
issosp |= (sosp_imp != nessuna_sospensione); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: sospensione_normale, vol_affari, liquidazione)
// ACHTUNG! Corrispettivi da ventileer possono ventilare ad un altro codiva; in tal caso si scrive quello
if (corrisp && other.full())
{
look_iva(other);

View File

@ -31,8 +31,6 @@
#include <occas.h>
#include <unloc.h>
enum tipo_sospensione { nessuna, sospensione_normale, vol_affari, liquidazione };
inline TStampa_registri_app& app() { return (TStampa_registri_app&)main_app(); }
// Righe da saltare nel footer per evitare di scrivere sulla perforazione
@ -52,7 +50,10 @@ bool TStampa_registri_app::filter_func (const TRelation * r)
const bool regst = mov.get_bool(MOV_REGST);
if (regst) //il movimento e' gia'
return false; //stato stampato in forma definitiva
const tipo_sospensione ts = (tipo_sospensione)r->lfile("REG").get_int("I9");
const TRegistro & reg = cached_registro(codreg, annoiva);
const tipo_sospensione ts = reg.sospensione();
if (ts == liquidazione) // Movimento valido solo ai fini della liquidazione
return false;
}
@ -1207,7 +1208,7 @@ messaggio TStampa_registri_app::controlla_liquidazione()
lim.put("CODTAB", chiave);
if (lim.read() != NOERR || lim.get_bool("B0"))
{
if (lim.get_bool("B1")) // qui
if (lim.get_bool("B1"))
mesi_cal ="";
else
mesi_cal << itom(i) << '\n';
@ -1275,25 +1276,28 @@ bool TStampa_registri_app::controlla_mov()
{
TLocalisamfile mov (LF_MOV);
bool ok = true;
tiporeg tipo;
TRecnotype rec = _tabreg->recno();
for (mov.first(); ok && !mov.eof(); mov.next())
{
const TString4 reg = mov.get(MOV_REG);
if (reg.empty()) continue; //non e' un movimento iva
if (_stampa_tutti_i_registri)
tipo = cerca_reg (reg);
if ( (_stampa_tutti_i_registri && (tipo == vendita || tipo == acquisto || tipo == riepilogativo))
|| (!_stampa_tutti_i_registri && reg == _codreg) )
{
const TString4 codreg = mov.get(MOV_REG);
if (codreg.full())
{
const TDate datareg = mov.get_date(MOV_DATAREG);
const bool stampato = mov.get_bool(MOV_REGST);
if ( datareg.year() < _annoIVA )
{
const long numreg = mov.get_long(MOV_NUMREG);
if (!stampato)
ok = false;
const tiporeg tipo = cached_registro(codreg, datareg.year()).tipo_registro();
if (( _stampa_tutti_i_registri && (tipo == vendita || tipo == acquisto || tipo == riepilogativo)) ||
(!_stampa_tutti_i_registri && codreg == _codreg))
{
const bool stampato = mov.get_bool(MOV_REGST);
if (datareg.year() < _annoIVA)
{
// const long numreg = mov.get_long(MOV_NUMREG);
if (!stampato)
ok = false;
}
}
}
}
@ -1301,17 +1305,6 @@ bool TStampa_registri_app::controlla_mov()
return ok;
}
tiporeg TStampa_registri_app::cerca_reg(const TString& c)
{
tiporeg t = vendita;
TString8 cod; cod << _annoIVA << c;
_tabreg->zero();
_tabreg->put("CODTAB", cod);
if (_tabreg->read() == NOERR)
t = (tiporeg)_tabreg->get_int ("I0");
return t;
}
int TStampa_registri_app::stampa_prospetto_IVA(int rr, int tipo_prosp)
{
const bool print_prec = tipo_prosp == 1;

View File

@ -21,16 +21,6 @@ enum tipo_stampa {
rif_giornale = 4
};
enum tiporeg {
vendita = 1,
acquisto = 2,
riepilogativo = 3,
incassi = 4,
giornale = 5,
sociale = 6,
cespiti = 7
};
class TStampa_registri_app : public TPrintapp
{
TSorted_cursor * _cur;
@ -124,7 +114,6 @@ public:
void stampa_progressivi(TRiga_array&, TRigaiva_array&, tiporeg, const bool);
void set_choice_limits(TMask&);
void build_ditte_sheet(int flags);
tiporeg cerca_reg(const TString&);
void fine_mese();
void set_page_tot_reg();
void send_message(char,const TFilename&,int);

View File

@ -1,5 +1,6 @@
#include "cg4501.h"
#include "cg4500b.h"
#include "cglib.h"
#include <recarray.h>
#include <relation.h>
@ -13,6 +14,7 @@ bool TAp_iva::mask_annoiva (TMask_field& f, KEY k)
{
const int annoiva = f.mask().get_int(F_ANNOIVA);
const int annoivap = ini_get_int(CONFIG_DITTA, "cg", "AnLiIv");
if (annoivap > 0 && annoiva != annoivap + 1)
return f.error_box(FR("Il nuovo anno esercizio IVA deve essere %d"), (annoivap+1));
}
@ -112,14 +114,6 @@ bool TAp_iva::apertura_iva()
TCursor cur_reg(&reg, "", 1, &tabreg, &tabreg);
TRecnotype items = cur_reg.items();
/*cur_reg.freeze();
for (cur_reg = 0L; cur_reg.pos() < items; ++cur_reg)
{
const int tiporeg = tabreg.get_int("I0");
if ((tiporeg == 1) || (tiporeg == 2) || (tiporeg == 3) || (tiporeg==9))
reg.remove();
}
cur_reg.freeze(FALSE);*/
tabreg.zero();
tabreg.put ("CODTAB", _annop);
@ -128,8 +122,9 @@ bool TAp_iva::apertura_iva()
cur_reg.freeze();
for (cur_reg = 0L; cur_reg.pos() < items; ++cur_reg)
{
const int tiporeg = tabreg.get_int("I0");
if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg==3)||(tiporeg==9))
const tiporeg tipo = cached_registro(cur_reg.curr()).tipo_registro();
if ( (tipo == vendita) || (tipo == acquisto) || (tipo == riepilogativo) || (tipo == giornale_magazzino))
{
TString8 cod = tabreg.get("CODTAB");
cod.overwrite(annoiva);

View File

@ -547,7 +547,7 @@ bool TApertura_chiusura::set()
(*_cur) = 0L;
_sld->set_anno_es(_annoesch);
_sld->set_movprovv(FALSE);
_sld->set_tipo_saldo(chiusura);
_sld->set_tipo_saldo(saldo_chiusura);
_sld->set_movimentato(TRUE);
costi ();
@ -565,7 +565,7 @@ bool TApertura_chiusura::set()
_totale_saldo = ZERO;
_sld->set_anno_es(_annoesap);
_sld->set_tipo_saldo(apertura);
_sld->set_tipo_saldo(saldo_apertura);
_sld->set_movimentato(TRUE);
*_cur = 0l;

View File

@ -30,6 +30,7 @@
#endif
#ifndef __PROGIND_H
class TDocumento;
class TProgind;
#endif
@ -144,6 +145,46 @@ enum cgrowtypes
cgrowtype_spese = 'G' // Spese del saladaconto
};
enum tipo_sospensione
{
nessuna_sospensione,
sospensione_normale,
vol_affari,
liquidazione
};
enum tipobil
{
DataLimite = 1,
UltimaImmissione
};
enum tiposal
{
saldo_normale,
saldo_apertura,
saldo_chiusura
};
enum TTipo_data
{
Registrazione,
Competenza,
CostiRicavi
};
enum tiporeg
{
vendita = 1,
acquisto = 2,
riepilogativo = 3,
incassi = 4,
giornale = 5,
sociale = 6,
cespiti = 7,
giornale_magazzino = 9
};
inline bool check_mov(const int tipomovprovv, const TString & provvis)
{
return ((tipomovprovv & 0x1) && provvis.blank()) ||
@ -242,10 +283,13 @@ public:
virtual bool ok() const { return !_rec.empty(); }
int tipo() const;
const TString & codice() const { return _rec.get("CODTAB"); }
int tipo() const { return _rec.get_int("I0"); }
TipoIVA iva() const;
bool corrispettivi() const;
bool corrispettivi() const { return _rec.get_bool("B0");}
bool sospeso() const { return _rec.get_bool("B1");}
tiporeg tipo_registro() const { return (tiporeg) tipo(); }
tipo_sospensione sospensione() const { return sospeso() ? (tipo_sospensione) _rec.get_int("I9") : nessuna_sospensione; }
const TString& name() const;
int year() const;
TDate last_reg() const { return _rec.get_date("D2"); }
@ -254,7 +298,6 @@ public:
long protocol() const { return _rec.get_long("I5"); }
const TString& attivita() const { return _rec.get("S8"); }
bool agenzia_viaggi() const;
const TString& tipo_attivita() const;
bool attivita_mista() const { const char a = tipo_attivita()[0]; return a == 'E'; }
@ -271,6 +314,9 @@ public:
virtual ~TRegistro() {}
};
const TRegistro & cached_registro(const char * codreg, const int year = 0);
inline const TRegistro & cached_registro(const TRectype & reg) { return cached_registro(reg.get("CODTAB").smid(4), atoi(reg.get("CODTAB").sleft(4))); }
class TLibro_giornale : public TRegistro
{
public:
@ -287,8 +333,7 @@ class TCodiceIVA;
class TCausale : public TArray
{
TRectype _rec;
TRegistro _reg;
int _year;
TipoIVA _iva;
bool _corrisp;
char _sezione_clifo, _sezione_ritsoc, _sezione_ritfis, _sezione_revcharge, _provvisorio;
@ -313,8 +358,9 @@ public:
bool num_doc() const;
bool apertura() const;
bool chiusura() const;
bool sezionale() const;
bool valuta() const;
tiposal tipo_saldo() const { return apertura() ? saldo_apertura : (chiusura() ? saldo_chiusura : saldo_normale); } bool sezionale() const;
tipo_sospensione sospensione() const { return reg().sospensione(); }
bool valuta() const;
bool intra() const;
bool valintra() const;
bool soloiva() const;
@ -324,11 +370,11 @@ public:
bool ril_fat_em_ric() const;
bool datareg_prec() const;
char provvisorio() const { return _provvisorio; }
const TString& causale_collegata() const;
const TString& causale_reg_iva() const;
const TString& tipo_doc() const;
TRegistro& reg() const { return (TRegistro&)_reg; }
const TString & causale_collegata() const;
const TString & causale_reg_iva() const;
const TString & tipo_doc() const;
const TString & codice_registro() const { return _rec.get(CAU_REG); }
const TRegistro& reg() const { return cached_registro(codice_registro(), _year); }
TipoIVA iva() const { return _iva; }
int regime_speciale() const;
bool corrispettivi() const { return _corrisp; }
@ -362,6 +408,8 @@ public:
};
const TCausale & cached_causale(const char * codcaus, const int year = 0);
inline const TCausale & cached_causale(const TRectype & caus, const int year = 0) { return cached_causale(caus.get(CAU_CODCAUS), year); }
class TCodiceIVA : public TRectype
{
@ -548,10 +596,6 @@ public:
TRectype* saldi() const;
};
enum tipobil { DataLimite = 1, UltimaImmissione };
enum tiposal { normale, apertura, chiusura };
enum TTipo_data { Registrazione, Competenza, CostiRicavi };
const TDate get_date_mov(const TRectype & mov, TTipo_data tipo_data);
class TSaldo : public TObject
@ -962,17 +1006,26 @@ public:
const TRectype& cg(int i, bool create = true) const { return (const TRectype &) ((TRecord_array &) cg()).row(i, create); }
const TRectype& iva(int i, bool create = true) const { return (const TRectype &)((TRecord_array &) iva()).row(i, create); }
int cg_rows() const { return cg().rows(); }
int iva_rows() const { return iva().rows(); }
int iva_rows() const { return iva().rows(); }
bool solo_IVA() const { return iva_rows() > 0 && cg_rows() == 0; }
virtual int readat(TBaseisamfile& f, TRecnotype nrec, word lockop = _nolock);
virtual int read(TBaseisamfile & f, word op = _isequal, word lockop = _nolock);
virtual int readat(TRecnotype nrec, word lockop = _nolock);
virtual int read(word op = _isequal, word lockop = _nolock);
virtual int TMovimento_contabile::remove();
void adjust_rowtypes();
virtual TMovimento_contabile & copy(const TMovimento_contabile & mov);
virtual TObject* dup() const { return new TMovimento_contabile(*this); }
virtual TMovimento_contabile& operator =(const TMovimento_contabile& mov) { return copy(mov); }
virtual TRectype& operator =(const TRectype & mov);
void adjust_rowtypes();
real imponibile(const char * codiva = nullptr) const ;
real imposta(const char * codiva = nullptr) const ;
TMovimento_contabile();
TMovimento_contabile(const TMovimento_contabile& mov);
TMovimento_contabile(long numreg);
TMovimento_contabile(const TRectype& mov);
virtual ~TMovimento_contabile() {}
};
@ -1481,6 +1534,7 @@ public:
char tipo() const { return get_char(CLI_TIPOCF); }
long codice() const { return get_long(CLI_CODCF); }
int alleg() const { return get_int(CLI_ALLEG); }
bool ok() const { return !empty(); }
virtual int read(const TRectype& rec, word op = _isequal, word lockop = _nolock);
@ -1502,5 +1556,6 @@ public:
};
const TCli_for & cached_clifor(const char tipo, const long codice);
const TCli_for & cached_clifor(int file, const TRectype & rec);
#endif

View File

@ -50,13 +50,8 @@ bool TCausale::reread()
{
const TString4 cod = codice();
if (cod.full())
{
const int year = _reg.year();
if (year > 0)
return read(cod, year);
}
if (cod.full() && _year > 0)
return read(cod, _year);
return false;
}
@ -68,6 +63,7 @@ bool TCausale::read(const char* cod, int year)
_iva = iva_errata; // Delete misc info
_sezione_clifo = _sezione_ritsoc = _provvisorio = ' ';
_corrisp = false;
_year = year;
if (cod && *cod > ' ')
{
@ -89,18 +85,18 @@ bool TCausale::read(const char* cod, int year)
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
if (!ok && codreg.not_empty())
return error_box(FR("Non esiste il registro '%s' del %d"),
(const char*)codreg, year);
(const char*)codreg, year); */
calcIVA();
}
else
{
_iva = nessuna_iva; // Clear IVA data
_corrisp = false;
_reg.read("", year);
// _reg.read("", year);
}
return true;
@ -359,8 +355,9 @@ void TCausale::calcIVA()
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();
i = (TipoIVA) tpd.get_int("I0"); // IVA acquisti, vendite, generica
const TipoIVA ri = reg().iva();
if (i == iva_generica)
i = ri;
if (i != ri)
@ -915,18 +912,6 @@ TRegistro& TRegistro::operator =(const TRegistro& r)
return *this;
}
int TRegistro::tipo() const
{
const int t = _rec.get_int("I0");
return t;
}
bool TRegistro::corrispettivi() const
{
const bool c = _rec.get_bool("B0");
return c;
}
TipoIVA TRegistro::iva() const
{
TipoIVA i = (TipoIVA)tipo();
@ -1055,6 +1040,49 @@ bool TRegistro::update(long protiva, const TDate& datareg)
return updated;
}
///////////////////////////////////////////////////////////
// TCache_registri
///////////////////////////////////////////////////////////
class TCache_registri : public TCache
{
protected:
virtual TObject* key2obj(const char* key);
public:
const TRegistro & registro(const char* key, const int anno = 0);
TCache_registri() : TCache() { }
virtual ~TCache_registri() { }
};
TObject* TCache_registri::key2obj(const char* key)
{
TToken_string k(key);
TString16 cod;
k.get(0, cod);
cod.trim();
int year;
k.get(1, year);
return new TRegistro(cod, year);
}
const TRegistro & TCache_registri::registro(const char* key, const int anno)
{
TToken_string k(key);
k.add(anno);
return (const TRegistro &)*objptr(k);
}
const TRegistro & cached_registro(const char * codreg, int year)
{
HIDDEN TCache_registri __cache_registri;
return __cache_registri.registro(codreg, year);
}
///////////////////////////////////////////////////////////
// Libro giornale
///////////////////////////////////////////////////////////

View File

@ -804,7 +804,7 @@ void TTab_conti::aggiorna_conto(const TBill& tcon,
}
else
{
if (movap == apertura)
if (movap == saldo_apertura)
{
if (importo.sezione() == 'D')
tc->saldo() += i;
@ -813,7 +813,7 @@ void TTab_conti::aggiorna_conto(const TBill& tcon,
}
else
{
if (movap == chiusura)
if (movap == saldo_chiusura)
{
if (importo.sezione() == 'D')
tc->saldofin() += i;
@ -846,7 +846,7 @@ void TTab_conti::aggiorna_conto(const TBill& tcon,
///////////////////////////////////////////////////////////
TSaldo_agg::TSaldo_agg() : _anno_es(0), _data_ulmov(""), _num_ulmov(0l),
_movap(normale), _provv(' '), _movimentato(false)
_movap(saldo_normale), _provv(' '), _movimentato(false)
{}
void TSaldo_agg::aggiorna(const TBill& tc, const TImporto& imp, bool somma, bool scaricato)

View File

@ -211,10 +211,8 @@ bool is_IVAxCassa(const TRectype& mov)
{
if (mov.get_bool(MOV_LIQDIFF) || !mov.get_bool(MOV_IVAXCASSA))
return false;
if (!mov_has_imposte(mov))
return false;
const TDate data_reg = mov.get(MOV_DATAREG);
// const TDate data_doc = mov.get(MOV_DATADOC);
// const TDate data_rif = data_doc.ok() && data_doc < data_reg ? data_doc : data_reg;

View File

@ -89,9 +89,34 @@ TMovimento_contabile::TMovimento_contabile()
add_file(LF_RMOVIVA, RMV_NUMRIG);
}
int TMovimento_contabile::readat(TBaseisamfile& f, TRecnotype nrec, word lockop)
TMovimento_contabile::TMovimento_contabile(const TMovimento_contabile& mov)
: TMultiple_rectype(LF_MOV), _old_iva(LF_RMOVIVA, RMI_NUMRIG)
{
const int err = TMultiple_rectype::readat(f, nrec, lockop);
copy(mov);
}
TMovimento_contabile::TMovimento_contabile(long numreg)
: TMultiple_rectype(LF_MOV), _old_iva(LF_RMOVIVA, RMI_NUMRIG)
{
add_file(LF_RMOV, RMV_NUMRIG);
add_file(LF_RMOVIVA, RMV_NUMRIG);
put(MOV_NUMREG, numreg);
read(_isequal, _nolock);
}
TMovimento_contabile::TMovimento_contabile(const TRectype& mov)
: TMultiple_rectype(LF_MOV), _old_iva(LF_RMOVIVA, RMI_NUMRIG)
{
add_file(LF_RMOV, RMV_NUMRIG);
add_file(LF_RMOVIVA, RMV_NUMRIG);
*this = mov;
read(_isequal, _nolock);
}
int TMovimento_contabile::readat(TRecnotype nrec, word lockop)
{
TLocalisamfile f(LF_MOV);
const int err = TMultiple_rectype::readat(f, nrec, lockop);
if (err == NOERR)
{
@ -110,9 +135,9 @@ int TMovimento_contabile::readat(TBaseisamfile& f, TRecnotype nrec, word lockop)
return err;
}
int TMovimento_contabile::read(TBaseisamfile & f, word op, word lockop)
int TMovimento_contabile::read( word op, word lockop)
{
const int err = TMultiple_rectype::read(f, op, lockop);
const int err = TMultiple_rectype::read(op, lockop);
if (err == NOERR)
{
@ -255,6 +280,21 @@ int TMovimento_contabile::write_rewrite(TBaseisamfile& f, bool re) const
return err;
}
TMovimento_contabile& TMovimento_contabile::copy(const TMovimento_contabile & mov)
{
TMultiple_rectype::operator=((TMultiple_rectype &)mov);
_old_iva = mov._old_iva;
_olddataliq = mov._olddataliq;
return *this;
}
TRectype & TMovimento_contabile::operator =(const TRectype & mov)
{
return TMultiple_rectype::operator=(mov);
}
void TMovimento_contabile::find_movcoll()
{
if (get_long(MOV_MOVCOLL) == 0L)

33
src/include/bagn010.h Normal file
View File

@ -0,0 +1,33 @@
#define F_KEYFIELD1 201
#define F_KEYFIELD2 202
#define F_KEYFIELD3 203
#define F_KEYFIELD4 204
#define F_KEYFIELD5 205
#define F_KEYFIELD6 206
#define F_KEYFIELD7 207
#define F_KEYFIELD8 208
#define F_KEYFIELD9 209
#define F_KEYFIELD10 210
#define F_KEYFIELD11 211
#define F_KEYFIELD12 212
#define F_KEYFIELD13 213
#define F_KEYFIELD14 214
#define F_KEYFIELD15 215
#define F_KEYFIELD16 216
#define F_KEYFIELD17 217
#define F_KEYFIELD18 218
#define F_KEYFIELD19 219
#define F_KEYFIELD20 220
#define F_DATALIM 221 // DATA
#define F_ORALIM 222 // ORA
#define F_PRINT 250
#define F_REPLAY 251
#define F_SHEET 300
#define F_DATA 101 // DATA
#define F_ORA 102 // ORA
#define F_USER 103 // USER
#define F_SESSION 104 // SESSION
#define F_CONTENT 105 //TRANS

234
src/include/bagn010.uml Normal file
View File

@ -0,0 +1,234 @@
#include <bagn010.h>
//maschera del log
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK
BEGIN
PROMPT -14 -1 ""
END
BUTTON F_PRINT
BEGIN
PROMPT -24 -1 "~Stampa"
PICTURE TOOL_PRINT
END
BUTTON F_REPLAY
BEGIN
PROMPT -34 -1 "~Ricostruisci"
PICTURE TOOL_RECALC
END
BUTTON DLG_CANCEL
BEGIN
PROMPT -44 -1 ""
END
ENDPAGE
PAGE "Log delle transazioni" 0 0 0 0
GROUPBOX DLG_NULL 0 12
BEGIN
PROMPT 3 1 "Chiave"
END
STRING F_KEYFIELD1 30
BEGIN
PROMPT 2 2 "Campo 1 "
FLAGS "D"
END
STRING F_KEYFIELD2 30
BEGIN
PROMPT 42 2 "Campo 2 "
FLAGS "D"
END
STRING F_KEYFIELD3 30
BEGIN
PROMPT 2 3 "Campo 3 "
FLAGS "D"
END
STRING F_KEYFIELD4 30
BEGIN
PROMPT 42 3 "Campo 4 "
FLAGS "D"
END
STRING F_KEYFIELD5 30
BEGIN
PROMPT 2 4 "Campo 5 "
FLAGS "D"
END
STRING F_KEYFIELD6 30
BEGIN
PROMPT 42 4 "Campo 6 "
FLAGS "D"
END
STRING F_KEYFIELD7 30
BEGIN
PROMPT 2 5 "Campo 7 "
FLAGS "D"
END
STRING F_KEYFIELD8 30
BEGIN
PROMPT 42 5 "Campo 8 "
FLAGS "D"
END
STRING F_KEYFIELD9 30
BEGIN
PROMPT 2 6 "Campo 9 "
FLAGS "D"
END
STRING F_KEYFIELD10 30
BEGIN
PROMPT 42 6 "Campo 10 "
FLAGS "D"
END
STRING F_KEYFIELD11 30
BEGIN
PROMPT 2 7 "Campo 11 "
FLAGS "D"
END
STRING F_KEYFIELD12 30
BEGIN
PROMPT 42 7 "Campo 12 "
FLAGS "D"
END
STRING F_KEYFIELD13 30
BEGIN
PROMPT 2 8 "Campo 13 "
FLAGS "D"
END
STRING F_KEYFIELD14 30
BEGIN
PROMPT 42 8 "Campo 14 "
FLAGS "D"
END
STRING F_KEYFIELD15 30
BEGIN
PROMPT 2 9 "Campo 15 "
FLAGS "D"
END
STRING F_KEYFIELD16 30
BEGIN
PROMPT 42 9 "Campo 16 "
FLAGS "D"
END
STRING F_KEYFIELD17 30
BEGIN
PROMPT 2 10 "Campo 17 "
FLAGS "D"
END
STRING F_KEYFIELD18 30
BEGIN
PROMPT 42 10 "Campo 18 "
FLAGS "D"
END
STRING F_KEYFIELD19 30
BEGIN
PROMPT 2 11 "Campo 19 "
FLAGS "D"
END
STRING F_KEYFIELD20 30
BEGIN
PROMPT 42 11 "Campo 20 "
FLAGS "D"
END
DATE F_DATALIM
BEGIN
PROMPT 2 13 "Data "
END
STRING F_ORALIM 8
BEGIN
PROMPT 20 13 "Ora"
END
SPREADSHEET F_SHEET
BEGIN
PROMPT 0 15 "Lista"
ITEM "Data@10"
ITEM "Ora@8"
ITEM "Utente@50"
ITEM "Sessione"
ITEM "Conutento@200"
FLAGS "R"
END
ENDPAGE
ENDMASK
PAGE "Transazione" 0 0 0 0
DATE F_DATA
BEGIN
PROMPT 2 2 "Data "
FIELD DATA
END
STRING F_ORA 8
BEGIN
PROMPT 2 4 "Ora "
FIELD ORA
END
STRING F_USER 100 60
BEGIN
PROMPT 2 6 "Utente "
FIELD USER
END
NUMBER F_SESSION 4
BEGIN
PROMPT 2 8 "Sessione "
FIELD SESSION
END
ZOOM F_CONTENT 60
BEGIN
PROMPT 2 10 "Transazione "
FIELD TRANS
END
ENDPAGE
TOOLBAR "topbar" 0 0 0 2
BUTTON DLG_OK
BEGIN
PROMPT -13 -1 ""
END
BUTTON F_PRINT
BEGIN
PROMPT -23 -1 "Stampa"
PICTURE TOOL_PRINT
END
BUTTON DLG_CANCEL
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -1018,6 +1018,18 @@ bool ini_set_string(int cfg, const char* paragraph, const char* name, const char
return ini_set_string(filename, paragraph, name, val, idx);
}
const TDate ini_get_date(int cfg, const char* paragraph, const char* name, const char* defval, int idx)
{
DECLARE_FILENAME(cfg);
return TDate(ini_get_string(filename, paragraph, name, defval, idx));
}
const real ini_get_real(int cfg, const char* paragraph, const char* name, const char* defval, int idx)
{
DECLARE_FILENAME(cfg);
return real(ini_get_string(filename, paragraph, name, defval, idx));
}
bool ini_remove(int cfg, const char* para, const char* name, int idx)
{
DECLARE_FILENAME(cfg);

View File

@ -202,6 +202,8 @@ void ini_del_memo (const char* file, const char* para, const char* name);
bool ini_get_bool (int cfg, const char* para, const char* name, bool defval = false, int idx = -1);
int ini_get_int (int cfg, const char* para, const char* name, int defval = 0, int idx = -1);
const TString& ini_get_string(int cfg, const char* para, const char* name, const char* defval = "", int idx = -1);
const TDate ini_get_date (int cfg, const char* para, const char* name, const char* defval = "", int idx = -1);
const real ini_get_real (int cfg, const char* para, const char* name, const char* defval = "", int idx = -1);
bool ini_set_bool (int cfg, const char* para, const char* name, bool val, int idx = -1);
bool ini_set_int (int cfg, const char* para, const char* name, int val, int idx = -1);
bool ini_set_string(int cfg, const char* para, const char* name, const char* val, int idx = -1);

View File

@ -1,3 +1,3 @@
182
0
$dblog|||319|0|Log Transazioni|||
$dblog|0|0|404|0|Log Transazioni|||

View File

@ -12,7 +12,7 @@ RELEASE|2|3|0|Release
TAG|2|4|0|Tag
PATCH|1|4|0|Patch
CMD|2|1|0|Comando
USER|1|15|0|Utente
USER|1|100|0|Utente
SESSION|2|4|0|Sessione
TRANS|11|10|0|Transazione
2

View File

@ -202,7 +202,6 @@ public:
WINDOW page_win(int p) const;
// @cmember Ritorna la finestra della pagina corrente
WINDOW curr_win() const;
// @cmember Ritorna il nome del file contentente la maschera
const TFilename& source_file() const { return _source_file; }

View File

@ -117,6 +117,7 @@ public:
virtual int read(word op = _isequal, word lockop = _nolock) { TLocalisamfile f(num()); return read(f, op, lockop); }
// @cmember Legge il file <p f> con il tipo di record alla posizione desiderata
virtual int readat(TBaseisamfile& f, TRecnotype nrec, word lockop = _nolock);
virtual int readat(TRecnotype nrec, word lockop = _nolock) { TLocalisamfile f(num()); return readat(f, lockop); }
virtual int read(TBaseisamfile & f, word op = _isequal, word lockop = _nolock);
virtual int write(TBaseisamfile& f) const { return write_rewrite(f);}