Merge branch 'R12.00.1136' of http://10.65.20.33/sirio/CAMPO/campo into R12.00.1136

This commit is contained in:
smen 2022-05-02 11:05:20 +02:00
commit cfe082f8b0
14 changed files with 377 additions and 110 deletions

4
cd/test/cg1138.txt Normal file
View File

@ -0,0 +1,4 @@
cg4.exe
Corretta imputazione quadro VT ora viene usato il comune dell'unità locale
corretto calcolo imponibile nel caso di fatture pagate nel periodo in acluni casi aggiungieva l'imonibile 2 volte

98
cd/test/cg1138a.ini Normal file
View File

@ -0,0 +1,98 @@
[Main]
Demo=0
[cg4]
File(84) = cg4.exe|X
Patch = 1138
Versione = 21511200
[cg99]
Kill(0) = bastdpn.msk|x
Kill(1) = batbins.msk|x
Kill(2) = batbvet.msk|x
Kill(3) = bastcve.msk|x
Kill(4) = batbver.msk|x
Kill(5) = bastnot.rep|x
Kill(6) = batbcfi.msk|x
Kill(7) = batbtra.msk|x
Kill(8) = batbscc.msk|x
Kill(9) = bastcfi.msk|x
Kill(10) = bastdpn.rep|x
Kill(11) = bastpdb.rep|x
Kill(12) = bastzon.rep|x
Kill(13) = batbind.msk|x
Kill(14) = bastzon.msk|x
Kill(15) = batbdel.msk|x
Kill(16) = batbleg.msk|x
Kill(17) = bastleg.msk|x
Kill(18) = bastscc.rep|x
Kill(19) = bastesc.rep|x
Kill(20) = bastcco.msk|x
Kill(21) = cgtbcon.msk|x
Kill(22) = cg2fppro.msk|x
Kill(23) = bastreg.rep|x
Kill(24) = bastcam.rep|x
Kill(25) = bastcam.msk|x
Kill(26) = bastivd.rep|x
Kill(27) = batbndo.msk|x
Kill(28) = bastvet.rep|x
Kill(29) = bastndo.msk|x
Kill(30) = batbcve.msk|x
Kill(31) = bastivd.msk|x
Kill(32) = bastarb.msk|x
Kill(33) = bastmsp.msk|x
Kill(34) = batbntb.msk|x
Kill(35) = bastscc.msk|x
Kill(36) = bastver.msk|x
Kill(37) = batbesc.msk|x
Kill(38) = bastleg.rep|x
Kill(39) = bastver.rep|x
Kill(40) = batbtit.msk|x
Kill(41) = batbmsp.msk|x
Kill(42) = batblia.msk|x
Kill(43) = bastntb.rep|x
Kill(44) = batbcam.msk|x
Kill(45) = bastcco.rep|x
Kill(46) = batbcco.msk|x
Kill(47) = bastnot.msk|x
Kill(48) = batbinl.msk|x
Kill(49) = bastarb.rep|x
Kill(50) = batbivd.msk|x
Kill(51) = bastntb.msk|x
Kill(52) = bastreg.msk|x
Kill(53) = batblia.msk|x
Kill(54) = bastpor.msk|x
Kill(55) = bastvet.msk|x
Kill(56) = bastcfi.rep|x
Kill(57) = bastpor.rep|x
Kill(58) = bastpdb.msk|x
Kill(59) = bastesc.msk|x
Kill(60) = batbdpn.msk|x
Kill(61) = batblbu.msk|x
Kill(62) = bastcve.rep|x
Kill(63) = bastndo.rep|x
Kill(64) = batbpdb.msk|x
Kill(65) = batbzon.msk|x
Kill(66) = batbnot.msk|x
Kill(67) = batbarb.msk|x
Kill(68) = batbpor.msk|x
Kill(69) = bastmsp.rep|x
Kill(70) = batbreg.msk|x
[cg]
Data = 21-04-2022
Descrizione = Contabilita' Generale
Dischi = 1
Edit_19 = cg0 -0
Edit_20 = cg0 -1
Edit_26 = cg0 -4
Edit_5 = cg0 -5
Moduli = ba
OEM =
Patch = 1138
PostProcess = bainst -0 CG
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/cg1138a1.zip Normal file

Binary file not shown.

4
cd/test/ve1138.txt Normal file
View File

@ -0,0 +1,4 @@
ve4300a.msk
ve4.exe
Corretto bug "Controllo IBAN da documenti". mancava la maschera

130
cd/test/ve1138a.ini Normal file
View File

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

BIN
cd/test/ve1138a1.zip Normal file

Binary file not shown.

View File

@ -16,6 +16,7 @@
#include <nditte.h> #include <nditte.h>
#include <attiv.h> #include <attiv.h>
#include <unloc.h>
#include <causali.h> #include <causali.h>
#include <tab1100.h> #include <tab1100.h>
#include <mov.h> #include <mov.h>
@ -35,19 +36,21 @@
#ifdef DBG #ifdef DBG
#define _BREAK(func, par, values) func(par, values); #define _BREAK(func, par, values) func(par, values);
#define BREAK_DBG _BREAK(check_nreg, __nreg, __values) #define BREAK_NREG _BREAK(check_nreg, __nreg, __nregs)
#define LOAD_VAL load_values() #define BREAK_CODIVA(codiva) _BREAK(check_codiva, codiva, __codivas)
#define LOAD_VAL(sel) load_values(sel)
const char * load_values() const char * load_values(int selector)
{ {
TFilename dbgname; TFilename dbgname;
TFilename filename("dbg"); TFilename filename("dbg");
const char * names[] = { "NReg", "CodIVA"};
filename << main_app().name(); filename << main_app().name();
dbgname.currdir(); dbgname.currdir();
dbgname.add(filename); dbgname.add(filename);
dbgname.ext("ini"); dbgname.ext("ini");
return ini_get_string(dbgname, "Main", "Values"); return ini_get_string(dbgname, "Main", names[selector]);
} }
bool check_nreg(TToken_string &nreg, TToken_string &values) bool check_nreg(TToken_string &nreg, TToken_string &values)
@ -61,8 +64,20 @@ bool check_nreg(TToken_string &nreg, TToken_string &values)
} }
return false; return false;
} }
bool check_codiva(const TString4 &codiva, TToken_string &values)
{
FOR_EACH_TOKEN(values, val)
{
if (codiva == val)
return true;
}
return false;
}
#else #else
#define BREAK_DBG #define BREAK_NREG
#define BREAK_CODIVA
#endif #endif
bool TLiquidazione_app::recalc_all() bool TLiquidazione_app::recalc_all()
@ -338,7 +353,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
TString8 cattiv(codatt); TString8 cattiv(codatt);
cattiv << tipoatt; cattiv << tipoatt;
const bool waspla = look_pla(cattiv); // perchè sta cosa ) , has_single_activity); const bool waspla = look_pla(cattiv, has_single_activity);
if (!waspla) if (!waspla)
break; // Non calcolare attività inesistenti 29-11-2012 break; // Non calcolare attività inesistenti 29-11-2012
@ -1148,10 +1163,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
TDate date = _mov->get(MOV_DATAREG); TDate date = _mov->get(MOV_DATAREG);
#ifdef DBG #ifdef DBG
TToken_string __nreg = _mov->get(MOV_NUMREG); TToken_string __nreg = _mov->get(MOV_NUMREG);
TToken_string __values = LOAD_VAL; TToken_string __nregs = LOAD_VAL(0);
TToken_string __codivas = LOAD_VAL(1);
#endif #endif
BREAK_DBG; BREAK_NREG;
const int liqmonth = _mov->get_int(MOV_MESELIQ); const int liqmonth = _mov->get_int(MOV_MESELIQ);
const TString4 reg = _mov->get("REG"); const TString4 reg = _mov->get("REG");
const bool isreg = look_reg(reg); const bool isreg = look_reg(reg);
@ -1199,7 +1215,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
TPartite_array arrpart; // Partite interessate TPartite_array arrpart; // Partite interessate
TPointer_array pagscatt; // Righe di pagsca interessate TPointer_array pagscatt; // Righe di pagsca interessate
BREAK_DBG; BREAK_NREG;
if (fattrit) if (fattrit)
dok = (atoi(_year) == datadoc.year()) && _month == 13; dok = (atoi(_year) == datadoc.year()) && _month == 13;
@ -1221,7 +1237,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
bool game_found = false; bool game_found = false;
TImporto residuo; TImporto residuo;
BREAK_DBG; BREAK_NREG;
if (has_sc) if (has_sc)
{ {
arrpart.add_numreg(numreg); arrpart.add_numreg(numreg);
@ -1253,13 +1269,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
bool regular_month = orizzonte >= date; bool regular_month = orizzonte >= date;
bool first_month = regular_month && date > inizio + 1L; bool first_month = regular_month && date > inizio + 1L;
BREAK_DBG; BREAK_NREG;
#ifdef DBG
if (rp.get_long(PART_NREG) == 100616)
int i = 1;
#endif
flag_pg_nc = rp.calcola_pagato_periodo(first_month ? botime : inizio + 1L, orizzonte, pg_per, nc_per, &pagscatt) && regular_month; flag_pg_nc = rp.calcola_pagato_periodo(first_month ? botime : inizio + 1L, orizzonte, pg_per, nc_per, &pagscatt) && regular_month;
residuo += pg_per; if (IMPORTO_NON_ZERO(residuo))
residuo += pg_per;
if (pagscatt.items() >= 2) if (pagscatt.items() >= 2)
{ {
// Fondo tra loro le righe generate dallo stesso pagamento // Fondo tra loro le righe generate dallo stesso pagamento
@ -1304,7 +1317,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (ps == obj) if (ps == obj)
{ {
found = true; found = true;
BREAK_DBG; BREAK_NREG;
} }
} }
if (!found) if (!found)
@ -1367,7 +1380,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
datainc = data_end_cassa; datainc = data_end_cassa;
#ifdef DBG #ifdef DBG
else else
BREAK_DBG; BREAK_NREG;
#endif #endif
_mov->put(MOV_DATAINC, datainc); _mov->put(MOV_DATAINC, datainc);
if (datainc < date) if (datainc < date)
@ -1450,10 +1463,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
real nin_iva = ZERO; // imposta non incassati real nin_iva = ZERO; // imposta non incassati
const TString4 codiva = _rmoviva->get(RMI_CODIVA); const TString4 codiva = _rmoviva->get(RMI_CODIVA);
TCodiceIVA civa(codiva); const TCodiceIVA& civa = cached_codIVA(codiva);
#ifdef DBG #ifdef DBG
BREAK_DBG; BREAK_NREG;
if (tipomov == vendite) if (tipomov == vendite)
int i = 1; int i = 1;
if (!bIsMovDiff && (civa.percentuale() == 20)) if (!bIsMovDiff && (civa.percentuale() == 20))
@ -1466,17 +1479,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
continue; continue;
} }
look_iva(codiva); // da eliminare esso per evitare un problema di non lettura _iva ve eliminato const TString4 tipoiva = civa.tipo();
const TString4 tipoiva = _iva->get("S1"); const TString4 tipoes_v = civa.IVA11_vendite();
const TString4 tipoes_v = _iva->get("S2"); const TString4 tipoes_a = civa.IVA11_acquisti();
const TString4 tipoes_a = _iva->get("S9"); const int tipoagr = civa.tipo_IVA_agricola(); // 2/9/2015 was S4
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4 const int tipoag = civa.tipo_agenzie_viaggio();
const int tipoag = _iva->get_int("S5"); const int tipopla = civa.tipo_plafond();
const int tipopla = _iva->get_int("S3"); int isrimbinfr = civa.codice_rimborso_infrannuale(); // vale per calcolo rimborso se ES o NI
int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI const real perciva = civa.moltiplicatore_percentuale();
const real perciva = _iva->get_real("R0") / CENTO; int ivarimb = !civa.escluso_dal_rimborso(); // non escluso calcolo rimb. per al. media
int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media const bool den_prorata = civa.tipo_IVA_agricola(); // denominatore prorata nel caso di calcolo pro rata con numeratore e denominatore
const bool den_prorata = _iva->get_bool("B7"); // denominatore prorata nel caso di calcolo pro rata con numeratore e denominatore
const TString4 tipocr_s = _rmoviva->get(RMI_TIPOCR); const TString4 tipocr_s = _rmoviva->get(RMI_TIPOCR);
const int tipocr = atoi(tipocr_s); const int tipocr = atoi(tipocr_s);
@ -1528,7 +1540,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
const TCli_for & clifo = cached_clifor(LF_MOV, _mov->curr()); const TCli_for & clifo = cached_clifor(LF_MOV, _mov->curr());
const int tp = clifo.alleg(); const int tp = clifo.alleg();
BREAK_DBG; BREAK_NREG;
if ((soloiva && if ((soloiva &&
(caus_reg.objptr(codcaus) != NULL || tp < 1)) && (caus_reg.objptr(codcaus) != NULL || tp < 1)) &&
sosp_imp != vol_affari) sosp_imp != vol_affari)
@ -1551,15 +1563,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
real diff_ivar = (is_detr_diff == 0) ? impos_det : impos_ind; real diff_ivar = (is_detr_diff == 0) ? impos_det : impos_ind;
real diff_totr = diff_impr + diff_ivar; real diff_totr = diff_impr + diff_ivar;
if (diff_totr == ZERO) if (diff_totr == ZERO)
continue; continue;
BREAK_CODIVA(codiva);
TDate datafat = _mov->get_date(MOV_DATAREG); TDate datafat = _mov->get_date(MOV_DATAREG);
long numreg = _rmoviva->get_long(RMI_NUMREG); 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") if (is_detr_diff == 1 || civa.iva_non_soggetta())
continue; continue;
if (bIsMovDiff && tm == tm_fattura) if (bIsMovDiff && tm == tm_fattura)
{ {
@ -1567,7 +1581,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
int mesereg = liqmonth == 0 ? datareg.month() : liqmonth; int mesereg = liqmonth == 0 ? datareg.month() : liqmonth;
bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year()); bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year());
BREAK_DBG; BREAK_NREG;
if (ok) if (ok)
{ {
datafat = datareg; datafat = datareg;
@ -1876,28 +1890,28 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (tipoiva.empty() && codcf != 0) if (tipoiva.empty() && codcf != 0)
{ {
TString8 key; key.format("%c|%ld", _mov->get_char(MOV_TIPO), codcf); TToken_string key; key.format("%c|%ld", _mov->get_char(MOV_TIPO), codcf);
const TRectype& clifo = cache().get(LF_CLIFO, key); const TRectype& clifo = cache().get(LF_CLIFO, key);
int codreg = 0; // codice regione x privati 22 == partite iva 0 == senza codice int codreg = 0; // codice regione x privati 22 == partite iva 0 == senza codice
const int tipoalleg = clifo.get_int(CLI_ALLEG); const int tipoalleg = clifo.get_int(CLI_ALLEG);
if (tipoalleg == 6) // privato if (tipoalleg == 6) // privato
{ {
if (clifo.get_bool(CLI_OCCAS)) key.cut(0);
{ key.add(get_firm());
const TString& key_occ = _mov->get(MOV_OCFPI);
const TRectype& occas = cache().get(LF_OCCAS, key_occ); int unloc = _reg->get_int("I7");
key = occas.get(OCC_STATO); if (unloc == 0)
key << "|" << occas.get(OCC_COM); unloc = 1;
} key.add(unloc);
else
{ const TRectype & runloc = cache().get(LF_UNLOC, key);
key = clifo.get(CLI_STATOCF);
key << "|" << clifo.get(CLI_COMCF); key.format("|%s", (const char *)runloc.get(ULC_COMULC));
}
const TRectype& comune = cache().get(LF_COMUNI, key); const TRectype& comune = cache().get(LF_COMUNI, key);
codreg = comune.get_int(COM_CODREG) + 1; codreg = comune.get_int(COM_CODREG) + 1;
} }
@ -1918,7 +1932,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
bool bMovDiffToAdd = true; bool bMovDiffToAdd = true;
#ifdef DBG #ifdef DBG
BREAK_DBG; BREAK_NREG;
if (!bIsMovDiff && (civa.percentuale() == 20)) if (!bIsMovDiff && (civa.percentuale() == 20))
real p = imposta_orig / imponibile_orig * CENTO; real p = imposta_orig / imponibile_orig * CENTO;
#endif #endif
@ -2221,8 +2235,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (_pcon_1_r->get_int(PCN_INDBIL) == 4) if (_pcon_1_r->get_int(PCN_INDBIL) == 4)
if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ? if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ?
{ {
if (look_iva(_pcon_2_r->get(PCN_IVACOMP))) const TCodiceIVA & civa = cached_codIVA(_pcon_2_r->get(PCN_IVACOMP));
ivacomp = _iva->get("CODTAB"); // Ecco il codice IVA di compensazione
if (civa.ok())
ivacomp = civa.codice(); // Ecco il codice IVA di compensazione
} }
look_pia(month, codatt, codiva, ivacomp, true); // Crea il record in tabella se non esiste look_pia(month, codatt, codiva, ivacomp, true); // Crea il record in tabella se non esiste
real pia_imp = _pia->get_real("R0") + agr_imp; // Aggiorna... real pia_imp = _pia->get_real("R0") + agr_imp; // Aggiorna...
@ -2687,7 +2703,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (diff_imp > ZERO) if (diff_imp > ZERO)
int i = 1; int i = 1;
tab->curr().add("R30", diff_imp); tab->curr().add("R30", diff_imp);
tab->curr().add("R31", diff_iva); tab->curr().add("R31", diff_iva);
tab->curr().add("R32", incdiff_imp); tab->curr().add("R32", incdiff_imp);
tab->curr().add("R33", incdiff_iva); tab->curr().add("R33", incdiff_iva);
fdiff_imp_acq += diff_imp; fdiff_imp_acq += diff_imp;
@ -2727,11 +2743,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (_pim->get_bool("B4")) if (_pim->get_bool("B4"))
{ {
// ricalcola l'imposta a partire dal codice IVA // ricalcola l'imposta a partire dal codice IVA
look_iva(*_pim_codiva); const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
real old_iva = _pim->get_real("R1"); const real old_iva = _pim->get_real("R1");
real perc = _iva->get_real("R0"); real new_iva = _pim->get_real("R0") * civa.moltiplicatore_percentuale();
real new_iva = _pim->get_real("R0") * perc / CENTO;
round_al_centesimo(new_iva); round_al_centesimo(new_iva);
if (new_iva != old_iva) if (new_iva != old_iva)
@ -2759,10 +2774,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (_pia->get_bool("B0")) if (_pia->get_bool("B0"))
{ {
// calcola l'imposta a partire dal codice IVA di compensazione // calcola l'imposta a partire dal codice IVA di compensazione
look_iva(*_pia_codcom); const TCodiceIVA & civa = cached_codIVA(*_pia_codcom);
real perc = _iva->get_real("R0"); real iva = _pia->get_real("R0") * civa.moltiplicatore_percentuale();
real iva = _pia->get_real("R0") * perc / CENTO;
round_al_centesimo(iva); round_al_centesimo(iva);
agr_detIA += iva; agr_detIA += iva;
_pia->put("R1",iva); _pia->put("R1",iva);
@ -2994,12 +3008,14 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
if (is_split_payment(_mov->curr())) if (is_split_payment(_mov->curr()))
imposta = ZERO; imposta = ZERO;
const TString4 codiva = _iva->get("CODTAB");
const TString4 tipoiva = _iva->get("S1"); const TCodiceIVA & civa = cached_codIVA(_rmoviva->get(RMI_CODIVA));
const real ali = _iva->get_real("R0"); const TString4 codiva = civa.codice();
const TString4 tipoes_v = _iva->get("S2"); const TString4 tipoiva = civa.tipo();
const TString4 tipoes_a = _iva->get("S9"); const real ali = civa.percentuale();
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4 const TString4 tipoes_v = civa.IVA11_vendite();
const TString4 tipoes_a = civa.IVA11_acquisti();
const int tipoagr = civa.tipo_IVA_agricola(); // 2/9/2015 was S4
const TRectype& rcs = _cur->curr(LF_CAUSALI); const TRectype& rcs = _cur->curr(LF_CAUSALI);
const bool autofattura = rcs.get_bool("AUTOFATT"); const bool autofattura = rcs.get_bool("AUTOFATT");
const bool valintra = rcs.get_bool("VALINTRA"); const bool valintra = rcs.get_bool("VALINTRA");
@ -3379,14 +3395,17 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt)
// Must consider current activity too... // Must consider current activity too...
codiva = *_pim_codiva; codiva = *_pim_codiva;
reg = *_pim_codreg; reg = *_pim_codreg;
look_iva(codiva); look_reg(reg); // posiziona la tabella registri e quella IVA
tiva = _iva->get("S1"); // tipo IVA const TCodiceIVA & civa = cached_codIVA(codiva);
tpla = _iva->get("S3"); // tipo gestione plafond
tagr = _iva->get_int("I4"); // tipo gestione regime agricolo 2/9/2015 was S4 look_reg(reg); // posiziona la tabella registri e quella IVA
tvia = _iva->get("S5"); // tipo gestione ag. viaggio tiva = civa.tipo(); // tipo IVA
v11 = _iva->get("S2"); // n.ro riga vendite per mod. IVA11 tpla = civa.tipo_plafond(); // tipo gestione plafond
a11 = _iva->get("S9"); // n.ro riga acquisti per mod. IVA11 tagr = civa.tipo_IVA_agricola(); // tipo gestione regime agricolo 2/9/2015 was S4
aliq = _iva->get_real("R0"); // aliquota tvia = civa.tipo_agenzie_viaggio(); // tipo gestione ag. viaggio
v11 = civa.IVA11_vendite(); // n.ro riga vendite per mod. IVA11
a11 = civa.IVA11_acquisti(); // n.ro riga acquisti per mod. IVA11
aliq = civa.percentuale(); // aliquota
treg = (tiporeg)_reg->get_long("I0"); treg = (tiporeg)_reg->get_long("I0");
const bool is_vendita = treg == vendita; const bool is_vendita = treg == vendita;
const bool is_acquisto = treg == acquisto; const bool is_acquisto = treg == acquisto;
@ -3484,7 +3503,7 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt)
_CorrItem& ca = (_CorrItem&) corr_ann[codiva]; _CorrItem& ca = (_CorrItem&) corr_ann[codiva];
ca._totale += lor; ca._totale += lor;
if (!is_present) if (!is_present)
ca._aliquota = _iva->get_real("R0"); // Se e' nuovo setta l'aliquota ca._aliquota = civa.percentuale(); // Se e' nuovo setta l'aliquota
} }
tt = _pim->get("S0"); tt = _pim->get("S0");
@ -4541,8 +4560,10 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
const int tipocr = atoi(*_pim_tipocr); const int tipocr = atoi(*_pim_tipocr);
codiva = *_pim_codiva; codiva = *_pim_codiva;
reg = *_pim_codreg; reg = *_pim_codreg;
look_iva(codiva); look_reg(reg); const TCodiceIVA & civa = cached_codIVA(codiva);
tiva = _iva->get("S1");
look_reg(reg);
tiva = civa.tipo();
const TRegistro & reg = cached_registro(_reg->curr()); const TRegistro & reg = cached_registro(_reg->curr());
const tipo_sospensione simp = reg.sospensione(); const tipo_sospensione simp = reg.sospensione();
@ -4573,7 +4594,7 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
_CorrItem& ca = (_CorrItem&)corr_ann[codiva]; _CorrItem& ca = (_CorrItem&)corr_ann[codiva];
ca._totale += _pim->get_real("R3"); ca._totale += _pim->get_real("R3");
if (!is_key) // se non c'e' lo aggiunge if (!is_key) // se non c'e' lo aggiunge
ca._aliquota = _iva->get_real("R0") / CENTO; // Se è nuovo setta l'aliquota ca._aliquota = civa.moltiplicatore_percentuale(); // Se è nuovo setta l'aliquota
} }
if (tipoatt == 1) if (tipoatt == 1)
volaff1 += imp_ifs; volaff1 += imp_ifs;

View File

@ -1194,6 +1194,7 @@ int TMask::win2page(WINDOW w) const
TMask_field* TMask::parse_field(TScanner& scanner) TMask_field* TMask::parse_field(TScanner& scanner)
{ {
const TString& k = scanner.key(); const TString& k = scanner.key();
if (k == "BO") return new TBoolean_field(this); if (k == "BO") return new TBoolean_field(this);
if (k == "BR") return new TBrowsefile_field(this); if (k == "BR") return new TBrowsefile_field(this);
if (k == "BU") return new TButton_field(this); if (k == "BU") return new TButton_field(this);

View File

@ -61,7 +61,6 @@
#define MOV_KEYFPPRO "KEYFPPRO" #define MOV_KEYFPPRO "KEYFPPRO"
#define MOV_MOVCOLL "MOVCOLL" #define MOV_MOVCOLL "MOVCOLL"
#define MOV_ELABF9 "ELABF9" #define MOV_ELABF9 "ELABF9"
#define MOV_IDDOCSDI "IDDOCSDI" #define MOV_IDDOCSDI "IDDOCSDI"
#define MOV_DATADOCSDI "DATADOCSDI" #define MOV_DATADOCSDI "DATADOCSDI"

View File

@ -1423,7 +1423,6 @@ TRecnotype TCursor::update()
_lastrec = eod; _lastrec = eod;
_index_firm = prefix().get_codditta(); _index_firm = prefix().get_codditta();
_lastkrec = DB_changed(handle); _lastkrec = DB_changed(handle);
return _totrec; return _totrec;
} }

View File

@ -108,6 +108,8 @@ bool TTable_application::user_create()
return false; return false;
_tabname = argv(2); _tabname = argv(2);
if (_tabname == "ĘU")
_tabname = "%CAU";
_tabname.upper(); _tabname.upper();
_rel = new TRelation(_tabname); _rel = new TRelation(_tabname);

View File

@ -26,28 +26,35 @@ const real SSimple_query::sq_get_real(const char * field)
return app; return app;
} }
TString SSimple_query::sq_get(const char* field, bool rtrim) const TString & SSimple_query::sq_get(const char* field, const bool rtrim)
{ {
TString fld = _rec.get(field); TString & fld = get_tmp_string(1024);
fld = _rec.get(field);
if (rtrim) if (rtrim)
fld.rtrim(); fld.rtrim();
return fld; return fld;
} }
TString SSimple_query::sq_get(const string& field, const bool rtrim) const TString & SSimple_query::sq_get(const string& field, const bool rtrim)
{ {
return sq_get(field.c_str(), rtrim); return sq_get(field.c_str(), rtrim);
} }
TString SSimple_query::sq_get(TString& field, bool rtrim) const TString & SSimple_query::sq_get(TString& field, const bool rtrim)
{ {
return sq_get(static_cast<const char*>(field), rtrim); return sq_get((const char *)field, rtrim);
} }
TString SSimple_query::sq_get(unsigned int column, bool rtrim) const TString & SSimple_query::sq_get(unsigned int column, const bool rtrim)
{ {
return _rec.get(column); TString & val = get_tmp_string(1024);
val << _rec.get(column);
if (rtrim)
val.rtrim();
return val;
} }
unsigned SSimple_query::sq_get_num_fields() const unsigned SSimple_query::sq_get_num_fields() const
@ -55,9 +62,12 @@ unsigned SSimple_query::sq_get_num_fields() const
return _rec.get_num_fields(); return _rec.get_num_fields();
} }
TString SSimple_query::sq_get_name_field(const unsigned column) const const TString & SSimple_query::sq_get_name_field(const unsigned column) const
{ {
return _rec.get_name_field(column); TString & name = get_tmp_string();
name = _rec.get_name_field(column);
return name;
} }
int SSimple_query::sq_get_width_field(const unsigned column) const int SSimple_query::sq_get_width_field(const unsigned column) const
@ -75,6 +85,8 @@ TFieldtypes SSimple_query::sq_get_type_field(const unsigned column) const
return _boolfld; return _boolfld;
if (type == "dtShort") if (type == "dtShort")
return _intfld; return _intfld;
if (type == "dtLong")
return _longfld;
if (type == "dtULong") if (type == "dtULong")
return _longfld; return _longfld;
if (type == "dtDouble") if (type == "dtDouble")

View File

@ -40,29 +40,22 @@
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif // !__STRINGS_H #endif //
#ifndef __DATE_H #ifndef __DATE_H
#include <date.h> #include <date.h>
#endif // !__DATE_H #endif //
#ifndef __REAL_H #ifndef __REAL_H
#include <real.h> #include <real.h>
#endif // !__REAL_H #endif //
#define CHIAVE_ID_ "_ID_"
#include "recset.h" #include "recset.h"
/******************************************************************************** /********************************************************************************
* SSimpleQuery (Sirio Simple Query) * * SSimpleQuery (Sirio Simple Query) *
* "Wrapper" di TXvt_recordset, implementa OGNI funzione in modo tale da * * "Wrapper" di TXvt_recordset, implementa OGNI funzione in modo tale da *
* poterlo sostituire brutalmente in qualsiasi momento così da non aver * * poterlo sostituire brutalmente in qualsiasi momento così da non aver *
* problemi come durante il passaggio da ISAM a SQL (spero). * * problemi come durante il passaggio da ISAM a SQL (spero). che cazzata da riscrivere *
* Se ti stai domandando perchè non è stata usata l'ereditarietà (magari con *
* un bel ": private TXvt_recordset" così da bloccare il tutto) è per bloccare *
* qualsiasi riferimento a questa classe in eventuali reimplementazioni future. *
* Preferisco scrivere un po' di codice ridondante adesso che andare a fare *
* salti mortali dopo *
********************************************************************************/ ********************************************************************************/
class SSimple_query class SSimple_query
{ {
@ -160,19 +153,19 @@ public:
/**< Ritorna il valore nel campo (field) in formato (SADateTime), Campo non gestisce le ore */ /**< Ritorna il valore nel campo (field) in formato (SADateTime), Campo non gestisce le ore */
//SADateTime sqGetDateTime(const char* field) { get_short(field); } //SADateTime sqGetDateTime(const char* field) { get_short(field); }
/**< Ritorna il valore nel campo (field) passato come (const char *) in formato (const char *) */ /**< Ritorna il valore nel campo (field) passato come (const char *) in formato (const char *) */
TString sq_get(const char* field, bool rtrim = true); const TString & sq_get(const char* field, bool rtrim = true);
/**< Ritorna il valore nel campo (field) passato come (string) in formato (const char *) */ /**< Ritorna il valore nel campo (field) passato come (string) in formato (const char *) */
TString sq_get(const string& field, bool rtrim = true); const TString & sq_get(const string& field, bool rtrim = true);
/**< Ritorna il valore nel campo (field) passato come (TString) in formato (const char *) */ /**< Ritorna il valore nel campo (field) passato come (TString) in formato (const char *) */
TString sq_get(TString& field, bool rtrim = true); const TString & sq_get(TString& field, bool rtrim = true);
/**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */ /**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */
TString sq_get(unsigned int column, bool rtrim = true); const TString & sq_get(unsigned int column, bool rtrim = true);
/**< Ritorna il valore nel campo (field) in formato (char) */ /**< Ritorna il valore nel campo (field) in formato (char) */
const char sq_get_char(const char* field) { return _rec.get_char(field); } const char sq_get_char(const char* field) { return _rec.get_char(field); }
/**< Ritorna il numero di campi dopo l'ultimo comando di esecuzione effettuato; se il risultato esiste */ /**< Ritorna il numero di campi dopo l'ultimo comando di esecuzione effettuato; se il risultato esiste */
unsigned int sq_get_num_fields() const; unsigned int sq_get_num_fields() const;
/**< Ritorna il nome del campo numero (column) in formato (TString= */ /**< Ritorna il nome del campo numero (column) in formato (TString) = */
TString sq_get_name_field(unsigned column) const; const TString & sq_get_name_field(unsigned column) const;
/**< Ritorna la grandezza del campo numero (column) */ /**< Ritorna la grandezza del campo numero (column) */
int sq_get_width_field(unsigned column) const; int sq_get_width_field(unsigned column) const;
/**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */ /**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */
@ -198,12 +191,12 @@ public:
void defrost() { _rec.defrost(); } void defrost() { _rec.defrost(); }
/**< Costruttore, non inizializza nulla, da caricare successivamente */ /**< Costruttore, non inizializza nulla, da caricare successivamente */
SSimple_query() = default; SSimple_query() {};
/**< Costruttore, Accetta in ingresso dei parametri per la connessione, volendo è anche possibile impostare una query ed eseguirla. Attenzione! Non risponde se la query ha avuto un esito positivo o negativo! */ /**< Costruttore, Accetta in ingresso dei parametri per la connessione, volendo è anche possibile impostare una query ed eseguirla. Attenzione! Non risponde se la query ha avuto un esito positivo o negativo! */
SSimple_query(const char* db, const char* user, const char* pass, const TT_driver tipo_db, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipo_db, query, ex, freezed) {} SSimple_query(const char* db, const char* user, const char* pass, const TT_driver tipo_db, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipo_db, query, ex, freezed) {}
//SSimpleQuery(const TString& db, const TString& user, const TString& pass, TT_driver tipoDb, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipoDb, query, ex, freezed) {} //SSimpleQuery(const TString& db, const TString& user, const TString& pass, TT_driver tipoDb, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipoDb, query, ex, freezed) {}
/**< Distruttore */ /**< Distruttore */
virtual ~SSimple_query() = default; virtual ~SSimple_query() {};
}; };
#endif #endif

View File

@ -490,6 +490,7 @@ struct linger {
/* /*
* Windows Sockets definitions of regular Microsoft C error constants * Windows Sockets definitions of regular Microsoft C error constants
*/ */
#ifndef WSAEINTR
#define WSAEINTR (WSABASEERR+4) #define WSAEINTR (WSABASEERR+4)
#define WSAEBADF (WSABASEERR+9) #define WSAEBADF (WSABASEERR+9)
#define WSAEACCES (WSABASEERR+13) #define WSAEACCES (WSABASEERR+13)
@ -497,6 +498,7 @@ struct linger {
#define WSAEINVAL (WSABASEERR+22) #define WSAEINVAL (WSABASEERR+22)
#define WSAEMFILE (WSABASEERR+24) #define WSAEMFILE (WSABASEERR+24)
/* /*
* Windows Sockets definitions of regular Berkeley error constants * Windows Sockets definitions of regular Berkeley error constants
*/ */
@ -581,6 +583,7 @@ struct linger {
/* /*
* Windows Sockets errors redefined as regular Berkeley error constants * Windows Sockets errors redefined as regular Berkeley error constants
*/ */
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS #define EINPROGRESS WSAEINPROGRESS
#define EALREADY WSAEALREADY #define EALREADY WSAEALREADY
@ -618,6 +621,7 @@ struct linger {
#define EDQUOT WSAEDQUOT #define EDQUOT WSAEDQUOT
#define ESTALE WSAESTALE #define ESTALE WSAESTALE
#define EREMOTE WSAEREMOTE #define EREMOTE WSAEREMOTE
#endif
/* Socket function prototypes */ /* Socket function prototypes */