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

This commit is contained in:
francescofucarino 2021-02-01 18:21:07 +01:00
commit a0b4224257
62 changed files with 901 additions and 141 deletions

View File

@ -142,7 +142,8 @@
<OutputFile>$(IntDir)$(TargetName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -107,7 +107,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -153,7 +153,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -101,7 +101,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -158,7 +158,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -157,7 +157,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -158,7 +158,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -103,7 +103,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -155,7 +155,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -94,7 +94,8 @@
<OutputFile>$(IntDir)$(TargetName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /t http://timestamp.verisign.com/scripts/timstamp.dll /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

Binary file not shown.

View File

@ -156,7 +156,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -107,7 +107,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -104,7 +104,8 @@
<OutputFile>$(IntDir)$(TargetName).xml</OutputFile>
</Xdcmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

Binary file not shown.

View File

@ -141,7 +141,8 @@
<OutputFile>.\..\release/pr0.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /t http://timestamp.verisign.com/scripts/timstamp.dll /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -96,7 +96,8 @@
<OutputFile>.\..\release/pr1.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /t http://timestamp.verisign.com/scripts/timstamp.dll /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -222,6 +223,9 @@
<ProjectReference Include="vedoc.vcxproj">
<Project>{a1ce9743-a597-4f92-b55a-345a366c9e55}</Project>
</ProjectReference>
<ProjectReference Include="vedocext.vcxproj">
<Project>{0042619a-6b7c-4d3d-9cd9-9bdd8d200c15}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -94,7 +94,8 @@
<OutputFile>.\..\release/ps1004.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /t http://timestamp.verisign.com/scripts/timstamp.dll /v "$(TargetPath)"</Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -95,8 +95,7 @@
<OutputFile>$(IntDir)$(TargetName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>
</Command>
<Command>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /a /s MY /n "Sirio Informatica e Sistemi SPA" /fd sha256 /tr http://timestamp.digicert.com /v "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

3
cd/test/ba1028.txt Normal file
View File

@ -0,0 +1,3 @@
bacnv.exe
Migliorate le segnalazioni e codificate le categorie mancanti nella conversione dell'anagrafica articoli per il CONAI

31
cd/test/ba1028a.ini Normal file
View File

@ -0,0 +1,31 @@
[Main]
Demo=0
[ba0]
File(14) = bacnv.exe|X
Patch = 1028
Versione = 21511200
[ba99]
Kill(0) = wxmsw240.dll|x
Kill(1) = batbsce.txt|x
Kill(2) = bastfsc.rep|x
Kill(3) = bastfsc.msk|x
Kill(4) = bastcms.msk|x
Kill(5) = bastcms.rep|x
Kill(6) = bastuue.rep|x
Kill(7) = bastuue.msk|x
[ba]
Data = 20-01-2021
Descrizione = Base
Dischi = 1
Moduli = sy
OEM =
Patch = 1028
PostProcess = bainst -0 BA
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/ba1028a1.zip Normal file

Binary file not shown.

8
cd/test/ba1030.txt Normal file
View File

@ -0,0 +1,8 @@
recdesc\f34.dir
recdesc\f34.trr
Commento :
MIgliorato il meccanismo di autoevasione degli ordini nel caso di cambio di un codice e di cancellazione di una riga.
Modificata la contabilizzazione del reverse charge per getire il reverse charge parziale
Aggiunto il campo reverse charge sulle righe documento.
Ricorretta protocollazione delle fatture e regolarizzazioni nella contabilizzazione.

32
cd/test/ba1030a.ini Normal file
View File

@ -0,0 +1,32 @@
[Main]
Demo=0
[ba0]
File(299) = recdesc\f34.dir|X
File(300) = recdesc\f34.trr|X
Patch = 1030
Versione = 21511200
[ba99]
Kill(0) = batbsce.txt|x
Kill(1) = wxmsw240.dll|x
Kill(2) = bastcms.rep|x
Kill(3) = bastcms.msk|x
Kill(4) = bastfsc.msk|x
Kill(5) = bastfsc.rep|x
Kill(6) = bastuue.msk|x
Kill(7) = bastuue.rep|x
[ba]
Data = 31-01-2021
Descrizione = Base
Dischi = 1
Moduli = sy
OEM =
Patch = 1030
PostProcess = bainst -0 BA
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/ba1030a1.zip Normal file

Binary file not shown.

3
cd/test/pr1028.txt Normal file
View File

@ -0,0 +1,3 @@
pr1300a.frm
Aggiunto testate del documento al form di stampa delle schede provvigioni, riportava errore.

19
cd/test/pr1028a.ini Normal file
View File

@ -0,0 +1,19 @@
[Main]
Demo=0
[pr1]
File(18) = pr1300a.frm|X
Patch = 1028
Versione = 21511200
[pr]
Data = 20-01-2021
Descrizione = Provvigioni Agenti
Dischi = 1
Moduli = ve
OEM =
Patch = 1028
PostProcess =
PreProcess =
Versione = 21511200

BIN
cd/test/pr1028a1.zip Normal file

Binary file not shown.

3
cd/test/sy1028.txt Normal file
View File

@ -0,0 +1,3 @@
xvaga.dll
Aggiunta funzione xvt_sql_field_type

21
cd/test/sy1028a.ini Normal file
View File

@ -0,0 +1,21 @@
[Main]
Demo=0
[sy1]
File(53) = xvaga.dll|X
Patch = 1028
Versione = 21511200
[sy]
Data = 27-10-2020
Descrizione = Sistema
Dischi = 1
Moduli =
OEM =
Patch = 1028
PostProcess =
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/sy1028a1.zip Normal file

Binary file not shown.

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

@ -0,0 +1,4 @@
tf0.exe
Modificato l'aggiornamento del database del trasferimento fatture. Non modificava i campi esistenti ma creava solo i campi nuovi.
Aggiornata la funzione che carica la natura IVA.

19
cd/test/tf1028a.ini Normal file
View File

@ -0,0 +1,19 @@
[Main]
Demo=0
[tf1]
File(0) = tf0.exe|X
Patch = 1028
Versione = 21511200
[tf]
Data = 17-09-2020
Descrizione = Trasferimento fatture
Dischi = 1
Moduli = cg
OEM =
Patch = 1028
PostProcess =
PreProcess =
Versione = 21511200

BIN
cd/test/tf1028a1.zip Normal file

Binary file not shown.

10
cd/test/ve1030.txt Normal file
View File

@ -0,0 +1,10 @@
ve0.exe
ve1.exe
ve5.exe
ve6.exe
Commento :
MIgliorato il meccanismo di autoevasione degli ordini nel caso di cambio di un codice e di cancellazione di una riga.
Modificata la contabilizzazione del reverse charge per getire il reverse charge parziale
Aggiunto il campo reverse charge sulle righe documento.
Ricorretta protocollazione delle fatture e regolarizzazioni nella contabilizzazione.

147
cd/test/ve1030a.ini Normal file
View File

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

BIN
cd/test/ve1030a1.zip Normal file

Binary file not shown.

View File

@ -837,6 +837,31 @@ TBit_array::~TBit_array()
delete _bit;
}
void TBit_array::insert(long n, bool on)
{
if (n < 0)
n = 0;
const int last = last_one();
if (last >= n)
for (word i = last_one(); i >= n; i--)
set(i + 1, operator [](i));
set(n, on);
}
void TBit_array::pack(long n)
{
if (n < 0)
n = 0;
const int last = last_one();
if (last > n)
for (word i = n; i < last; i++)
set(i, operator [](i + 1));
reset(last);
}
// Certified 100%
void TBit_array::set()
{

View File

@ -396,6 +396,10 @@ public:
// @cmember Not logico del bit n-esimo dell'array
void neg(long n);
// @cmember inserisce e setta il bit n-esimo a seconda del valore passato come secondo elemento
void insert(long n, bool on = false);
// @cmember elimina il bit n-esimo
void pack(long n);
// @cmember Setta il bit n-esimo a seconda del valore passato come secondo elemento
void set(long n, bool on) { on ? set(n) : reset(n); }
// @cmember Setta ad 1 tutti i bit dell'array

View File

@ -74,6 +74,7 @@
#define RDOC_TIPODET "TIPODET"
#define RDOC_TIPOCOLL "TIPOCOLL"
#define RDOC_IDRIGACOLL "IDRIGACOLL"
#define RDOC_REVCHARGE "REVCHARGE"
// campi virtuali
#define RDOC_LEVEL "LEVEL"

View File

@ -172,3 +172,11 @@ bool TScanner::paragraph(const char* name)
clear();// resetta eof
seekg(pos);
}
void TScanner::setpos(streampos pos)
{
clear();// resetta eof
seekg(pos);
}

View File

@ -72,6 +72,10 @@ public:
{ return _line; }
// @cmember riposiziona lo scanner
void seek(pos_type pos);
// @cmember riposiziona lo scanner alla posizione pos
void setpos(streampos pos);
// @cmember ritorna la posizione dello scanners
streampos pos() { return tellg();}
};

View File

@ -590,37 +590,60 @@ int TTrFa_app::parse_line(const TString& line, TString& var, TString& val) const
bool TTrFa_app::create_table(TScanner& tff, const TString& table)
{
TString query, var, val;
if (xvt_sql_table_exists(_db, table))
bool modified = false;
TToken_string field_list("", ',');
const bool new_table = !xvt_sql_table_exists(_db, table);
streampos cur_pos = tff.pos();
if (!new_table)
{
SLIST fields = xvt_sql_list_fields(_db, table);
while (!tff.eof())
while (!modified && !tff.eof())
{
const TString& line = tff.line();
const int n = parse_line(line, var, val);
if (n <= 0)
break;
if (var.starts_with("INDEX_"))
break;
if (xvt_slist_find_str(fields, var) == NULL)
{
query.cut(0) << "ALTER TABLE " << table << " ADD COLUMN " << var << ' ' << val << " NOT NULL";
if (val.find("INT") >= 0 || val.find("NUM") >= 0)
query << " DEFAULT 0";
else
query << " DEFAULT ''";
query << ";";
xvt_sql_execute(_db, query, NULL, NULL); // Create table
modified = true;
}
else
modified = (val != xvt_sql_field_type(_db, table, var));
}
if (modified)
{
const int nfields = xvt_slist_count(fields);
for (SLIST_ELT field = xvt_slist_get_first(fields); field != nullptr; field = xvt_slist_get_next(fields, field))
field_list.add(field->str);
}
xvt_slist_destroy(fields);
if (modified)
{
query = "ALTER TABLE ";
query << table << " RENAME TO " << table << "_OLD;";
xvt_sql_execute(_db, query, NULL, NULL); // rename table table
query = "DROP INDEX ";
query << table << "_1;";
xvt_sql_execute(_db, query, NULL, NULL); // rename table table
tff.setpos(cur_pos);
}
}
else
if (new_table || modified)
{
query << "CREATE TABLE " << table << " (";
query = "CREATE TABLE "; query << table << " (";
while (!tff.eof())
{
const TString& line = tff.line();
const int n = parse_line(line, var, val);
if (n <= 0)
break;
if (n == 1)
@ -633,9 +656,8 @@ bool TTrFa_app::create_table(TScanner& tff, const TString& table)
query.rtrim(1); // toglie ultima ,
query << ");";
xvt_sql_execute(_db, query, NULL, NULL); // Create table
query.cut(0);
query << "CREATE UNIQUE INDEX "
<< table << "_1 ON " << table
query = "CREATE UNIQUE INDEX ";
query << table << "_1 ON " << table
<< " (" << val << ");";
xvt_sql_execute(_db, query, NULL, NULL); // Create index
break;
@ -650,8 +672,18 @@ bool TTrFa_app::create_table(TScanner& tff, const TString& table)
query << ",";
}
}
if (modified)
{
query = "INSERT INTO ";
query << table << "(" << field_list
<< ") SELECT " << field_list << " FROM "
<< table << "_OLD;";
xvt_sql_execute(_db, query, NULL, NULL); // rename table table
query = "DROP TABLE ";
query << table << "_OLD;";
xvt_sql_execute(_db, query, NULL, NULL); // rename table table
}
}
return true;
}

View File

@ -133,7 +133,9 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if(e == fe_modify)
{
// Calcolo la natura
o.mask().set(A_NATURA, natura(o.get()));
TCodiceIVA iva(o.get());
o.mask().set(A_NATURA, iva.natura());
// Se esiste un imponibile calcolo l'imposta
real imponibile = o.mask().get_real(A_IMPONIBILE), imposta = ZERO;
if(imponibile > 0)
@ -515,9 +517,13 @@ bool TTrFa_mask::check_rec(TPrinter* stampa, TToken_string* rec)
// Controllo aliquota, imponibile e imposta *********************************************************
TCodiceIVA codiva(rec->get(_aliquota));
TString nat = rec->get(_natura);
const TString real_nat(natura(rec->get(_aliquota)));
const TString real_nat(codiva.natura());
nat.ltrim(); // Se vuoto arriva con uno spazio
const real imponibile = static_cast<const char*>(rec->get(_imponibile)), imposta = static_cast<const char*>(rec->get(_importoIVA));
const real imponibile = rec->get_real(_imponibile);
const real imposta = rec->get_real(_importoIVA);
if(nat != real_nat)
{
msgerr.cut(0) << "Natura del movimento errata, valore dichiarato: " << nat << " valore corretto: " << real_nat;
@ -674,9 +680,8 @@ void TTrFa_mask::load_sheet()
TSheet_field& sheet = sfield(F_RIGHE);
sheet.hide(); // Nascondo lo sheet per guadagnare un 20% di velocità di caricamento, le ottimizzazioni da PRO!
if(!sheet.empty())
sheet.destroy();
// Nascondo lo sheet per guadagnare un 20% di velocità di caricamento, le ottimizzazioni da PRO!
sheet.destroy();
TAssoc_array recimposte;
const int items = c.update_filters(tipo, codice, dal, al, get_int(F_FATTSEL));
TString tipocf, codcf, ocfpi, nat;
@ -722,8 +727,14 @@ void TTrFa_mask::load_sheet()
row.add(get_rfso(cli.get("CODRFSO")), _ragsocrfso); // Ragione Sociale RF/SO
row.add(movimento.get("NUMDOC"), _numdoc); // Numero documento
row.add(movimento.get_date("DATADOC"), _datadoc); // Data documento
nat.cut(0) << movimento.get("NATURA");
row.add(nat.full() ? nat : natura(iva), _natura); // NATURA!
nat = movimento.get("NATURA");
if (nat.blank())
{
TCodiceIVA civa(iva);
nat = civa.natura();
}
row.add(nat, _natura); // NATURA!
row.add(iva, _aliquota); // Codice aliquota!
row.add(find_detraib(movimento.get("TIPODET")), _detraibile); // Detraibilità
row.add(movimento.get_real("IMPONIBILE"), _imponibile); // Imponibile

View File

@ -284,7 +284,10 @@ void TSpe_check_msk::fill_no_filter()
row.add(rset.get("25.IMPONIBILE").as_string(), s.cid2index(A_IMPONIBILE));
row.add(rset.get("25.IMPOSTA").as_string(), s.cid2index(A_IMPOSTA));
// NATURA
row.add(natura(rset.get("25.CODIVA").as_string()), s.cid2index(A_NATURA));
TCodiceIVA iva(rset.get("25.CODIVA").as_string());
row.add(iva.natura(), s.cid2index(A_NATURA));
// DETR
row.add(find_detraib(rset.get("25.TIPODET").as_string()), s.cid2index(A_DETRAIB));
@ -376,8 +379,14 @@ void TSpe_check_msk::fill_diff()
row.add(rset.get("IMPONIBILE").as_string(), s.cid2index(A_IMPONIBILE));
row.add(rset.get("IMPOSTA").as_string(), s.cid2index(A_IMPOSTA));
// NATURA
nat.cut(0) << rset.get("NATURA").as_string();
row.add(nat.full() ? nat : natura(rset.get("CODIVA").as_string()), s.cid2index(A_NATURA));
nat = rset.get("NATURA").as_string();
if (nat.blank())
{
TCodiceIVA civa(rset.get("CODIVA").as_string());
nat = civa.natura();
}
row.add(nat, s.cid2index(A_NATURA));
// DETR
row.add(find_detraib(rset.get("TIPODET").as_string()), s.cid2index(A_DETRAIB));
@ -460,7 +469,10 @@ void TSpe_check_msk::find_homeland(TToken_string& row, TString numreg, TString c
row.add(imponibile, s.cid2index(A_IMPONIBILE));
row.add(imposta, s.cid2index(A_IMPOSTA));
// NATURA
row.add(natura(rec_rmov.get("CODIVA")), s.cid2index(A_NATURA));
TCodiceIVA iva(rec_rmov.get("CODIVA"));
row.add(iva.natura(), s.cid2index(A_NATURA));
// DETR
row.add(find_detraib(rec_rmov.get("TIPODET")), s.cid2index(A_DETRAIB));
@ -549,8 +561,15 @@ void TSpe_check_msk::fill_cust()
row.add(rset.get("IMPONIBILE").as_string(), s.cid2index(A_IMPONIBILE));
row.add(rset.get("IMPOSTA").as_string(), s.cid2index(A_IMPOSTA));
// NATURA
nat.cut(0) << rset.get("NATURA").as_string();
row.add(nat.full() ? nat : natura(rset.get("CODIVA").as_string()), s.cid2index(A_NATURA));
nat = rset.get("NATURA").as_string();
if (nat.blank())
{
TCodiceIVA civa(rset.get("CODIVA").as_string());
nat = civa.natura();
}
row.add(nat, s.cid2index(A_NATURA));
// DETR
row.add(find_detraib(rset.get("TIPODET").as_string()), s.cid2index(A_DETRAIB));

View File

@ -1,3 +1,3 @@
34
0
$rdoc|||618|0|Righe documenti|||
$rdoc|||619|0|Righe documenti|||

View File

@ -1,5 +1,5 @@
34
70
71
CODNUM|1|4|0|Codice Numeriazione
ANNO|2|4|0|Anno
PROVV|1|1|0|Tipo numerazione <P>rovvisoria <D>efinitiva
@ -65,6 +65,7 @@ CODAGG1|1|20|0|Codice aggiuntivo 1
CODAGG2|1|20|0|Codice aggiuntivo 2
PRIORITY|3|7|0|Priorità MSP
TIPODET|1|1|0|Tipo detraibilità
REVCHARGE|8|1|0|Flag reverse charge
RG1|11|10|0|Campo memo per formule e campi virtuali
DATAINIATT|5|8|0|Data inizio attività
DATAFINATT|5|8|0|Data fine attività

View File

@ -84,4 +84,5 @@ CCON(8)|2|4|CONAI\nSottoc.9|4
PCON(9)|3|1305|CONAI\nPeso un.9|13
CCON(10)|2|4|CONAI\nSottoc.10|4
PCON(10)|3|1305|CONAI\nPeso un.10|13
REVCHARGE|4||Reverse charge|14

View File

@ -829,6 +829,9 @@ class TDocumento : public TMultiple_rectype // velib03
TAssoc_array _conaiqta; // Per ogni sottocategoria CONAI mi calcola la qta
TArray _qta_evasa_auto;
TBit_array _row_auto_cod_changed;
bool _auto_cod_modify_pend;
TAssoc_array _qta_evasa_auto_changed;
protected:
virtual TRectype * new_body_record(int logicnum = 0)
@ -902,7 +905,7 @@ public:
const TRiga_documento* get_row_id(long id) const;
int id2rownum(long id) const;
TRiga_documento& insert_row(int row, const char *tipo = NULL);
TRiga_documento& insert_row(int nrow, const char *tipo = NULL);
TRiga_documento& new_row(const char *tipo = NULL);
virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock);
virtual int readat(TBaseisamfile& file, TRecnotype nrec, word lockop = _nolock);
@ -1015,8 +1018,8 @@ public:
void auto_evasione(const int nrow = -1);
void qta_evasa_auto_pack(const int nrow) { _qta_evasa_auto.destroy(nrow, true); }
int find_nrow(const char * tiporiga, const char * codice, int from = 1) const;
TRiga_documento & find_row(const char * tiporiga, const char * codice);
int find_nrow(const char * tiporiga, const char * codice, bool reverse = false, int from = -1) const;
TRiga_documento & find_row(const char * tiporiga, const char * codice, bool reverse = false);
TDocumento ();
TDocumento (const TDocumento& d);
@ -1158,7 +1161,7 @@ protected:
void configura_sheet(TSheet_field& sheet);
static TMask* ss_getmask(int numriga, TMask& fullmask);
int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required);
int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required, const short contsep_id = -1);
void insert_anal_page();
void set_or_def(short id, const TString& val);

View File

@ -375,7 +375,7 @@ void TRiga_documento::update_orders(real qta, TToken_string & tipi, TToken_strin
{
const bool storno = qta < ZERO;
const TString4 tiporiga = tipo().codice();
const TString40 codart = codice();
const TString40 codart = get(RDOC_CODART);
real qta_da_evadere = storno ? -qta : qta;
if (codart.full())
@ -409,7 +409,7 @@ void TRiga_documento::update_orders(real qta, TToken_string & tipi, TToken_strin
{
bool to_delete = true;
for (int nrow = docs[i].find_nrow(tiporiga, codart); to_delete && nrow > 0; nrow = docs[i].find_nrow(tiporiga, codart, nrow + 1))
for (int nrow = docs[i].find_nrow(tiporiga, codart, storno); to_delete && nrow > 0; nrow = docs[i].find_nrow(tiporiga, codart, storno, nrow))
to_delete &= docs[i][nrow].is_evasa();
if (to_delete)
docs.destroy(i, false);
@ -432,11 +432,11 @@ void TRiga_documento::update_orders(real qta, TToken_string & tipi, TToken_strin
{
TDocumento & d = docs[i];
for (int nrow = d.find_nrow(tiporiga, codart); (qta_da_evadere > ZERO) && nrow > 0; nrow = d.find_nrow(tiporiga, codart, nrow + 1))
for (int nrow = d.find_nrow(tiporiga, codart, storno); (qta_da_evadere > ZERO) && nrow > 0; nrow = d.find_nrow(tiporiga, codart, storno, nrow))
{
TRiga_documento & rdoc = d[nrow];
if (!rdoc.is_evasa())
if (!rdoc.is_evasa() || storno)
{
TToken_string rdoc_key = rdoc.get_rdoc_key();
real qta_evasa = qta_da_evadere;
@ -861,6 +861,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
real TRiga_documento::iva(int ndec) const
{
real zanicchi;
if (!is_sconto())
{
if (is_omaggio())

View File

@ -257,6 +257,7 @@ HIDDEN TAssoc_array _docs_to_agg;
void TDocumento::init()
{
_auto_cod_modify_pend = false;
add_file(LF_RIGHEDOC, RDOC_NRIGA);
set_memo_fld("G1");
@ -809,14 +810,14 @@ void TDocumento::copy_contents(const TDocumento& src, bool copy_header)
}
}
TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
TRiga_documento& TDocumento::insert_row(int nrow, const char *tipo)
{
TRiga_documento& r = (TRiga_documento&)TMultiple_rectype::insert_row(row);
TRiga_documento& r = (TRiga_documento&)TMultiple_rectype::insert_row(nrow);
if (tipo && *tipo)
r.set_tipo(tipo);
if (this->tipo().auto_evasione()) // this per spiegare che non è il parametro tipo
_qta_evasa_auto.insert(ZERO, row); // inserisce la riga nuova nell'array
update_row_auto_qta(nrow, (real &) ZERO, true, true);
return r;
}
@ -878,12 +879,36 @@ void TDocumento::on_read(int err, word lockop)
_old_agente = get(DOC_CODAG);
_old_agente1 = get(DOC_CODAGVIS);
}
_qta_evasa_auto.destroy();
if (get(DOC_TIPODOC).full() && tipo().auto_evasione())
if (get(DOC_TIPODOC).full() && tipo().auto_evasione() && !_auto_cod_modify_pend)
{
_qta_evasa_auto.destroy();
_row_auto_cod_changed.reset();
_qta_evasa_auto_changed.destroy();
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
update_row_auto_qta(i, rdoc->quantita(), false);
}
if (get(DOC_TIPODOC).full() && tipo().causale().full())
{
const TCausale & caus = cached_causale(tipo().causale());
if (caus.reverse_charge_pubb())
{
bool no_reverse = true;
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
if (no_reverse && !rdoc->tipo().is_descrizione() &&
rdoc->get(RDOC_CODIVA).full())
no_reverse &= !rdoc->get_bool(RDOC_REVCHARGE);
if (no_reverse)
{
FOR_EACH_SELF_PHYSICAL_RDOC(i1, rdoc)
if (!rdoc->tipo().is_descrizione() &&
rdoc->get(RDOC_CODIVA).full())
rdoc->put(RDOC_REVCHARGE, true);
}
}
}
}
int TDocumento::read(TBaseisamfile& f, word op, word lockop)
@ -1532,7 +1557,30 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
const TString80 codcms(get(DOC_CODCMS));
const TString80 fascms(get(DOC_FASCMS));
const TString80 codcos(get(DOC_CODCOSTO));
/* if (get(DOC_TIPODOC).full() && tipo().causale().full())
{
const TCausale & caus = cached_causale(tipo().causale());
if (caus.reverse_charge_pubb())
{
bool no_reverse = true;
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
if (no_reverse && !rdoc->tipo().is_descrizione() &&
rdoc->get(RDOC_CODIVA).full())
no_reverse &= !rdoc->get_bool(RDOC_REVCHARGE);
if (no_reverse)
{
FOR_EACH_SELF_PHYSICAL_RDOC(i1, rdoc)
if (!rdoc->tipo().is_descrizione() &&
rdoc->get(RDOC_CODIVA).full())
rdoc->put(RDOC_REVCHARGE, true);
}
}
}
*/
for (int i = physical_rows(); i > 0; i--)
{
TRiga_documento& r = myself.row(i);
@ -1693,7 +1741,6 @@ int TDocumento::remove(TBaseisamfile& f) const
if (_has_provv && tipo().provvigioni())
myself.update_provvigioni(true);
myself.plafond().remove(myself);
// if (tipo().auto_evasione())
myself.auto_evasione();
}
return TMultiple_rectype::remove(f);
@ -2850,6 +2897,9 @@ TDocumento& TDocumento::copy(const TDocumento & d)
}
_occas = d.occas();
_qta_evasa_auto = d._qta_evasa_auto;
_auto_cod_modify_pend = d._auto_cod_modify_pend;
_row_auto_cod_changed = d._row_auto_cod_changed;
_qta_evasa_auto_changed = d._qta_evasa_auto_changed;
return *this;
}
@ -3569,6 +3619,7 @@ void TDocumento::update_row_auto_qta(int nrow, real & qta, bool plus, bool inser
if (insert)
{
_qta_evasa_auto.insert(ZERO, nrow);
_row_auto_cod_changed.insert(nrow);
qta_evasa = (real *)_qta_evasa_auto.objptr(nrow);
}
else
@ -3577,6 +3628,8 @@ void TDocumento::update_row_auto_qta(int nrow, real & qta, bool plus, bool inser
if (qta_evasa == nullptr)
_qta_evasa_auto.add(qta_evasa = new real, nrow);
if (_row_auto_cod_changed[nrow])
*qta_evasa = ZERO;
*qta_evasa += (plus ? qta : -qta);
}
if (qta_evasa != nullptr && *qta_evasa == ZERO)
@ -3603,32 +3656,165 @@ void TDocumento::auto_evasione(const int nrow)
rdoc->update_orders((real &)_qta_evasa_auto[i], tipi, stati, stato_aperto, stato_evaso);
_qta_evasa_auto.destroy(i);
}
_row_auto_cod_changed.reset();
if (_auto_cod_modify_pend)
{
_auto_cod_modify_pend = false;
FOR_EACH_ASSOC_OBJECT(_qta_evasa_auto_changed, o, k, obj)
{
real & qta = (real &)*obj;
if (qta != ZERO)
{
const bool storno = qta < ZERO;
const TString key(k);
const TString4 tiporiga = key.left(2);
real qta_da_evadere = storno ? -qta : qta;
const TString40 codart(key.mid(2));
if (codart.full())
{
const int year = get_date(DOC_DATADOC).year();
const TDate dadata(1, 1, year - 5);
const TDate adata(31, 12, year);
TLista_documenti docs;
TString_array evaded;
TArray evaded_qta;
TString_array to_delete;
int ndocs = docs.read('D', get_char(DOC_TIPOCF), get_long(DOC_CODCF),
year, tipi, stati, dadata, adata);
for (int i = 0; i < ndocs; i++)
if (docs[i].find_nrow(tiporiga, codart) < 0)
docs.destroy(i, false);
else
if (!storno)
{
bool to_delete = true;
for (int nrow = docs[i].find_nrow(tiporiga, codart, storno); to_delete && nrow > 0; nrow = docs[i].find_nrow(tiporiga, codart, storno, nrow))
to_delete &= docs[i][nrow].is_evasa();
if (to_delete)
docs.destroy(i, false);
}
docs.pack();
ndocs = docs.items();
for (int i = storno ? ndocs - 1 : 0; (qta_da_evadere > ZERO) && (storno ? i >= 0 : i < ndocs); storno ? i-- : i++)
{
TDocumento & d = docs[i];
for (int nrow = d.find_nrow(tiporiga, codart, storno); (qta_da_evadere > ZERO) && nrow > 0; nrow = d.find_nrow(tiporiga, codart, storno, nrow))
{
TRiga_documento & rdoc = d[nrow];
if (!rdoc.is_evasa())
{
TToken_string rdoc_key = rdoc.get_rdoc_key();
real qta_evasa = qta_da_evadere;
bool riga_evasa = false;
if (storno)
{
const real & evaso = rdoc.qtaevasa();
if (qta_evasa > evaso)
{
qta_evasa = evaso;
to_delete.add(rdoc_key);
}
rdoc.sub(RDOC_QTAEVASA, qta_evasa);
}
else
{
const real & residuo = rdoc.qtaresidua();
if (residuo <= qta_da_evadere)
{
if (i < ndocs - 1)
qta_evasa = residuo;
riga_evasa = true;
}
rdoc.add(RDOC_QTAEVASA, qta_evasa);
}
rdoc.put(RDOC_RIGAEVASA, riga_evasa);
qta_da_evadere -= qta_evasa;
}
}
}
for (int i = 0; i < ndocs; i++)
if (docs[i].is_evaso())
docs[i].stato(stato_evaso);
else
if (docs[i].stato() == stato_evaso)
docs[i].stato(stato_aperto);
docs.rewrite();
}
}
}
_qta_evasa_auto_changed.destroy();
}
}
else
{
TRiga_documento & rdoc = row(nrow);
const TString & codart = rdoc.get(RDOC_CODART);
if (rdoc.is_evadibile() && _qta_evasa_auto.objptr(nrow) != nullptr)
if (codart.full())
{
rdoc.update_orders((real &)_qta_evasa_auto[nrow], tipi, stati, stato_aperto, stato_evaso);
_qta_evasa_auto.destroy(nrow);
message_box(TR("Sono stati evasi ordini legati a questo documento.\nE' necessario registrarlo"));
real * qta = (real *)_qta_evasa_auto_changed.objptr(codart);
real qta_da_stornare = (real &)_qta_evasa_auto[nrow];
if (qta == nullptr)
{
TString key = rdoc.tipo().codice();
key.rpad(2);
key << codart;
_qta_evasa_auto_changed.add(key, qta = new real);
}
*qta += qta_da_stornare;
_row_auto_cod_changed.set(nrow, true);
_auto_cod_modify_pend = true;
}
rdoc.zero(RDOC_DACODNUM);
rdoc.zero(RDOC_DAANNO);
rdoc.zero(RDOC_DAPROVV);
rdoc.zero(RDOC_DANDOC);
rdoc.zero(RDOC_DAIDRIGA);
rdoc.zero(RDOC_ORIGINAL_ROWS);
rdoc.zero(RDOC_ORIGINAL_QTAROWS);
}
}
}
int TDocumento::find_nrow(const char * tiporiga, const char * codice, int from) const
int TDocumento::find_nrow(const char * tiporiga, const char * codice, bool reverse, int from) const
{
FOR_EACH_SELF_RDOC(i, rdoc)
if ((i >= from) && (rdoc->tipo().codice() == tiporiga) && (rdoc->codice() == codice))
return i;
if (reverse)
{
if (from < 0)
from = physical_rows();
from--;
FOR_EACH_SELF_RDOC_BACK(i, rdoc)
if ((i <= from) && (rdoc->tipo().codice() == tiporiga) && (rdoc->codice() == codice))
return i;
}
else
{
if (from < 0)
from = 0;
from++;
FOR_EACH_SELF_RDOC(i, rdoc)
if ((i >= from) && (rdoc->tipo().codice() == tiporiga) && (rdoc->codice() == codice))
return i;
}
return -1;
}
TRiga_documento & TDocumento::find_row(const char * tiporiga, const char * codice)
TRiga_documento & TDocumento::find_row(const char * tiporiga, const char * codice, bool reverse)
{
const int i = find_nrow(tiporiga, codice);
const int i = find_nrow(tiporiga, codice, reverse);
if (i > 0)
return row(i);

View File

@ -616,11 +616,11 @@ int TExpr_documento::parse_user_func(const char * name, int nparms) const
if (strcmp(name, "NRATE") == 0)
return nparms == 0 ? _nrate : -1;
if (strcmp(name, "QTACONAI") == 0)
return nparms >= 1 && nparms < 4 ? _qtaconai : -1;
return nparms >= 0 && nparms < 4 ? _qtaconai : -1;
if (strcmp(name, "PESOCONAI") == 0)
return nparms >= 1 && nparms < 4 ? _pesoconai : -1;
return nparms >= 0 && nparms < 4 ? _pesoconai : -1;
if (strcmp(name, "VALCONAI") == 0)
return nparms >= 1 && nparms < 4 ? _valconai : -1;
return nparms >= 0 && nparms < 4 ? _valconai : -1;
return -1;
}
@ -1074,7 +1074,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
{
const int ndec = (nparms > 2) ? (int)stack.pop_real().integer() : 5;
const int tipo_calcolo = (nparms > 1) ? (int)stack.pop_real().integer() : 0;
const TString cat = stack.pop_string();
const TString cat = (nparms > 0) ? stack.pop_string() : EMPTY_STRING;
stack.push(ZERO);
@ -1106,7 +1106,6 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
if (tipo_calcolo == 0)
val *= ((CENTO - perc_esenz) / CENTO);
else
val *= (perc_esenz / CENTO);
}
val.round(ndec);
@ -1119,7 +1118,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
{
const int ndec = (nparms > 2) ? (int)stack.pop_real().integer() : 5;
const int tipo_calcolo = (nparms > 1) ? (int)stack.pop_real().integer() : 0;
const TString cat = stack.pop_string();
const TString cat = (nparms > 0) ? stack.pop_string() : EMPTY_STRING;
TString_array sottocat_found;
stack.push(ZERO);

View File

@ -59,7 +59,7 @@ int TLista_documenti::read(char provv, char tipocf, long clifo, int anno,
CHECKD(tipocf == ' ' || clifo > 0L, "Codice cliente non valido", clifo);
CHECKD(anno > 2000, "Anno non valido: ", anno);
CHECK(!tipidoc.empty_items(), "Lista dei tipi documento vuota");
CHECK(statidoc.items() == tipidoc.items(), "La lista degli stati documento non corrisponde alla lista dei tipi documento");
CHECK(!statidoc.empty_items(), "Lista degli stati documento vuota");
const int key = (tipocf == ' ' && clifo == 0L) ? 1:2;
TRelation doc(LF_DOC);
@ -149,11 +149,11 @@ int TLista_documenti::read(char provv, char tipocf, long clifo, int anno,
{
const TString & tipo = tipidoc.get(i);
if (tipo.blank() || tipo == "*" || tipodoc == tipo)
if (tipo.blank() || tipodoc == tipo)
{
const TString & stato = statidoc.get(i);
if (stato.blank() || tipo == "*" || statodoc == stato)
if (stato.blank() || statodoc == stato)
{
match = true;
break;

View File

@ -714,10 +714,11 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
// speciale per lo storno, proveniente da configurazione
const TString4 tipodet = r.get(RDOC_TIPODET);
const bool revcharge = r.get_bool(RDOC_REVCHARGE);
TString80 key;
TString80 key;
key.format("%d|%-4s|%c|%3d|%3d|%6ld|%s",
ord,(const char*)cod,c.tipo(),c.gruppo(),c.conto(),c.sottoconto(), (const char*)tipodet);
key.format("%d|%-4s|%c|%3d|%3d|%6ld|%s|%s",
ord,(const char*)cod,c.tipo(),c.gruppo(),c.conto(),c.sottoconto(), (const char*)tipodet, revcharge ? "X" : "");
// Nel caso di documenti a zero tiene distinte IVA positiva e negativa
if (r.doc().totale_doc().is_zero())
@ -745,6 +746,7 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
iva->add(RMI_IMPONIBILE, impon);
iva->put(RMI_TIPODET, tipodet);
iva->put(RMI_REVCHARGE, revcharge);
iva->add(RMI_IMPOSTA, imposta);
if (ord != 5)
{
@ -1204,7 +1206,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
}
// Codice registro IVA
const TRegistro& registro = _caus->reg();
TRegistro& registro = (TRegistro &) _caus->reg();
const bool iva_mov = registro.ok();
long ult_prot = registro.protocol();
@ -1219,12 +1221,8 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
{
if (_nump_iva) // Reperisce l'ultimo numero di protocollo dal registro IVA
{
const bool upd_prot = ini_get_bool(CONFIG_DITTA, "ve", "UpdateProtocol", true);
TRegistro reg(registro);
if (upd_prot)
ult_prot = reg.protocol();
ult_prot++;
registro.reread();
ult_prot = registro.protocol() + 1;
if (ult_prot <= 0)
{
_error = ultprot_error;
@ -2823,13 +2821,16 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
TPagamento& pag = doc.pagamento();
const TCurrency_documento totspese(doc.spese(), doc);
TCurrency_documento totimposte(doc.imposta(true), doc);
bool acquisto_revcharge = _caus->iva() == iva_acquisti && _caus->reverse_charge_pubb() ;
real imposte;
for (int j = _movimento->iva_items()-1; j >= 0; j--)
imposte += _movimento->iva(j).get_real(RMI_IMPOSTA) * (swapped ? -UNO : UNO);
if (!acquisto_revcharge || !_movimento->iva(j).get_bool(RDOC_REVCHARGE))
imposte += _movimento->iva(j).get_real(RMI_IMPOSTA) * (swapped ? -UNO : UNO);
if (_caus->iva() == iva_acquisti) // Ricalcola precisamente il totale imposte
{
{
real ti = imposte;
if (in_valuta)
cambio.eur2val(ti);
totimposte.set_num(ti);
@ -3226,16 +3227,12 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
}
if (_nump_iva) // Reperisce l'ultimo numero di protocollo dal registro IVA
{
const bool upd_prot = ini_get_bool(CONFIG_DITTA, "ve", "UpdateProtocol", true);
// TRegistro& registro = _caus->reg();
TRegistro registro(_caus->reg());
TRegistro reg(registro);
// non serve const bool upd_prot = ini_get_bool(CONFIG_DITTA, "ve", "UpdateProtocol", true);
TRegistro & reg = (TRegistro &) _caus->reg();
const int ult_prot = head.get_int(MOV_PROTIVA);
if (upd_prot)
reg.update(ult_prot, doc.data());
else
registro.update(ult_prot, doc.data());
reg.reread();
reg.update(ult_prot, doc.data());
}
// Aggiorno subito i saldi
if (_caus->soloiva())
@ -4427,14 +4424,30 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo
head.put(MOV_NUMREG,nr);
TSaldo_agg saldo;
if (!do_insert)
{
mov.read(_isequal, _lock);
aggiorna_saldi(saldo, mov, false);
protiva = head.get_long(MOV_PROTIVA);
}
if (protiva <= 0)
protiva = caus.reg().protocol()+1;
else
{
if (_nump_iva) // Reperisce l'ultimo numero di protocollo dal registro IVA
{
TRegistro &reg = (TRegistro & )caus.reg();
reg.reread();
protiva = reg.protocol() + 1;
if (protiva <= 0)
{
_error = ultprot_error;
return _error;
}
}
else
protiva = doc.numero();
}
head.put(MOV_DATAREG, datareg);
head.put(MOV_DATACOMP, _movimento->curr().get(MOV_DATACOMP));
@ -4478,17 +4491,21 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo
for (int ri = 0; ri < _movimento->iva_items(); ri++)
{
const TRectype& rmoviva = _movimento->iva(ri);
const real imponibile = rmoviva.get(RMI_IMPONIBILE);
const real imposta = rmoviva.get(RMI_IMPOSTA);
TRectype& rmi = mov.iva(ri);
rmi.put(RMI_IMPONIBILE, imponibile);
rmi.put(RMI_IMPOSTA, imposta);
rmi.put(RMI_CODIVA, rmoviva.get(RMI_CODIVA));
TBill zio; caus.bill(2, zio);
zio.put(rmi);
const bool revcharge = rmoviva.get(RMI_REVCHARGE);
totdoc += imponibile + imposta; // Incrementa totdoc
if (revcharge)
{
const real imponibile = rmoviva.get(RMI_IMPONIBILE);
const real imposta = rmoviva.get(RMI_IMPOSTA);
TRectype& rmi = mov.iva(ri);
rmi.put(RMI_IMPONIBILE, imponibile);
rmi.put(RMI_IMPOSTA, imposta);
rmi.put(RMI_CODIVA, rmoviva.get(RMI_CODIVA));
TBill zio; caus.bill(2, zio);
zio.put(rmi);
totdoc += imponibile + imposta; // Incrementa totdoc
}
}
head.put(MOV_TOTDOC, totdoc); // Non usare DOC_TOTDOC! Unico modo per gestire correttamente fatture e note di credito

View File

@ -282,7 +282,7 @@ int TDocumentoEsteso::readat(TBaseisamfile& file, TRecnotype nrec, word lockop)
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec)
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
_conai(NULL), _tic(NULL), _split(NULL)
_conai(nullptr), _tic(nullptr), _split(nullptr)
{
// Inizializza i parametri di default
@ -353,17 +353,36 @@ const TString & TDocumentoEsteso::tipo_doc_sdi() const
return tipo().tipo_doc_sdi();
}
TDocumentoEsteso::TDocumentoEsteso(const TDocumento & d)
: TDocumento(d), _sum_filter(-1), _sum_selected(false),
_scadenze_current(-1), _conai(nullptr), _tic(nullptr), _split(nullptr)
{
}
TDocumentoEsteso::TDocumentoEsteso(char provv, int anno, const char* codnum, long numdoc)
: TDocumento(provv, anno, codnum, numdoc), _sum_filter(-1), _sum_selected(false),
_scadenze_current(-1), _conai(nullptr), _tic(nullptr), _split(nullptr)
{
}
TDocumentoEsteso::TDocumentoEsteso(const TDoc_key & key)
: TDocumento(key), _sum_filter(-1), _sum_selected(false),
_scadenze_current(-1), _conai(nullptr), _tic(nullptr), _split(nullptr)
{
}
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, dec_parm & parm)
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
_conai(NULL), _tic(NULL), _split(NULL)
: TDocumento(rec), _sum_filter(-1), _sum_selected(false), _scadenze_current(-1),
_conai(nullptr), _tic(nullptr), _split(nullptr)
{
_parm = parm;
}
TDocumentoEsteso::TDocumentoEsteso()
: TDocumento(), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
_conai(NULL), _tic(NULL), _split(NULL)
{ }
: TDocumento(), _sum_filter(-1), _sum_selected(false), _scadenze_current(-1),
_conai(nullptr), _tic(nullptr), _split(nullptr)
{
}
TDocumentoEsteso::~TDocumentoEsteso()
{

View File

@ -91,9 +91,9 @@ public:
// Funzioni per settare i parametri
void set_decimals(const dec_parm & parm) { _parm = parm ; }
// void set_condv(TCli_for * cli); // Cambia le condizioni di vendita
TDocumentoEsteso(const TDocumento & d) : TDocumento(d) {};
TDocumentoEsteso(char provv, int anno, const char* codnum, long numdoc) : TDocumento(provv, anno, codnum, numdoc) {};
TDocumentoEsteso(const TDoc_key& key) : TDocumento(key) {};
TDocumentoEsteso(const TDocumento & d);
TDocumentoEsteso(char provv, int anno, const char* codnum, long numdoc);
TDocumentoEsteso(const TDoc_key& key);
TDocumentoEsteso (const TRectype & rec, dec_parm & parm) ;
TDocumentoEsteso (const TRectype & rec) ;
TDocumentoEsteso () ;

View File

@ -25,6 +25,7 @@
#include "../cg/cfban.h"
#include "../ca/cfcms.h"
#include "../ca/commesse.h"
#include "condv.h"
#include "rcondv.h"
#include "sconti.h"
@ -484,7 +485,8 @@ TDocumento_mask::~TDocumento_mask()
}
int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y,
short& dlg, short& dlgd, bool required)
short& dlg, short& dlgd, bool required,
const short contsep_id)
{
const int h = ca_create_fields(m, page, lf, 2, y, dlg, dlgd);
@ -512,14 +514,47 @@ int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y,
case LF_FASI : fieldname = DOC_FASCMS; break;
default : fieldname = DOC_CODCOSTO; break;
}
TFieldref* f = (TFieldref*)fld.field();
f->set_name(fieldname);
fld.check_type(required ? CHECK_REQUIRED : CHECK_NORMAL);
TEdit_field& dfld = m.efield(dlgd+i);
f->set_name(fieldname);
fld.check_type(required ? CHECK_REQUIRED : CHECK_NORMAL);
if (logic == LF_COMMESSE)
{
bool contsep_fld_exist = contsep_id >= 0;
if (contsep_fld_exist)
contsep_fld_exist = main_mask ? m.id2pos(contsep_id) >= 0 : sfield(F_SHEET).mask().id2pos(contsep_id) >= 0;
if (contsep_fld_exist && main_app().has_module(NPAUT, CHK_DONGLE))
{
TBrowse * b = fld.browse();
if (b != nullptr)
{
TCursor * c = b->cursor();
if (c != nullptr)
{
TString filter = c->filter();
const bool add = filter.full();
if (add)
{
filter.insert("(");
filter << ")&&(";
}
filter << "(" << COMMESSE_CONTSEP << "==\"\")||(" << COMMESSE_CONTSEP << "==#" << (main_mask ? contsep_id : -contsep_id) << ")";
if (add)
filter << ")";
c->setfilter(filter);
}
}
}
}
TEdit_field& dfld = m.efield(dlgd+i);
dfld.set_field(EMPTY_STRING); // Toglie campi che fan saltare gli output!
if (main_mask)
{
TSheet_field& sf = sfield(F_SHEET);
@ -594,7 +629,7 @@ void TDocumento_mask::insert_anal_page()
else
{
const bool cms_req = false; // ca_in_testa && ini.get_bool("CmsRequired"); // Ora gestisco il REQUIRED da codcms_handler
insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, cms_req);
insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, cms_req, F_CONTSEP);
}
set_field_handler(_cms_end, codcms_handler);
}
@ -623,7 +658,7 @@ void TDocumento_mask::insert_anal_page()
if (use_fsc && fasinfo.parent() == LF_COMMESSE)
insert_anal_fields(*this, newpage, LF_FASI, y, dlg, dlgd, true);
else
insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, true);
insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, true, F_CONTSEP);
if (use_fsc && fasinfo.parent() <= 0)
insert_anal_fields(*this, newpage, LF_FASI, y, dlg, dlgd, false);
add_button(dlg+1, newpage, TR("Generazione righe consegnate"), 2, y++, 32);
@ -1715,7 +1750,7 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga)
insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false);
else
{
insert_anal_fields(*m, page, LF_COMMESSE, y, dlg, dlgd, false);
insert_anal_fields(*m, page, LF_COMMESSE, y, dlg, dlgd, false, F_CONTSEP);
}
m->set_handler(_cms_end_sh, cms_mag_handler);
}

View File

@ -596,6 +596,7 @@ HIDDEN real curr_fc = UNO;
bool iva_handler( TMask_field& f, KEY key )
{
TDocumento_mask & mask = (TDocumento_mask &) f.mask().get_sheet()->mask();
TMask & row_mask = f.mask();
if (key == 0 || (key == K_ENTER && f.empty()))
{
@ -615,7 +616,6 @@ bool iva_handler( TMask_field& f, KEY key )
if (key == K_ENTER && /*f.focusdirty() &&*/ f.empty())
{
TMask & row_mask = f.mask();
const int r = row_mask.get_sheet()->selected() + 1;
const TRiga_documento& riga = mask.doc()[r];
@ -640,8 +640,20 @@ bool iva_handler( TMask_field& f, KEY key )
if (required)
return f.error_box(TR("Il codice IVA è obbligatorio."));
}
}
if (f.running_check(key))
{
TCodiceIVA i(f.get());
row_mask.set(FR_REVCHARGE, i.reverse_charge_attivo() ? "X" : "");
}
if (f.initial_check(key))
{
const int r = row_mask.get_sheet()->selected() + 1;
const TCausale & caus = cached_causale(mask.doc()[r].doc().tipo().causale());
f.mask().enable(FR_REVCHARGE, caus.reverse_charge_pubb());
}
if (key == K_ENTER)
{
TVariable_sheet_field * sf = (TVariable_sheet_field *)f.mask().get_sheet();

View File

@ -131,8 +131,10 @@
#define FR_PCON10 186
#define FR_CMAX (FR_PCON10-FR_CCON01+1)/2
#define FR_REVCHARGE 187
// Ultimo campo fittizio
#define FR_END 187
#define FR_END 188
#define MAX_COLUMNS FR_END-FR_LORDO
#define FR_DESMAG 270

View File

@ -1339,8 +1339,8 @@ ENDIF
INPUT S0 FR_DESIVA
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
OUTPUT FR_CODIVA CODTAB
OUTPUT FR_DESIVA S0
OUTPUT FR_CODIVA CODTAB
OUTPUT FR_DESIVA S0
IFDEF(FL_DESIVA)
FLAGS FL_DESIVA
ENDIF
@ -1350,9 +1350,28 @@ ENDIF
END
ENDIF
IFDEF(X_CODIVA)
DEFINE Y_REVCHARGE Y_CODIVA+1
DEFINE X_TIPODET X_CODIVA+20
ENDIF
BOOLEAN FR_REVCHARGE
BEGIN
IFDEF(X_CODIVA)
PROMPT X_CODIVA Y_REVCHARGE "Reverse charge"
ELSE
PROMPT 2 16 "Reverse charge"
ENDIF
FIELD REVCHARGE
END
STRING FR_TIPODET 1
BEGIN
PROMPT 2 16 "Indetraib. "
IFDEF(X_CODIVA)
PROMPT X_TIPODET Y_REVCHARGE "Indetraib. "
ELSE
PROMPT 20 16 "Indetraib. "
ENDIF
USE %DET
INPUT CODTAB FR_TIPODET
DISPLAY "Codice" CODTAB
@ -1360,9 +1379,9 @@ BEGIN
DISPLAY "Descrizione@50" S0
OUTPUT FR_TIPODET CODTAB
CHECKTYPE NORMAL
FIELD TIPODET
FLAGS "U"
END
ENDIF
IFDEF(FLD_ADDIVA)

View File

@ -520,6 +520,7 @@ XVTDLL BOOLEAN xvt_sql_driver(XVT_SQLDB handle, char* str, int max_size);
XVTDLL ULONG xvt_sql_execute(XVT_SQLDB handle, const char* sql, ODBC_CALLBACK cb, void* jolly);
XVTDLL SLIST xvt_sql_list_fields(XVT_SQLDB handle, const char* table);
XVTDLL SLIST xvt_sql_list_tables(XVT_SQLDB handle);
XVTDLL const char * xvt_sql_field_type(XVT_SQLDB handle, const char* table, const char* field);
XVTDLL XVT_SQLDB xvt_sql_open(const char* dsn, const char* usr, const char* pwd, const char* dir);
XVTDLL BOOLEAN xvt_sql_rollback(XVT_SQLDB handle);
XVTDLL BOOLEAN xvt_sql_table_exists(XVT_SQLDB handle, const char* name);

View File

@ -12,6 +12,7 @@ public:
virtual ULONG Execute(const char* sql, ODBC_CALLBACK cb, void* jolly) = 0;
virtual SLIST ListFields(const char* table) const = 0;
virtual SLIST ListTables() const = 0;
virtual wxString FindField(const char* strTable, const char* strField) const = 0;
virtual bool TableExists(const char* name) const;
virtual bool Begin() const { return false; }
@ -46,6 +47,8 @@ protected:
virtual ULONG Execute(const char* sql, ODBC_CALLBACK cb, void* jolly);
virtual SLIST ListFields(const char* table) const;
virtual SLIST ListTables() const;
virtual wxString FindField(const char* strTable, const char* strField) const;
virtual bool TableExists(const char* name) const;
public:
@ -245,6 +248,32 @@ SLIST XVT_SQLDB_SQLite3::ListFields(const char* strTable) const
return list;
}
wxString XVT_SQLDB_SQLite3::FindField(const char* strTable, const char* strField) const
{
wxString strType;
if (TableExists(strTable))
{
wxString strQuery; strQuery << "PRAGMA table_info(" << (const char*)strTable << ");";
try
{
wxSQLite3ResultSet rs = m_pDB->ExecuteQuery(strQuery);
while (rs.NextRow())
{
const wxString strFieldFound = rs.GetAsString(1);
if (strFieldFound == strField)
strType = rs.GetAsString(2);
}
}
catch (wxSQLite3Exception& e)
{
xvt_dm_post_error(e.GetMessage() + "\n" + strQuery);
}
}
return strType;
}
bool XVT_SQLDB_SQLite3::TableExists(const char* name) const
{
return m_pDB != NULL && name && *name && m_pDB->TableExists(name);
@ -349,6 +378,19 @@ SLIST xvt_sql_list_tables(XVT_SQLDB handle)
return list;
}
XVTDLL const char * xvt_sql_field_type(XVT_SQLDB handle, const char* table, const char* field)
{
XVT_SQLDataBase* db = (XVT_SQLDataBase*)handle;
static wxString strType;
strType = "";
if (db != NULL && db->IsOk())
strType = db->FindField(table, field);
return strType;
}
BOOLEAN xvt_sql_table_exists(XVT_SQLDB handle, const char* name)
{
BOOLEAN yes = FALSE;