diff --git a/build/fplib.vcxproj b/build/fplib.vcxproj
index 918acf333..11266a651 100644
--- a/build/fplib.vcxproj
+++ b/build/fplib.vcxproj
@@ -168,10 +168,11 @@
-
+
+
diff --git a/build/fplib.vcxproj.filters b/build/fplib.vcxproj.filters
index e6b867b3a..e1b32cde7 100644
--- a/build/fplib.vcxproj.filters
+++ b/build/fplib.vcxproj.filters
@@ -8,14 +8,17 @@
{afa0f493-bfe6-4bd2-add2-3256306ed9c5}
-
-
- Headers
-
-
Sources
+
+ Sources
+
+
+
+
+ Headers
+
\ No newline at end of file
diff --git a/build/mg0.vcxproj b/build/mg0.vcxproj
index 82dae5745..8c46d6960 100644
--- a/build/mg0.vcxproj
+++ b/build/mg0.vcxproj
@@ -1,5 +1,5 @@

-
+
Debug
@@ -13,15 +13,18 @@
{B184942F-568D-4B21-BD89-16908381BF8F}
mg0
+ 10.0.16299.0
Application
false
+ v141
Application
false
+ v141
@@ -99,6 +102,9 @@
$(IntDir)
+
+ "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://sha256timestamp.ws.symantec.com/sha256/timestamp /v "$(TargetPath)"
+
@@ -148,6 +154,9 @@
$(IntDir)
+
+ "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://sha256timestamp.ws.symantec.com/sha256/timestamp /v "$(TargetPath)"
+
@@ -267,7 +276,9 @@
-
+
+ ..\libraries\wx28X\include;%(AdditionalIncludeDirectories)
+
diff --git a/build/mg1.vcxproj b/build/mg1.vcxproj
index fb06fae02..e72ffa9da 100644
--- a/build/mg1.vcxproj
+++ b/build/mg1.vcxproj
@@ -1,5 +1,5 @@

-
+
Debug
@@ -13,15 +13,18 @@
{28F3586B-D475-4355-818D-8B1184179848}
mg1
+ 10.0.16299.0
Application
false
+ v141
Application
false
+ v141
@@ -96,6 +99,9 @@
Shout Out To My Ex
+
+ "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://sha256timestamp.ws.symantec.com/sha256/timestamp /v "$(TargetPath)"
+
@@ -145,6 +151,10 @@
Shout Out To My Ex
+
+
+
+
@@ -241,7 +251,9 @@
-
+
+ ..\libraries\wx28X\include;%(AdditionalIncludeDirectories)
+
diff --git a/build/mg3.vcxproj b/build/mg3.vcxproj
index e7413e802..5870e1fb3 100644
--- a/build/mg3.vcxproj
+++ b/build/mg3.vcxproj
@@ -1,5 +1,5 @@

-
+
Debug
@@ -12,15 +12,18 @@
{39CE744C-B605-40BD-BB78-0DEFE6E7C7F5}
+ 10.0.16299.0
Application
false
+ v141
Application
false
+ v141
@@ -95,6 +98,9 @@
true
.\..\release/mg3.bsc
+
+ "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://sha256timestamp.ws.symantec.com/sha256/timestamp /v "$(TargetPath)"
+
@@ -142,6 +148,10 @@
true
.\..\debug/mg3.bsc
+
+
+
+
@@ -284,7 +294,9 @@
-
+
+ ..\libraries\wx28X\include;%(AdditionalIncludeDirectories)
+
diff --git a/build/mg4.vcxproj b/build/mg4.vcxproj
index 5e723b2a2..fffa1aded 100644
--- a/build/mg4.vcxproj
+++ b/build/mg4.vcxproj
@@ -1,5 +1,5 @@

-
+
Debug
@@ -13,15 +13,18 @@
{6652496B-7D18-4A1A-956A-21220B61956F}
mg4
+ 10.0.16299.0
Application
false
+ v141
Application
false
+ v141
@@ -100,6 +103,9 @@
$(IntDir)
+
+ "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://sha256timestamp.ws.symantec.com/sha256/timestamp /v "$(TargetPath)"
+
@@ -234,7 +240,9 @@
-
+
+ ..\libraries\wx28X\include;%(AdditionalIncludeDirectories)
+
diff --git a/build/mg_masktab.vcxproj b/build/mg_masktab.vcxproj
index 0021c6f6d..ea2d4e87e 100644
--- a/build/mg_masktab.vcxproj
+++ b/build/mg_masktab.vcxproj
@@ -1,5 +1,5 @@

-
+
Debug
@@ -13,17 +13,20 @@
{7B861319-83F5-414C-A8D6-2A8B0D2F8919}
mg_masktab
+ 10.0.16299.0
Application
false
MultiByte
+ v141
Utility
false
MultiByte
+ v141
diff --git a/cd/test/ba0670.txt b/cd/test/ba0670.txt
new file mode 100644
index 000000000..41c59b326
--- /dev/null
+++ b/cd/test/ba0670.txt
@@ -0,0 +1,4 @@
+recdesc\f111.trr
+recdesc\f111.dir
+
+- Aggiunta del numero di riga di riferimento alla riga del movimento di magazzino
\ No newline at end of file
diff --git a/cd/test/ba0670a.ini b/cd/test/ba0670a.ini
new file mode 100644
index 000000000..a252f7ba3
--- /dev/null
+++ b/cd/test/ba0670a.ini
@@ -0,0 +1,32 @@
+[Main]
+Demo=0
+
+[ba2]
+File(236) = recdesc\f111.dir|X
+File(237) = recdesc\f111.trr|X
+Patch = 670
+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 = 08-01-2019
+Descrizione = Base
+Dischi = 1
+Moduli = sy
+OEM =
+Patch = 670
+PostProcess = bainst -0 BA
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/ba0670a1.zip b/cd/test/ba0670a1.zip
new file mode 100644
index 000000000..086f53b86
Binary files /dev/null and b/cd/test/ba0670a1.zip differ
diff --git a/cd/test/fp0666.txt b/cd/test/fp0666.txt
new file mode 100644
index 000000000..8d62331f8
--- /dev/null
+++ b/cd/test/fp0666.txt
@@ -0,0 +1,10 @@
+fp0.exe
+fp0100a.msk
+fp0200a.msk
+fp0300a.msk
+
+- Aggiunta di 3 nuovi parametri: esportazione clienti senza cod sdi nè pec (0000000), esportazione esteri, codice destinatario per esteri
+- La qta adesso è una stringa (così non viene arrotondata)
+- Aggiunto salvataggio campi maschera al riempimento dello sheet per salvare le configurazioni necessarie in esportazione
+- Sistemata scrittura conai per chi ha azzerato il record in ditta.ini
+- Aggiunta ricerca per ragione sociale nel programma di immissione massiva cod sdi e pec
\ No newline at end of file
diff --git a/cd/test/fp0666a.ini b/cd/test/fp0666a.ini
new file mode 100644
index 000000000..f30185e23
--- /dev/null
+++ b/cd/test/fp0666a.ini
@@ -0,0 +1,22 @@
+[Main]
+Demo=0
+
+[fp1]
+File(0) = fp0.exe|X
+File(1) = fp0100a.msk|X
+File(2) = fp0200a.msk|X
+File(3) = fp0300a.msk|X
+Patch = 666
+Versione = 21511200
+
+[fp]
+Data = 02-01-2019
+Descrizione = Fattura Elettronica
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 0666
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/fp0666a1.zip b/cd/test/fp0666a1.zip
new file mode 100644
index 000000000..3a1fe1e3f
Binary files /dev/null and b/cd/test/fp0666a1.zip differ
diff --git a/cd/test/fp0668.txt b/cd/test/fp0668.txt
new file mode 100644
index 000000000..145dede5a
--- /dev/null
+++ b/cd/test/fp0668.txt
@@ -0,0 +1,7 @@
+fp0.exe
+fp0100a.msk
+fp0300a.msk
+
+- Aggiunta gestione F8: con il flag attivo viene data la possibilità di segnare gli XML in uscita in errore
+- Aggiunto flag F8 in impostazione
+- Corretta lettura causale 770
\ No newline at end of file
diff --git a/cd/test/fp0668a.ini b/cd/test/fp0668a.ini
new file mode 100644
index 000000000..0e1e0dbb7
--- /dev/null
+++ b/cd/test/fp0668a.ini
@@ -0,0 +1,21 @@
+[Main]
+Demo=0
+
+[fp1]
+File(0) = fp0.exe|X
+File(1) = fp0100a.msk|X
+File(3) = fp0300a.msk|X
+Patch = 0668
+Versione = 21511200
+
+[fp]
+Data = 07-01-2019
+Descrizione = Fattura Elettronica
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 668
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/fp0668a1.zip b/cd/test/fp0668a1.zip
new file mode 100644
index 000000000..369f54ca4
Binary files /dev/null and b/cd/test/fp0668a1.zip differ
diff --git a/cd/test/fp0672.txt b/cd/test/fp0672.txt
new file mode 100644
index 000000000..cab1cf21b
--- /dev/null
+++ b/cd/test/fp0672.txt
@@ -0,0 +1,4 @@
+fp0.exe
+
+- Nuova gestione sheet di selezione documenti
+- Sistemata divisa estera
\ No newline at end of file
diff --git a/cd/test/fp0672a.ini b/cd/test/fp0672a.ini
new file mode 100644
index 000000000..28c900fc4
--- /dev/null
+++ b/cd/test/fp0672a.ini
@@ -0,0 +1,19 @@
+[Main]
+Demo=0
+
+[fp1]
+File(0) = fp0.exe|X
+Patch = 672
+Versione = 21511200
+
+[fp]
+Data = 10-01-2019
+Descrizione = Fattura Elettronica
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 672
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/fp0672a1.zip b/cd/test/fp0672a1.zip
new file mode 100644
index 000000000..c6f1a6b28
Binary files /dev/null and b/cd/test/fp0672a1.zip differ
diff --git a/cd/test/fp0674.txt b/cd/test/fp0674.txt
new file mode 100644
index 000000000..f8b4d2707
--- /dev/null
+++ b/cd/test/fp0674.txt
@@ -0,0 +1,5 @@
+fp0.exe
+
+Aggiunto prefisso e postfisso sul numero di fattura fp dal codice numerazione
+Ottimizzata gestione qta e prezzo
+Sistemato controllo codice sdi con aggiunta per stranieri con P.IVA italiana
\ No newline at end of file
diff --git a/cd/test/fp0674a.ini b/cd/test/fp0674a.ini
new file mode 100644
index 000000000..78529d2c3
--- /dev/null
+++ b/cd/test/fp0674a.ini
@@ -0,0 +1,19 @@
+[Main]
+Demo=0
+
+[fp1]
+File(0) = fp0.exe|X
+Patch = 0674
+Versione = 21511200
+
+[fp]
+Data = 14-01-2019
+Descrizione = Fattura Elettronica
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 674
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/fp0674a1.zip b/cd/test/fp0674a1.zip
new file mode 100644
index 000000000..851e82ac3
Binary files /dev/null and b/cd/test/fp0674a1.zip differ
diff --git a/cd/test/li0668.txt b/cd/test/li0668.txt
new file mode 100644
index 000000000..682c7f931
--- /dev/null
+++ b/cd/test/li0668.txt
@@ -0,0 +1,3 @@
+li0.exe
+
+Sistemato inserimento lettere intento 2019
\ No newline at end of file
diff --git a/cd/test/li0668a.ini b/cd/test/li0668a.ini
new file mode 100644
index 000000000..72291fc54
--- /dev/null
+++ b/cd/test/li0668a.ini
@@ -0,0 +1,19 @@
+[Main]
+Demo=0
+
+[li1]
+File(0) = li0.exe|X
+Patch = 0668
+Versione = 21511200
+
+[li]
+Data = 07-01-2019
+Descrizione = Dichiarazioni d'intento
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 668
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/li0668a1.zip b/cd/test/li0668a1.zip
new file mode 100644
index 000000000..18f9c6dd0
Binary files /dev/null and b/cd/test/li0668a1.zip differ
diff --git a/cd/test/mg0662.txt b/cd/test/mg0662.txt
new file mode 100644
index 000000000..26339b1ce
--- /dev/null
+++ b/cd/test/mg0662.txt
@@ -0,0 +1,3 @@
+mg1.exe
+
+Nella chiusura di magazzino provvisoria non azzerava le dotazioni che venivano raddoppiate
\ No newline at end of file
diff --git a/cd/test/mg0662a.ini b/cd/test/mg0662a.ini
new file mode 100644
index 000000000..e91cac75d
--- /dev/null
+++ b/cd/test/mg0662a.ini
@@ -0,0 +1,27 @@
+[Main]
+Demo=0
+
+[mg1]
+Edit_110 = mg1 -0
+File(2) = mg1.exe|X
+Patch = 662
+Versione = 21511200
+
+[mg99]
+Kill(0) = batbfcg.msk|x
+Kill(1) = batbubi.msk|x
+Kill(2) = efstbnp.rep|x
+Kill(3) = efstbnp.msk|x
+Kill(4) = eftbbnp.msk|x
+Kill(5) = bastfcg.msk|x
+
+[mg]
+Data = 28-12-2018
+Dischi = 1
+Moduli = ba,cg9,ve9,pr9,ef9
+OEM =
+Patch = 662
+PostProcess = bainst -0 MG
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/mg0662a1.zip b/cd/test/mg0662a1.zip
new file mode 100644
index 000000000..4fb3e659e
Binary files /dev/null and b/cd/test/mg0662a1.zip differ
diff --git a/cd/test/mr0676.txt b/cd/test/mr0676.txt
new file mode 100644
index 000000000..4d4db29c5
--- /dev/null
+++ b/cd/test/mr0676.txt
@@ -0,0 +1,2 @@
+mr0.exe
+Corretta richiesta variabili esportazione compass
diff --git a/cd/test/mr0676a.ini b/cd/test/mr0676a.ini
new file mode 100644
index 000000000..d585ad8eb
--- /dev/null
+++ b/cd/test/mr0676a.ini
@@ -0,0 +1,23 @@
+[Main]
+Demo=0
+
+[mr1]
+Edit_4 = mr0 -1
+Edit_5 = mr0 -1
+File(1) = mr0.exe|X
+Patch = 0676
+Versione = 21511200
+
+[mr]
+Data = 15-01-2019
+Descrizione = Manufacturing Resource Planning
+Dischi = 1
+Moduli = mg,db,ve
+OEM =
+Patch = 676
+PostProcess =
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/mr0676a1.zip b/cd/test/mr0676a1.zip
new file mode 100644
index 000000000..3d09e952c
Binary files /dev/null and b/cd/test/mr0676a1.zip differ
diff --git a/cd/test/sc0666.txt b/cd/test/sc0666.txt
new file mode 100644
index 000000000..265ad6264
--- /dev/null
+++ b/cd/test/sc0666.txt
@@ -0,0 +1,3 @@
+sc2600a.msk
+
+Ridistribuita la maschera sc2600a.msk
\ No newline at end of file
diff --git a/cd/test/sc0666a.ini b/cd/test/sc0666a.ini
new file mode 100644
index 000000000..8330f20ac
--- /dev/null
+++ b/cd/test/sc0666a.ini
@@ -0,0 +1,21 @@
+[Main]
+Demo=0
+
+[sc1]
+File(21) = sc2600a.msk|X
+Patch = 666
+Versione = 21511200
+
+[sc]
+Data = 02-01-2019
+Descrizione = Saldaconto
+Dischi = 1
+Moduli = ba,cg
+OEM =
+Patch = 666
+PostProcess =
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/sc0666a1.zip b/cd/test/sc0666a1.zip
new file mode 100644
index 000000000..50267b5c2
Binary files /dev/null and b/cd/test/sc0666a1.zip differ
diff --git a/cd/test/ve0664.txt b/cd/test/ve0664.txt
new file mode 100644
index 000000000..d3b94f460
--- /dev/null
+++ b/cd/test/ve0664.txt
@@ -0,0 +1,3 @@
+ve0.exe
+
+Sistemata eliminazione di righe generate automaticamente, prima prendeva tutte le righe del documento (comprese quelle generate in automatico) e siccome le trovava piene non cancellava le altre.
\ No newline at end of file
diff --git a/cd/test/ve0664a.ini b/cd/test/ve0664a.ini
new file mode 100644
index 000000000..48ddec26a
--- /dev/null
+++ b/cd/test/ve0664a.ini
@@ -0,0 +1,134 @@
+[Main]
+Demo=0
+
+[ve9]
+Edit_163 = ve0 -4
+Edit_33 = ve0 -0
+Edit_4 = ve0 -4
+Edit_47 = ve2 -3
+Edit_5 = ve0 -4
+File(137) = ve0.exe|X
+Patch = 0664
+Versione = 21511200
+
+[ve99]
+Kill(0) = batbcld.msk|x
+Kill(1) = bastspp.rep|x
+Kill(2) = basttri.msk|x
+Kill(3) = batbeld.msk|x
+Kill(4) = ve7700a.msk|x
+Kill(5) = batbspt.msk|x
+Kill(6) = ve7300a.msk|x
+Kill(7) = bastcra.rep|x
+Kill(8) = batbfca.msk|x
+Kill(9) = bastgcg.rep|x
+Kill(10) = bastabe.rep|x
+Kill(11) = batbpro.msk|x
+Kill(12) = bastgca.msk|x
+Kill(13) = ve7400a.msk|x
+Kill(14) = batbtag.msk|x
+Kill(15) = batbtri.msk|x
+Kill(16) = baststd.msk|x
+Kill(17) = baststd.rep|x
+Kill(18) = batbrfc.msk|x
+Kill(19) = ve7200a.msk|x
+Kill(20) = batbmre.msk|x
+Kill(21) = bastctr.msk|x
+Kill(22) = batbcau.msk|x
+Kill(23) = ve7400a.ini|x
+Kill(24) = basteld.rep|x
+Kill(25) = batbrfa.msk|x
+Kill(26) = bastcaa.rep|x
+Kill(27) = ve7701a.ini|x
+Kill(28) = bastfrd.rep|x
+Kill(29) = batbgcg.msk|x
+Kill(30) = bastums.rep|x
+Kill(31) = bastgca.rep|x
+Kill(32) = basttri.rep|x
+Kill(33) = batbfrr.msk|x
+Kill(34) = batbums.msk|x
+Kill(35) = bastimb.rep|x
+Kill(36) = bastfca.msk|x
+Kill(37) = bastfrr.msk|x
+Kill(38) = batbbnp.msk|x
+Kill(39) = bastasf.msk|x
+Kill(40) = bastnum.msk|x
+Kill(41) = bastfca.rep|x
+Kill(42) = ve7400conf.ini|x
+Kill(43) = ve7500a.msk|x
+Kill(44) = bastgmc.msk|x
+Kill(45) = bastfrm.rep|x
+Kill(46) = batbfsa.msk|x
+Kill(47) = basttip.rep|x
+Kill(48) = batbstd.msk|x
+Kill(49) = bastcau.msk|x
+Kill(50) = bastrfa.msk|x
+Kill(51) = bastnum.rep|x
+Kill(52) = bastubi.msk|x
+Kill(53) = ve7600a.msk|x
+Kill(54) = ve7100a.msk|x
+Kill(55) = batbprs.msk|x
+Kill(56) = batbspp.msk|x
+Kill(57) = batbcaa.msk|x
+Kill(58) = bastrfc.msk|x
+Kill(59) = bastimb.msk|x
+Kill(60) = bastums.msk|x
+Kill(61) = batbctr.msk|x
+Kill(62) = batbfid.msk|x
+Kill(63) = bastspp.msk|x
+Kill(64) = batbubi.msk|x
+Kill(65) = bastctr.rep|x
+Kill(66) = bastubi.rep|x
+Kill(67) = basttag.msk|x
+Kill(68) = bastcaa.msk|x
+Kill(69) = bastfrr.rep|x
+Kill(70) = bastcau.rep|x
+Kill(71) = batbtip.msk|x
+Kill(72) = basteld.msk|x
+Kill(73) = bastgcg.msk|x
+Kill(74) = ve7200a.frm|x
+Kill(75) = bastprs.rep|x
+Kill(76) = bastbnp.msk|x
+Kill(77) = batbgsa.msk|x
+Kill(78) = batbasf.msk|x
+Kill(79) = efstbnp.rep|x
+Kill(80) = eftbbnp.msk|x
+Kill(81) = basttag.rep|x
+Kill(82) = batbgca.msk|x
+Kill(83) = ve7.exe|x
+Kill(84) = ve7300a.frm|x
+Kill(85) = batbfrm.msk|x
+Kill(86) = bastrfc.rep|x
+Kill(87) = batbnum.msk|x
+Kill(88) = bastcra.msk|x
+Kill(89) = bastfrd.msk|x
+Kill(90) = bastprs.msk|x
+Kill(91) = batbcra.msk|x
+Kill(92) = bastasf.rep|x
+Kill(93) = bastabe.msk|x
+Kill(94) = batbgmc.msk|x
+Kill(95) = bastbnp.rep|x
+Kill(96) = efstbnp.msk|x
+Kill(97) = batbabe.msk|x
+Kill(98) = batbacr.msk|x
+Kill(99) = batbimb.msk|x
+Kill(100) = batbfrd.msk|x
+Kill(101) = batbprv.msk|x
+Kill(102) = bastgmc.rep|x
+Kill(103) = bastfrm.msk|x
+Kill(104) = basttip.msk|x
+Kill(105) = bastrfa.rep|x
+
+[ve]
+Data = 28-12-2018
+Descrizione = Vendite
+Dischi = 1
+Moduli = ba,cg9,pr9,mg9,sv9,in9,ef9
+OEM =
+Patch = 664
+PostProcess = bainst -0 VE
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/ve0664a1.zip b/cd/test/ve0664a1.zip
new file mode 100644
index 000000000..02f7bb776
Binary files /dev/null and b/cd/test/ve0664a1.zip differ
diff --git a/cd/test/ve0670.txt b/cd/test/ve0670.txt
new file mode 100644
index 000000000..8abbf0a6c
--- /dev/null
+++ b/cd/test/ve0670.txt
@@ -0,0 +1,18 @@
+ve5200.msk
+ve1.exe
+ve5.exe
+ve0.exe
+cg0200a.msk
+cg1.exe
+cg0.exe
+cg0500a.msk
+cg1500a.msk
+cgtbbnp.msk
+cgtbvet.msk
+cgtbnot.msk
+cg6.exe
+cgmenu.men
+cg1300m.msk
+pr0.exe
+
+- Aggiunta del numero di riga di riferimento alla riga del movimento di magazzino
diff --git a/cd/test/ve0670a.ini b/cd/test/ve0670a.ini
new file mode 100644
index 000000000..a1a280bb4
--- /dev/null
+++ b/cd/test/ve0670a.ini
@@ -0,0 +1,167 @@
+[Main]
+Demo=0
+
+[ve1]
+File(11) = ve1.exe|X
+File(28) = ve5.exe|X
+File(30) = ve5200.msk|X
+Patch = 670
+Versione = 21511200
+
+[ve9]
+Edit_163 = ve0 -4
+Edit_33 = ve0 -0
+Edit_4 = ve0 -4
+Edit_47 = ve2 -3
+Edit_5 = ve0 -4
+File(143) = ve0.exe|X
+Patch = 670
+Versione = 21511200
+
+[ve99]
+Kill(0) = batbcld.msk|x
+Kill(1) = bastspp.rep|x
+Kill(2) = baststd.rep|x
+Kill(3) = bastbnp.rep|x
+Kill(4) = ve7400a.msk|x
+Kill(5) = bastfrd.msk|x
+Kill(6) = bastprs.rep|x
+Kill(7) = basttip.msk|x
+Kill(8) = bastcaa.rep|x
+Kill(9) = efstbnp.msk|x
+Kill(10) = batbprs.msk|x
+Kill(11) = batbabe.msk|x
+Kill(12) = bastgca.msk|x
+Kill(13) = batbgmc.msk|x
+Kill(14) = bastcau.rep|x
+Kill(15) = bastcra.msk|x
+Kill(16) = bastspp.msk|x
+Kill(17) = basttag.rep|x
+Kill(18) = batbcau.msk|x
+Kill(19) = bastctr.rep|x
+Kill(20) = ve7500a.msk|x
+Kill(21) = bastasf.rep|x
+Kill(22) = bastums.rep|x
+Kill(23) = bastfrr.msk|x
+Kill(24) = basteld.rep|x
+Kill(25) = batbprv.msk|x
+Kill(26) = ve7200a.msk|x
+Kill(27) = batbgca.msk|x
+Kill(28) = batbmre.msk|x
+Kill(29) = bastcaa.msk|x
+Kill(30) = ve7700a.msk|x
+Kill(31) = batbtri.msk|x
+Kill(32) = basttip.rep|x
+Kill(33) = efstbnp.rep|x
+Kill(34) = baststd.msk|x
+Kill(35) = batbasf.msk|x
+Kill(36) = bastimb.msk|x
+Kill(37) = batbrfa.msk|x
+Kill(38) = ve7300a.msk|x
+Kill(39) = ve7600a.msk|x
+Kill(40) = batbspt.msk|x
+Kill(41) = bastfca.rep|x
+Kill(42) = bastrfc.msk|x
+Kill(43) = bastprs.msk|x
+Kill(44) = bastgcg.msk|x
+Kill(45) = batbspp.msk|x
+Kill(46) = batbgcg.msk|x
+Kill(47) = bastnum.rep|x
+Kill(48) = bastgmc.msk|x
+Kill(49) = batbrfc.msk|x
+Kill(50) = bastubi.msk|x
+Kill(51) = batbtag.msk|x
+Kill(52) = ve7400a.ini|x
+Kill(53) = bastrfa.msk|x
+Kill(54) = bastabe.rep|x
+Kill(55) = bastubi.rep|x
+Kill(56) = bastasf.msk|x
+Kill(57) = batbctr.msk|x
+Kill(58) = ve7100a.msk|x
+Kill(59) = batbcaa.msk|x
+Kill(60) = batbfid.msk|x
+Kill(61) = ve7300a.frm|x
+Kill(62) = bastfrr.rep|x
+Kill(63) = bastums.msk|x
+Kill(64) = basttri.rep|x
+Kill(65) = bastrfa.rep|x
+Kill(66) = bastcau.msk|x
+Kill(67) = batbtip.msk|x
+Kill(68) = batbubi.msk|x
+Kill(69) = basttag.msk|x
+Kill(70) = basteld.msk|x
+Kill(71) = bastimb.rep|x
+Kill(72) = bastrfc.rep|x
+Kill(73) = ve7.exe|x
+Kill(74) = ve7200a.frm|x
+Kill(75) = batbfrr.msk|x
+Kill(76) = bastfca.msk|x
+Kill(77) = batbfrd.msk|x
+Kill(78) = bastctr.msk|x
+Kill(79) = batbpro.msk|x
+Kill(80) = ve7400conf.ini|x
+Kill(81) = bastfrm.rep|x
+Kill(82) = batbbnp.msk|x
+Kill(83) = bastgca.rep|x
+Kill(84) = batbstd.msk|x
+Kill(85) = ve7701a.ini|x
+Kill(86) = batbfsa.msk|x
+Kill(87) = batbnum.msk|x
+Kill(88) = bastabe.msk|x
+Kill(89) = eftbbnp.msk|x
+Kill(90) = batbfca.msk|x
+Kill(91) = bastgcg.rep|x
+Kill(92) = batbgsa.msk|x
+Kill(93) = bastfrm.msk|x
+Kill(94) = bastbnp.msk|x
+Kill(95) = bastgmc.rep|x
+Kill(96) = bastcra.rep|x
+Kill(97) = bastfrd.rep|x
+Kill(98) = batbacr.msk|x
+Kill(99) = batbimb.msk|x
+Kill(100) = basttri.msk|x
+Kill(101) = bastnum.msk|x
+Kill(102) = batbeld.msk|x
+Kill(103) = batbums.msk|x
+Kill(104) = batbcra.msk|x
+Kill(105) = batbfrm.msk|x
+
+[cg9]
+Edit_19 = cg0 -0
+Edit_20 = cg0 -1
+Edit_26 = cg0 -4
+Edit_5 = cg0 -5
+File(123) = cg0.exe|X
+File(125) = cg0200a.msk|X
+File(129) = cg0500a.msk|X
+File(131) = cg1.exe|X
+File(143) = cg1500a.msk|X
+File(146) = cg6.exe|X
+File(169) = cgmenu.men|X
+File(202) = cgtbbnp.msk|X
+File(213) = cgtbnot.msk|X
+File(220) = cgtbvet.msk|X
+File(245) = cg1300m.msk|X
+Patch = 652
+Versione = 21511200
+
+[pr9]
+Edit_4 = pr0 -0
+Edit_5 = pr0 -0
+File(16) = pr0.exe|X
+Patch = 0862
+Versione = 21511200
+
+[ve]
+Data = 08-01-2019
+Descrizione = Vendite
+Dischi = 1
+Moduli = ba,cg9,pr9,mg9,sv9,in9,ef9
+OEM =
+Patch = 670
+PostProcess = bainst -0 VE
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/ve0670a1.zip b/cd/test/ve0670a1.zip
new file mode 100644
index 000000000..f772494ff
Binary files /dev/null and b/cd/test/ve0670a1.zip differ
diff --git a/src/fp/fp0100.cpp b/src/fp/fp0100.cpp
index 86c20ba16..b92c3ccda 100644
--- a/src/fp/fp0100.cpp
+++ b/src/fp/fp0100.cpp
@@ -10,7 +10,7 @@
#include "recset.h"
#include "progind.h"
#include "../ve/velib.h"
-#include "fplib01.h"
+#include "fplib.h"
class TParametri_mask : public TAutomask
{
@@ -34,28 +34,30 @@ TParametri_mask::TParametri_mask(const char * n) : TAutomask(n)
void TParametri_mask::save_all() const
{
- ini_set_string(CONFIG_DITTA, "fp", "ip", get(F_INDIRIZZO));
- ini_set_string(CONFIG_DITTA, "fp", "db", get(F_DATABASE));
- ini_set_string(CONFIG_DITTA, "fp", "usr", get(F_USER));
- ini_set_string(CONFIG_DITTA, "fp", "psw", encode(get(F_PASSWORD)));
- ini_set_string(CONFIG_DITTA, "fp", "flddest", get(F_FLDDEST));
- ini_set_string(CONFIG_DITTA, "fp", "fldusrdest", get(F_FLDUSRDEST));
- ini_set_string(CONFIG_DITTA, "fp", "cofitras", get(F_COFI));
- ini_set_bool(CONFIG_DITTA, "fp", "gestioneallegati", get_bool(F_ESPORTAALLEG));
- ini_set_bool(CONFIG_DITTA, "fp", "allegafatt", get_bool(F_ESPORTADOC));
+ fp_settings().set_db_indirizzo(get(F_INDIRIZZO));
+ fp_settings().set_db_database(get(F_DATABASE));
+ fp_settings().set_db_user(get(F_USER));
+ fp_settings().set_db_password(get(F_PASSWORD));
+ fp_settings().set_fld_dest(get(F_FLDDEST));
+ fp_settings().set_fld_dest_usr(get(F_FLDUSRDEST));
+ fp_settings().set_cofi_tras(get(F_COFI));
+ fp_settings().set_gest_alleg(get_bool(F_ESPORTAALLEG));
+ fp_settings().set_allega_fat(get_bool(F_ESPORTADOC));
+ fp_settings().set_f8(get_bool(F_F8));
}
void TParametri_mask::load_all()
{
- set(F_INDIRIZZO, ini_get_string(CONFIG_DITTA, "fp", "ip"));
- set(F_DATABASE, ini_get_string(CONFIG_DITTA, "fp", "db"));
- set(F_USER, ini_get_string(CONFIG_DITTA, "fp", "usr"));
- set(F_PASSWORD, decode(ini_get_string(CONFIG_DITTA, "fp", "psw")));
- set(F_FLDDEST, ini_get_string(CONFIG_DITTA, "fp", "flddest"));
- set(F_FLDUSRDEST, ini_get_string(CONFIG_DITTA, "fp", "fldusrdest"));
- set(F_COFI, ini_get_string(CONFIG_DITTA, "fp", "cofitras"));
- set(F_ESPORTAALLEG, ini_get_bool(CONFIG_DITTA, "fp", "gestioneallegati"));
- set(F_ESPORTADOC, ini_get_bool(CONFIG_DITTA, "fp", "allegafatt"));
+ set(F_INDIRIZZO, fp_settings().get_db_indirizzo());
+ set(F_DATABASE, fp_settings().get_db_database());
+ set(F_USER, fp_settings().get_db_user());
+ set(F_PASSWORD, fp_settings().get_db_password());
+ set(F_FLDDEST, fp_settings().get_fld_dest());
+ set(F_FLDUSRDEST, fp_settings().get_fld_dest_usr());
+ set(F_COFI, fp_settings().get_cofi_tras());
+ set(F_ESPORTAALLEG, fp_settings().get_gest_alleg());
+ set(F_ESPORTADOC, fp_settings().get_allega_fat());
+ set(F_F8, fp_settings().is_f8());
}
void TParametri_mask::tipi_import() const
diff --git a/src/fp/fp0100a.h b/src/fp/fp0100a.h
index 3fdd14a1f..3ae808356 100644
--- a/src/fp/fp0100a.h
+++ b/src/fp/fp0100a.h
@@ -7,6 +7,7 @@
#define F_COFI 107
#define F_ESPORTAALLEG 108
#define F_ESPORTADOC 109
+#define F_F8 110
#define F_SETPATCH 201
#define F_ENPTYTABLE 202
diff --git a/src/fp/fp0100a.uml b/src/fp/fp0100a.uml
index 4272b5ea2..adc20e7d4 100644
--- a/src/fp/fp0100a.uml
+++ b/src/fp/fp0100a.uml
@@ -3,16 +3,6 @@
TOOLBAR "topbar" 0 0 0 2
#include
-/*
-
-BUTTON DLG_ELABORA 2 2
-BEGIN
- PROMPT 1 1 "Imp. Tipi Doc"
- PICTURE TOOL_ELABORA
- FLAGS "HD"
-END
-*/
-
ENDPAGE
PAGE "Configurazione FP" 0 2 0 0
@@ -62,6 +52,11 @@ BEGIN
CHECKTYPE REQUIRED
END
+BOOLEAN F_F8
+BEGIN
+ PROMPT 50 8 "Gestione F8"
+END
+
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 10 "@BConfigurazione Allegati"
diff --git a/src/fp/fp0200.cpp b/src/fp/fp0200.cpp
index dbdce24b9..487121ef2 100644
--- a/src/fp/fp0200.cpp
+++ b/src/fp/fp0200.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include "fplib01.h"
+#include "fplib.h"
#include
#include
#include
@@ -92,6 +92,7 @@ bool TCC_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
void TCC_mask::fill()
{
TSheet_field& righe = sfield(F_RIGHE);
+ righe.reset();
TString_array& sht = righe.rows_array();
TString query;
diff --git a/src/fp/fp0200a.h b/src/fp/fp0200a.h
index 0b551e721..de24a398f 100644
--- a/src/fp/fp0200a.h
+++ b/src/fp/fp0200a.h
@@ -7,4 +7,6 @@
#define F_TIPOCF 201
#define F_DACODCF 202
#define F_ACODCF 203
-#define F_RIGHE 204
\ No newline at end of file
+#define F_DARAGSOC 204
+#define F_ARAGSOC 205
+#define F_RIGHE 206
\ No newline at end of file
diff --git a/src/fp/fp0200a.uml b/src/fp/fp0200a.uml
index e6fcbefd2..27a0b28f0 100644
--- a/src/fp/fp0200a.uml
+++ b/src/fp/fp0200a.uml
@@ -37,13 +37,26 @@ BEGIN
DISPLAY "Codice Fiscale@16" COFI
DISPLAY "Partita IVA@15" PAIV
OUTPUT F_DACODCF CODCF
+ OUTPUT F_DARAGSOC RAGSOC
CHEKTYPE NORMAL
FLAGS ""
END
+STRING F_DARAGSOC 50
+BEGIN
+ PROMPT 40 1 ""
+ KEY 2
+ USE LF_CLIFO KEY 2
+ INPUT TIPOCF F_TIPOCF SELECT
+ INPUT RAGSOC F_DARAGSOC
+ COPY DISPLAY F_DACODCF
+ COPY OUTPUT F_DACODCF
+ CHECKTYPE NORMAL
+END
+
NUMBER F_ACODCF 6
BEGIN
- PROMPT 40 1 "A codice"
+ PROMPT 20 2 "A codice "
USE LF_CLIFO
INPUT TIPOCF F_TIPOCF SELECT
INPUT CODCF F_ACODCF
@@ -53,10 +66,23 @@ BEGIN
DISPLAY "Codice Fiscale@16" COFI
DISPLAY "Partita IVA@15" PAIV
OUTPUT F_ACODCF CODCF
+ OUTPUT F_ARAGSOC RAGSOC
CHEKTYPE NORMAL
FLAGS ""
END
+STRING F_ARAGSOC 50
+BEGIN
+ PROMPT 40 2 ""
+ KEY 2
+ USE LF_CLIFO KEY 2
+ INPUT TIPOCF F_TIPOCF SELECT
+ INPUT RAGSOC F_ARAGSOC
+ COPY DISPLAY F_ACODCF
+ COPY OUTPUT F_ACODCF
+ CHECKTYPE NORMAL
+END
+
SPREADSHEET F_RIGHE
BEGIN
diff --git a/src/fp/fp0300.cpp b/src/fp/fp0300.cpp
index 7c8bb7a24..930050425 100644
--- a/src/fp/fp0300.cpp
+++ b/src/fp/fp0300.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include "fplib01.h"
+#include "fplib.h"
#include
#include
#include
@@ -35,6 +35,7 @@ protected:
bool check_not_empty();
bool check_full_fields() const;
bool check_doc_filter(const TDocumentoEsteso& td) const;
+ void set_err_paf();
void fill();
void init();
bool is_fattura(const TRectype& doc) const;
@@ -67,18 +68,14 @@ void TPA_mask::save_all_fields() const
ini_set_string(CONFIG_DITTA, "fp", "dataini", get(F_DATAINI));
ini_set_string(CONFIG_DITTA, "fp", "dataend", get(F_DATAEND));
- TToken_string tipidocs(get_tmp_string(), ';');
- FOR_EACH_SHEET_ROW(sfield(F_DOCUMENTI_TIPO), n, r)
- {
- TToken_string app;
- // Prendo tutta la riga tranne il cod sdi
- app.add(r->get(_codnum));
- app.add(r->get(_tipodoc));
- app.add(r->get(_dastato));
- app.add(r->get(_astato));
- tipidocs.add(app);
- }
- ini_set_string(CONFIG_DITTA, "fp", "accepted_docs", tipidocs);
+ // Salvo lo sheet
+ TFP_selected_docs selected_docs;
+ selected_docs.save_sheet(sfield(F_DOCUMENTI_TIPO));
+
+ // Salvo le impostazioni
+ fp_settings().set_esp_pri_empty(get_bool(F_SETDEFCOD));
+ fp_settings().set_esp_est(get_bool(F_SETCODEST));
+ fp_settings().set_esp_est_cod(get(F_VALCODEST));
}
void TPA_mask::load_all_fields()
@@ -91,7 +88,14 @@ void TPA_mask::load_all_fields()
auto& sheet = sfield(F_DOCUMENTI_TIPO);
sheet.hide();
- if(s_accepted_docs.full())
+ TFP_selected_docs selected_docs;
+
+ if (selected_docs.has_selected_docs())
+ {
+ // Super nuova gestione super avanzata!
+ selected_docs.fill_sheet(sheet);
+ }
+ else if(s_accepted_docs.full())
{
// Nuova gestione avanzata!
FOR_EACH_STR_TOKEN(s_accepted_docs, tok)
@@ -119,6 +123,10 @@ void TPA_mask::load_all_fields()
}
sheet.force_update();
sheet.show();
+
+ set(F_SETDEFCOD, fp_settings().get_esp_pri_empty());
+ set(F_SETCODEST, fp_settings().get_esp_est());
+ set(F_VALCODEST, fp_settings().get_esp_est_cod());
}
TString& add_filter(const TString& field, const TString& from, const TString& to)
@@ -144,6 +152,9 @@ TString& add_filter(const TString& field, const TString& from, const TString& to
void TPA_mask::fill()
{
+ // Salvo subito su file le impostazioni di esportazione, in fplib accedo ai file
+ save_all_fields();
+
TSheet_field& docs = sfield(F_DOCS);
TString_array& sht = docs.rows_array();
docs.hide();
@@ -156,8 +167,10 @@ void TPA_mask::fill()
#ifdef DBG
enable(DLG_OK);
+ enable(DLG_SAVEREC);
#else
enable(DLG_OK, filter_selected != "X");
+ enable(DLG_SAVEREC, fp_settings().is_f8() && filter_selected == "X");
#endif
// Record di controllo per eventuali elaborazioni precedenti
@@ -226,32 +239,22 @@ void TPA_mask::fill()
row.add(rec.get(DOC_DATADOC).as_date());
row.add(rec.get(CFV_CODCF).as_int());
row.add(rec.get("20." CLI_RAGSOC).as_string());
- TString rif = rec.get("17." CFV_PADESTIN).as_string();
- if (rif.empty())
- rif = rec.get("20.PEC").as_string();
+
+ TString rif = get_dest_sdi(rec.get(CFV_TIPOCF).as_string()[0], rec.get(CFV_CODCF).as_int());
// Se è ancora vuoto potrebbe essere estero
if(rif.empty())
{
- static TString codcf; codcf.cut(0) << "C|" << rec.get(CFV_CODCF).as_string();
- TAnagrafica a(LF_CLIFO, codcf);
- if (a.estero())
- rif = "XXXXXXX";
- else
- {
- // Segno la riga errata
- if (first)
- {
- first = false;
- // Abilito la colonna del codice ufficio per segnalare l'errore
- docs.enable_column(docs.cid2index(S_UFFICIO));
- }
- docs.set_back_and_fore_color(COLOR_RED, COLOR_WHITE, rec.current_row(), docs.cid2index(S_UFFICIO));
-
- fat_no_cod++;
- }
+ // Segno la riga errata
+ if (first)
+ {
+ first = false;
+ // Abilito la colonna del codice ufficio per segnalare l'errore
+ docs.enable_column(docs.cid2index(S_UFFICIO));
+ }
+ docs.set_back_and_fore_color(COLOR_RED, COLOR_WHITE, rec.current_row(), docs.cid2index(S_UFFICIO));
+ fat_no_cod++;
}
- if(rif.full())
- docs.set_back_and_fore_color(COLOR_WHITE, COLOR_BLACK, rec.cursor()->pos(), docs.cid2index(S_UFFICIO));
+;
row.add(rif);
row.add(rec.get("17." CFV_PARIFAMM).as_string());
row.add(rec.get("20." CLI_COFI).as_string());
@@ -340,6 +343,12 @@ bool TPA_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
}
}
break;
+ case DLG_SAVEREC:
+ {
+ if (e == fe_button)
+ set_err_paf();
+ }
+ break;
default: break;
}
if((e == fe_modify || e >= se_enter) && jolly == 0)
@@ -415,6 +424,64 @@ bool TPA_mask::check_doc_filter(const TDocumentoEsteso& d) const
return false;
}
+void TPA_mask::set_err_paf()
+{
+ // Vado a riportare sui paf l'errore
+ TSheet_field& sfld = sfield(F_DOCS);
+ TString_array& sht = sfld.rows_array();
+ TLocalisamfile fdoc(LF_DOC);
+ if (!sht.empty())
+ {
+ TProgress_monitor pi(sht.items(), "Cambio stato fatture");
+ FOR_EACH_ARRAY_ROW(sht, r, riga)
+ {
+ if (!pi.add_status())
+ break;
+
+ if (riga->starts_with("X"))
+ {
+ const int anno = riga->get_int(sfield(F_DOCS).cid2index(S_ANNO));
+ const long ndoc = riga->get_long(sfield(F_DOCS).cid2index(S_NDOC));
+ const TFixed_string codnum(riga->get(sfield(F_DOCS).cid2index(S_CODNUM))); // lascio sapientemente per ultima la get di una stringa
+ const TDoc_key key(anno, codnum, ndoc);
+
+ // Ricontrollo che la fattura sia presente in Campo prima di cambiare stato
+ fdoc.zero();
+ fdoc.put(DOC_PROVV, key.provv());
+ fdoc.put(DOC_ANNO, key.anno());
+ fdoc.put(DOC_CODNUM, key.codnum());
+ fdoc.put(DOC_NDOC, key.ndoc());
+
+ TString hfatt, bfatt;
+ TPaf_record paf0100f("PAF0100F");
+ if (fdoc.read() == NOERR && chiave_paf(fdoc.curr(), hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt))
+ {
+ TString query = "UPDATE PAF0100F SET P1_GESTIONE = 'E' WHERE P1_KEYHEADERFATT = '"; query << hfatt << "' AND P1_KEYBODYFATT = '" << bfatt << "';";
+ if(!fp_db().sq_set_exec(query))
+ {
+ TString err = "Impossibile salvare la fattura "; err << anno << " " << codnum << " " << ndoc << "\nVerrà saltata.";
+ error_box(err);
+ }
+
+ }
+ else
+ {
+ TString err = "Impossibile trovare la fattura "; err << anno << " " << codnum << " " << ndoc << "\nVerrà saltata.";
+ error_box(err);
+ }
+ }
+ }
+ fp_db().sq_commit();
+ }
+
+ // Mi sposto nella prima pagina, setto il flag di dirty sul filtro e mi risposto
+ // Lo faccio perchè eliminando la riga direttamente e chiamando la force_update() si crea un bug che cliccando sulla prima riga viene mostrata quella che c'era prima della eliminazione
+ TAutomask::next_page(0);
+ set_focus_field(F_DATAINI);
+ _filter_changed = true;
+ next_page(1);
+}
+
/////////////////////////////////////////////////////////////////////////////////////
// TDoc2Paf
@@ -470,18 +537,18 @@ void TDoc2Paf::main_loop()
if (elab.doc_to_paf(key))
ndocs++;
+ else
+ {
+ if (!yesno_box("L'ultima fattura non è stata esportata, continuare?"))
+ break;
+ }
}
}
}
}
if (ndocs > 0)
{
- if (elab.commit() > 0)
- {
- mask.save_all_fields();
- message_box(FR("Sono stati elaborati %d documenti"), ndocs);
- }
- else
+ if (elab.commit() <= 0)
error_box("Errore durante il salvataggio");
elab.show_log();
}
diff --git a/src/fp/fp0300a.h b/src/fp/fp0300a.h
index fb82f848e..5d82a8078 100644
--- a/src/fp/fp0300a.h
+++ b/src/fp/fp0300a.h
@@ -1,8 +1,11 @@
-#define START_MASK 301
-#define F_DATAINI 401
-#define F_DATAEND 402
-#define F_FATTSEL 403
-#define END_MASK 499
+#define START_MASK 401
+#define F_DATAINI 401
+#define F_DATAEND 402
+#define F_FATTSEL 403
+#define F_SETDEFCOD 404
+#define F_SETCODEST 405
+#define F_VALCODEST 406
+#define END_MASK 499
#define F_DOCUMENTI_TIPO 301
diff --git a/src/fp/fp0300a.uml b/src/fp/fp0300a.uml
index 764843611..70e0636f3 100644
--- a/src/fp/fp0300a.uml
+++ b/src/fp/fp0300a.uml
@@ -2,7 +2,28 @@
TOOLBAR "topbar" 0 0 0 2
-#include
+BUTTON DLG_ALL 2 2
+BEGIN
+ PROMPT 1 1 "~Tutti"
+ PICTURE TOOL_MULTISEL
+END
+
+BUTTON DLG_OK 2 2
+BEGIN
+ PROMPT 1 1 "Elabora"
+ PICTURE TOOL_ELABORA
+ FLAGS "D"
+END
+
+BUTTON DLG_SAVEREC 2 2
+BEGIN
+ PROMPT 1 1 "Elimina"
+ PICTURE TOOL_WARNING
+ FLAGS "D"
+END
+
+#include
+
ENDPAGE
PAGE "Fatturazione Elettronica" 0 2 0 0
@@ -41,6 +62,32 @@ BEGIN
ITEM "Tipo SDI"
END
+GROUPBOX DLG_NULL 78 4
+BEGIN
+ PROMPT 1 12 "@BConfigurazione Esportazione"
+END
+
+
+BOOLEAN F_SETDEFCOD
+BEGIN
+ PROMPT 2 13 "Esporta privati con codice '0000000' se privi sia di pec che di cod. destinatario"
+END
+
+BOOLEAN F_SETCODEST
+BEGIN
+ PROMPT 2 14 "Esporta esteri con codice"
+ MESSAGE TRUE ENABLE,F_VALCODEST
+ MESSAGE FALSE DISABLE,F_VALCODEST
+END
+
+STRING F_VALCODEST 7
+BEGIN
+ PROMPT 40 14 ""
+ CHECKTYPE REQUIRED
+ FLAG "D"
+END
+
+
ENDPAGE
PAGE "Elenco Fatture" 0 2 0 0
diff --git a/src/fp/fplib01.h b/src/fp/fplib.h
similarity index 68%
rename from src/fp/fplib01.h
rename to src/fp/fplib.h
index c223d41b8..4baf23481 100644
--- a/src/fp/fplib01.h
+++ b/src/fp/fplib.h
@@ -1,5 +1,5 @@
-#ifndef __FPLIB01_H
-#define __FPLIB01_H
+#ifndef __FPLIB_H
+#define __FPLIB_H
#include
#include
@@ -9,6 +9,7 @@
#include "../fe/felib.h"
#include
#include
+#include
#define SQL_FLD "sql/"
#define CARATTERI_SPECIALI "àèéìòù°'\\"
@@ -20,6 +21,9 @@ bool check_tables();
// Genera la chiave per i paf
bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt);
bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt);
+// Ritorna cod sdi, pec o vuoto. Chiama get_coddest()
+TString get_dest_sdi(const char tipocf, const long codcf);
+// Valorizza codice sdi e pec in base alle configurazioni del monitor
bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& pec);
inline const TString& no_special(char a);
const TString& tipo_doc_sdi(const TDocumento& doc);
@@ -74,7 +78,7 @@ public:
};
// Gestione PAF
-class TDoc_fp
+class TDoc_fp : public TObject
{
private:
TRectype* _doc_rec;
@@ -91,7 +95,9 @@ private:
bool _cache_insert;
vector _query;
TString8 _hfatt; // Codice univoco di 6 caratteri dell'ufficio P.A. o di 7 caratteri per un privato
- TString20 _bfatt; // Codice univoco di 20 caratteri del documento
+ TString _bfatt; // Codice univoco di 20 caratteri del documento
+ TString _conai_str;
+
struct
{
bool _is_valuta_estera; // Se il documento è in valuta estera
@@ -124,7 +130,7 @@ protected:
bool add_row_art(long& riga_art, const TString codice_tipo, const TString& codice_valore, TPaf_record& paf);
bool add_row_alleg(TFilename& file, long& nprogr, TPaf_record& paf);
const TString& converti_prezzo(const real& prezzo) const;
- void set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc);
+ void set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc) const;
public:
bool doc_to_paf(TDocumentoEsteso& doc);
@@ -143,6 +149,66 @@ public:
~TDoc_fp();
};
+class TFP_settings : public TObject
+{
+public:
+ // Getters
+ const TString& get_db_indirizzo() const;
+ const TString& get_db_database() const;
+ const TString& get_db_str_con() const;
+ const TString& get_db_user() const;
+ const TString& get_db_password() const;
+ const TString& get_fld_dest() const;
+ const TString& get_fld_dest_usr() const;
+ const TString& get_cofi_tras() const;
+ const bool get_gest_alleg() const;
+ const bool get_allega_fat() const;
+ const bool get_esp_pri_empty() const;
+ const bool get_esp_est() const;
+ const TString& get_esp_est_cod() const;
+ const bool is_f8() const;
+ // Setters
+ void set_db_indirizzo(const TString& ind) const;
+ void set_db_database(const TString& db) const;
+ void set_db_user(const TString& usr) const;
+ void set_db_password(const TString& psw) const;
+ void set_fld_dest(const TString& fld_dest) const;
+ void set_fld_dest_usr(const TString& fld_dest_usr) const;
+ void set_cofi_tras(const TString& cofi) const;
+ void set_gest_alleg(bool gest_alleg) const;
+ void set_allega_fat(bool allega_fatt) const;
+ void set_esp_pri_empty(bool esp_pri) const;
+ void set_esp_est(bool esp_est) const;
+ void set_esp_est_cod(const TString& esp_est_cod) const;
+ void set_f8(bool f8) const;
+};
-#endif // __FPLIB01_H
+inline TFP_settings& fp_settings()
+{
+ static TFP_settings* erbuggo = nullptr;
+ if(erbuggo == nullptr)
+ {
+ erbuggo = new TFP_settings();
+ }
+ return *erbuggo;
+}
+
+class TFP_selected_docs : public TObject
+{
+ TRelation _r_tabmod;
+ TRectype _flt;
+ std::unique_ptr _cur;
+ TRectype fill_rectype() const;
+
+ enum { _codnum, _tipodoc, _dastato, _astato, _tiposdi };
+
+public:
+ void fill_sheet(TSheet_field& sheet) const;
+ inline bool has_selected_docs() const { return _cur->items() > 0; }
+ void save_sheet(const TSheet_field& sheet) const;
+
+ TFP_selected_docs();
+};
+
+#endif // __FPLIB_H
diff --git a/src/fp/fplib01.cpp b/src/fp/fplib01.cpp
index 91c1116c4..7245c47cf 100644
--- a/src/fp/fplib01.cpp
+++ b/src/fp/fplib01.cpp
@@ -1,4 +1,4 @@
-#include "fplib01.h"
+#include "fplib.h"
#include
#include
#include
@@ -27,7 +27,7 @@
void set_connection(SSimple_query& s)
{
#ifdef DBG
- TString ip = ini_get_string(CONFIG_DITTA, "fp", "ip");
+ TString ip = fp_settings().get_db_indirizzo();
if (ip.upper() != "TESTCAMPO2012")
{
if (s.sq_connect("TESTCAMPO2012@campo_fp",
@@ -40,9 +40,9 @@ void set_connection(SSimple_query& s)
{
#endif
if (s.sq_connect(
- TString() << ini_get_string(CONFIG_DITTA, "fp", "ip") << "@" << ini_get_string(CONFIG_DITTA, "fp", "db"),
- ini_get_string(CONFIG_DITTA, "fp", "usr"),
- decode(ini_get_string(CONFIG_DITTA, "fp", "psw")),
+ fp_settings().get_db_str_con(),
+ fp_settings().get_db_user(),
+ fp_settings().get_db_password(),
TSDB_MSSQL) != NOERR)
fatal_box("Impossibile connettersi al DB esterno");
#ifdef DBG
@@ -150,7 +150,10 @@ bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt)
CHECK(hfatt.full(), "Destinatario fattura P.A. non valido");
const TCodice_numerazione& codnum = doc.codice_numerazione();
- bfatt.cut(0) << doc.get_date(DOC_DATADOC).date2ansi() << '_' << tipo_doc_sdi(doc) << '_' << doc.numero();
+ TString full_num;
+ codnum.complete_num(doc.numero(), full_num);
+ //20180101_TD01_123456712345671234567
+ bfatt.cut(0) << doc.get_date(DOC_DATADOC).date2ansi() << '_' << tipo_doc_sdi(doc) << '_' << full_num;
return hfatt.full() && bfatt.full();
}
@@ -162,28 +165,33 @@ bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt)
return hfatt.full();
}
+TString get_dest_sdi(const char tipocf, const long codcf)
+{
+ TString codsdi, pec;
+ get_coddest(tipocf, codcf, codsdi, pec);
+ return pec.full() ? pec : codsdi;
+}
+
bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& pec)
{
TCli_for clifo(tipocf, codcf);
coddest = clifo.vendite().get("PADESTIN");
pec = clifo.get("PEC");
- bool enapec = false;
+ TAnagrafica anag(LF_CLIFO, tipocf, codcf);
if (coddest.empty())
{
- coddest = "0000000";
- // Controllo se ha la pec
- if (pec.full())
- {
- enapec = true;
- }
+ if (pec.full() || fp_settings().get_esp_pri_empty())
+ coddest = "0000000";
// Controllo se è straniero
- else if (TAnagrafica(LF_CLIFO, tipocf, codcf).estero())
+ else if (anag.estero() && anag.stato_partita_IVA() != "IT")
{
- coddest = "XXXXXXX";
+ coddest = fp_settings().get_esp_est() ? fp_settings().get_esp_est_cod() : "";
}
}
+ else
+ pec = "";
// Dopo la versione 1.2 torna sempre true
- return true;
+ return coddest.full();
}
inline const TString& no_special(char a)
@@ -311,42 +319,42 @@ const TVariant& TPaf_record::get(const char* fld) const
// Converte un variant in una stringa valida per SQLite
const TString& TPaf_record::var2str(const TString& fldname, const TVariant& var) const
{
- const TFieldtypes vt = var.type();
- if (vt == _realfld)
- {
- const TCurrency v(var.as_real(), "", ZERO, fldname.find("PRZ") > 0 || fldname.find("PREZZO") > 0);
- TString& tmp = get_tmp_string();
- tmp << '\'' << v.string() << '\'';
- tmp.replace(',', '.');
- return tmp;
- }
- if (vt == _datefld)
- {
- TString& tmp = get_tmp_string();
- tmp << '\'' << var.as_date().string(full, '-', full, full, amg_date) << '\'';
- return tmp;
- }
+ const TFieldtypes vt = var.type();
+ TString& tmp = get_tmp_string();
- const TString& str = var.as_string();
+ if (vt == _realfld)
+ {
+ const TCurrency v(var.as_real(), "", ZERO, fldname.find("PRZ") > 0 || fldname.find("PREZZO") > 0);
+ tmp << '\'' << v.string() << '\'';
+ tmp.replace(',', '.');
+ return tmp;
+ }
- bool apici = vt == _alfafld;
- if (apici && str[0] != '0' && real::is_natural(str))
- apici = false;
+ if (vt == _datefld)
+ {
+ tmp << '\'' << var.as_date().string(full, '-', full, full, amg_date) << '\'';
+ return tmp;
+ }
- if (!apici)
- return str;
+ const TString& str = var.as_string();
- // Parso i caratteri speciali
- TString& tmp = get_tmp_string().cut(0);
- for(int i = 0; i < str.len(); i++)
- {
- tmp << no_special(str[i]);
- }
+ bool apici = vt == _alfafld;
+ if (apici && str[0] != '0' && real::is_natural(str))
+ apici = false;
+ // Parso i caratteri speciali
+ for(int i = 0; i < str.len(); i++)
+ {
+ tmp << no_special(str[i]);
+ }
+
+ if (apici)
+ {
// Aggiungo apici a inizio e fine riga
tmp.insert("'", 0);
tmp << '\'';
- return tmp;
+ }
+ return tmp;
}
TString& TPaf_record::remove_string(bool id_riga)
@@ -858,19 +866,37 @@ const TString& TDoc_fp::converti_prezzo(const real& prezzo) const
return ret;
}
-void TDoc_fp::set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc)
+void TDoc_fp::set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc) const
{
- const real qta = rdoc->get(RDOC_QTA);
+ // Setto l'unità di misura
+ paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA));
+
+ real& qta = rdoc->get_real(RDOC_QTA);
+
+ real prezzo_unit;
+ real prezzo_tot;
+
if (qta >= ZERO)
{
- paf1800f.set("PI_QUANTITA", qta);
- paf1800f.set("PI_PREZZOUNIT", converti_prezzo(rdoc->prezzo(false, false)));
+ if (qta == ZERO)
+ qta = UNO;
+
+ paf1800f.set("PI_QUANTITA", qta.string());
+ prezzo_unit = rdoc->prezzo(false, false);
+ prezzo_tot = rdoc->importo(true, false);
}
- else
+ else if(qta < ZERO)
{
- paf1800f.set("PI_QUANTITA", -qta);
- paf1800f.set("PI_PREZZOUNIT", converti_prezzo(-rdoc->prezzo(true, false)));
+ // Metto la qualità in positivo
+ paf1800f.set("PI_QUANTITA", abs(qta).string());
+ // E i prezzi in negativo
+ prezzo_unit = -rdoc->prezzo(false, false);
+ prezzo_tot = -rdoc->importo(true, false);
}
+
+ // Salvo tutto
+ paf1800f.set("PI_PREZZOUNIT", converti_prezzo(prezzo_unit));
+ paf1800f.set("PI_PRZTOTALE", converti_prezzo(prezzo_tot));
}
bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
@@ -1078,10 +1104,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf0700f.set("P7_KEYBODYFATT", _bfatt);
remove(paf0700f);
paf0700f.set("P7_TIPODOC", tipo_doc_sdi(doc));
- paf0700f.set("P7_DIVISA", _doc_cambio._cod_val.full() ? _doc_cambio._cod_val : "EUR");
+ paf0700f.set("P7_DIVISA", "EUR"); // Fisso su euro in quanto effettuiamo il cambio
paf0700f.set("P7_DATA", doc.data());
-
- paf0700f.set("P7_NUMERO", doc.numero());
+ TString full_num;
+ doc.codice_numerazione().complete_num(doc.numero(), full_num);
+ paf0700f.set("P7_NUMERO", full_num);
paf0700f.set("P7_GESTIONE", "D");
//
@@ -1366,16 +1393,13 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
}
else if (rdoc->is_merce())
{
- paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA));
- const real qta = rdoc->get(RDOC_QTA);
- if (qta.is_zero())
+ if (rdoc->get(RDOC_QTA).is_zero())
{
TString msg;
msg.format("La riga merce %d ha quantità nulla", riga);
log(1, msg);
}
set_qta_prezzo(paf1800f, rdoc);
- paf1800f.set("PI_PRZTOTALE", converti_prezzo(rdoc->importo(true, false)));
set_IVA(*rdoc, paf1800f);
/*
@@ -1505,19 +1529,26 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf0700f.set("P7_IMPORTORIT", converti_prezzo(doc.imponibile() * sp.perc() / CENTO));
paf0700f.set("P7_ALIQUOTARIT", TCodiceIVA(sp.cod_iva()).percentuale());
static TString caus770; caus770.cut(0); caus770.format("%02d", sp.caus_770());
- paf0700f.set("P7_CAUSPAGAM", cache().get("CA7", caus770, "S2"));
+ paf0700f.set("P7_CAUSPAGAM", cache().get("%CA7", caus770, "S2"));
}
//
}
else if (rdoc->is_prestazione())
{
- paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA));
real qta = rdoc->get(RDOC_QTA);
if (qta.is_zero()) qta = UNO;
set_qta_prezzo(paf1800f, rdoc);
- paf1800f.set("PI_PRZTOTALE", converti_prezzo(rdoc->importo(true, false)));
+
set_IVA(*rdoc, paf1800f);
}
+ else if (rdoc->is_sconto() || rdoc->is_sconto_perc())
+ {
+ TString msg;
+ msg << "Il documento " << doc.codice_numerazione().codice() << " " << doc.tipo().codice() << " " << doc.numero() << " presenta una o più righe di tipo sconto o sconto percentuale.\n" \
+ "Esportazione impossibile";
+ log(2, msg);
+ return false;
+ }
else
{
// Salto tutte le altre righe
@@ -1614,7 +1645,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf3000f.set("PT_KEYHEADERFATT", _hfatt);
paf3000f.set("PT_KEYBODYFATT", _bfatt);
paf3000f.set("PT_RIFNUMLINEA", riga);
- paf3000f.set("PT_COMMENTO", ini_get_string(CONFIG_DITTA, "ve", "DESCCONAIASS", "Contributo CONAI assolto ove dovuto"));
+ paf3000f.set("PT_COMMENTO", _conai_str);
paf1800f.set("PI_QUANTITA", UNO);
paf1800f.set("PI_PREZZOUNIT", ZERO);
@@ -1818,7 +1849,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
}
pafw300f.set("PW_CDEST", coddest);
- pafw300f.set("PW_RAGSOC", cliente.ragione_sociale());
+ pafw300f.set("PW_RAGSOC", cliente.ragione_sociale().left(35));
pafw300f.set("PW_PAESE", cliente.stato_residenza_ISO());
pafw300f.set("PW_CODICE", cliente.codice_fiscale_estero());
pafw300f.set("PW_CFISCA", cliente.codice_fiscale());
@@ -1884,7 +1915,7 @@ TRectype& TDoc_fp::key_to_doc(const TDoc_key& key)
TDoc_fp::TDoc_fp() : _doc_rec(nullptr), _log(nullptr), _cache_insert(false)
{
_ditta.init(LF_NDITTE, prefix().get_codditta());
- _cofi = ini_get_string(CONFIG_DITTA, "fp", "cofitras");
+ _cofi = fp_settings().get_cofi_tras();
if (_cofi.blank())
_cofi = _ditta.codice_fiscale();
@@ -1892,17 +1923,17 @@ TDoc_fp::TDoc_fp() : _doc_rec(nullptr), _log(nullptr), _cache_insert(false)
#ifdef DBG
_gestioneallegati = _allegafattura = false;
#else
- _gestioneallegati = ini_get_bool(CONFIG_DITTA, "fp", "gestioneallegati");
- _allegafattura = ini_get_bool(CONFIG_DITTA, "fp", "allegafatt");
+ _gestioneallegati = fp_settings().get_gest_alleg();
+ _allegafattura = fp_settings().get_allega_fat();
#endif
- _def_fld = ini_get_string(CONFIG_DITTA, "fp", "flddest");
+ _def_fld = fp_settings().get_fld_dest();
if (!_def_fld.ends_with("\\"))
{
_def_fld << "\\";
}
- _def_usr_fld = ini_get_string(CONFIG_DITTA, "fp", "fldusrdest", "");
+ _def_usr_fld = fp_settings().get_fld_dest_usr();
if (_def_usr_fld.empty())
{
_def_usr_fld = _def_fld;
@@ -1911,6 +1942,11 @@ TDoc_fp::TDoc_fp() : _doc_rec(nullptr), _log(nullptr), _cache_insert(false)
{
_def_usr_fld << "\\";
}
+
+ // Mi preparo la stringa del CONAI
+ _conai_str = ini_get_string(CONFIG_DITTA, "ve", "DESCCONAIASS");
+ if (_conai_str.empty())
+ _conai_str = "Contributo CONAI assolto ove dovuto";
}
TDoc_fp::~TDoc_fp()
diff --git a/src/fp/fplib02.cpp b/src/fp/fplib02.cpp
new file mode 100644
index 000000000..b1db03aab
--- /dev/null
+++ b/src/fp/fplib02.cpp
@@ -0,0 +1,221 @@
+#include "fplib.h"
+
+#define FILE_CONFIG CONFIG_DITTA
+#define FILE_SECTION "fp"
+#define FP_TAB_MOD "FP"
+
+
+
+#define FP_IP "ip"
+#define FP_DB "db"
+#define FP_USR "usr"
+#define FP_PSW "psw"
+#define FP_FLD_DEST "flddest"
+#define FP_FLD_USR_DEST "fldusrdest"
+#define FP_COFI_TRAS "cofitras"
+#define FP_GEST_ALLEG "gestioneallegati"
+#define FP_ALLEG_FAT "allegafatt"
+#define FP_ESP_PRI "esppri"
+#define FP_ESP_EST "espest"
+#define FP_ESP_EST_COD "espestcod"
+#define FP_F8 "f8"
+
+#define FP_SLD_COD "SLD"
+#define FP_SLD_CODTAB "CODTAB"
+#define FP_SLD_CODNUM "S0"
+#define FP_SLD_TIPODOC "S1"
+#define FP_SLD_DASTATO "I0"
+#define FP_SLD_ASTATO "I1"
+
+
+
+const TString& TFP_settings::get_db_indirizzo() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_IP);
+}
+
+const TString& TFP_settings::get_db_database() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_DB);
+}
+
+const TString& TFP_settings::get_db_str_con() const
+{
+ return get_tmp_string().cut(0) << get_db_indirizzo() << "@" << get_db_database();
+}
+
+const TString& TFP_settings::get_db_user() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_USR);
+}
+
+const TString& TFP_settings::get_db_password() const
+{
+ return get_tmp_string().cut(0) << decode(ini_get_string(FILE_CONFIG, FILE_SECTION, FP_PSW));
+}
+
+const TString& TFP_settings::get_fld_dest() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_FLD_DEST);
+}
+
+const TString& TFP_settings::get_fld_dest_usr() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_FLD_USR_DEST, "");
+}
+
+const TString& TFP_settings::get_cofi_tras() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS);
+}
+
+const bool TFP_settings::get_gest_alleg() const
+{
+ return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG);
+}
+
+const bool TFP_settings::get_allega_fat() const
+{
+ return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ALLEG_FAT);
+}
+
+const bool TFP_settings::get_esp_pri_empty() const
+{
+ return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_PRI);
+}
+
+const bool TFP_settings::get_esp_est() const
+{
+ return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_EST);
+}
+
+const TString& TFP_settings::get_esp_est_cod() const
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_ESP_EST_COD, "XXXXXXX");
+}
+
+const bool TFP_settings::is_f8() const
+{
+ return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_F8);
+}
+
+void TFP_settings::set_db_indirizzo(const TString& ind) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_IP, ind);
+}
+
+void TFP_settings::set_db_database(const TString& db) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_DB, db);
+}
+
+void TFP_settings::set_db_user(const TString& usr) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_USR, usr);
+}
+
+void TFP_settings::set_db_password(const TString& psw) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_PSW, encode(psw));
+}
+
+void TFP_settings::set_fld_dest(const TString& fld_dest) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_FLD_DEST, fld_dest);
+}
+
+void TFP_settings::set_fld_dest_usr(const TString& fld_dest_usr) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_FLD_USR_DEST, fld_dest_usr);
+}
+
+void TFP_settings::set_cofi_tras(const TString& cofi) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS, cofi);
+}
+
+void TFP_settings::set_gest_alleg(const bool gest_alleg) const
+{
+ ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG, gest_alleg);
+}
+
+void TFP_settings::set_allega_fat(const bool allega_fatt) const
+{
+ ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ALLEG_FAT, allega_fatt);
+}
+
+void TFP_settings::set_esp_pri_empty(const bool esp_pri) const
+{
+ ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_PRI, esp_pri);
+}
+
+void TFP_settings::set_esp_est(const bool esp_est) const
+{
+ ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_EST, esp_est);
+}
+
+void TFP_settings::set_esp_est_cod(const TString& esp_est_cod) const
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, FP_ESP_EST_COD, esp_est_cod);
+}
+
+void TFP_settings::set_f8(const bool f8) const
+{
+ ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_F8, f8);
+}
+
+TRectype TFP_selected_docs::fill_rectype() const
+{
+ TRectype r(LF_TABMOD);
+ r.put("MOD", FP_TAB_MOD);
+ r.put("COD", FP_SLD_COD);
+ return r;
+}
+
+void TFP_selected_docs::fill_sheet(TSheet_field& sheet) const
+{
+ for(*_cur = 0; _cur->pos() < _cur->items(); ++*_cur)
+ {
+ TRectype rec = _cur->curr();
+ TToken_string& row = sheet.row(-1);
+ row.add(rec.get(FP_SLD_CODNUM));
+ row.add(rec.get(FP_SLD_TIPODOC));
+ row.add(rec.get(FP_SLD_DASTATO));
+ row.add(rec.get(FP_SLD_ASTATO));
+ row.add(TTipo_documento(TString() << rec.get("S0") << "|" << rec.get("S1")).tipo_doc_sdi());
+ }
+}
+
+void TFP_selected_docs::save_sheet(const TSheet_field& sheet) const
+{
+ // Svuoto il db
+ TLocalisamfile tabmod(LF_TABMOD);
+ TRectype rec(LF_TABMOD);
+
+ for (*_cur = 0; _cur->pos() < _cur->items(); ++*_cur)
+ {
+ rec = _cur->curr();
+ rec.remove(tabmod);
+ }
+
+ // Carico il db
+
+ FOR_EACH_SHEET_ROW(sheet, n, r)
+ {
+ // Chissene anche se copio ogni volta
+ rec = fill_rectype();
+ rec.put(FP_SLD_CODTAB, n);
+
+ // Prendo tutta la riga tranne il cod sdi
+ rec.put(FP_SLD_CODNUM, r->get(_codnum));
+ rec.put(FP_SLD_TIPODOC, r->get(_tipodoc));
+ rec.put(FP_SLD_DASTATO, r->get(_dastato));
+ rec.put(FP_SLD_ASTATO, r->get(_astato));
+ rec.write(tabmod);
+ }
+}
+
+TFP_selected_docs::TFP_selected_docs() : _r_tabmod(LF_TABMOD), _flt(fill_rectype())
+{
+ _cur.reset(new TCursor(&_r_tabmod, "", 1, &_flt, &_flt));
+}
diff --git a/src/include/odbcrset.cpp b/src/include/odbcrset.cpp
index 1b7635046..8d6356b86 100755
--- a/src/include/odbcrset.cpp
+++ b/src/include/odbcrset.cpp
@@ -84,7 +84,44 @@ bool TODBC_recordset::connect(const char* dsn, const char* usr, const char* pwd,
}
const TString& TODBC_recordset::query_text() const
-{ return _sql; }
+{
+ return _sql;
+}
+
+const TString& TODBC_recordset::query_text_var() const
+{
+
+ // INSERT INTO POPPO (COL1, COL2) VALUES (SELECT COL3, COL4 FROM PAPPO WHERE COL5 = #VAR4)
+ // INSERT INTO POPPO (COL1, COL2) VALUES (SELECT COL3, COL4 FROM PAPPO WHERE COL5 = '#VAR4')
+ // #VAR4')
+
+ // Conto quanti separatori ho
+ int num_sep = 0;
+ int pos = _sql.find(query_text_separator());
+ for (; pos > 0; pos = _sql.find(query_text_separator(), pos + 1))
+ num_sep++;
+
+ if(num_sep == 0 || num_sep % 2 != 0)
+ {
+ return _sql;
+ }
+
+ // Se sono pari tolgo dalla mia query tutte le variabili all'interno dei separatori per non farle chiedere all'utente
+ TString& sql = get_tmp_string();
+ TString wrk_sql = _sql;
+ sql.cut(0);
+
+ // cerco il primo query_text_separator(), nel nostro caso è l'apice e mi sposto
+ for (int qts = wrk_sql.find(query_text_separator()); qts > 0; qts = wrk_sql.find(query_text_separator())) // Cerco tutti i separatori
+ {
+ sql << wrk_sql.left(qts - 1);
+ wrk_sql.ltrim(qts);
+ qts = wrk_sql.find(query_text_separator());
+ wrk_sql.ltrim(qts);
+ }
+
+ return sql;
+}
const TString& TODBC_recordset::driver_version() const
{
@@ -715,6 +752,7 @@ void TODBC_recordset::set(const char* sql)
TODBC_recordset::TODBC_recordset(const char* sql, const bool freezed) : _freezed(freezed), _loaded(false)
{
+ TRecordset::set_query_text_separator('\'');
set(sql);
}
diff --git a/src/include/odbcrset.h b/src/include/odbcrset.h
index 5e83dd507..13131f6f8 100755
--- a/src/include/odbcrset.h
+++ b/src/include/odbcrset.h
@@ -40,6 +40,7 @@ public:
virtual TRecnotype current_row() const;
virtual void requery();
virtual const TString& query_text() const;
+ virtual const TString& query_text_var() const;
virtual const TString& driver_version() const;
virtual void freeze(const bool on) { _freezed = on; }
diff --git a/src/include/recset.cpp b/src/include/recset.cpp
index f2c98c14b..024b68532 100755
--- a/src/include/recset.cpp
+++ b/src/include/recset.cpp
@@ -623,7 +623,7 @@ void TRecordset::find_and_reset_vars()
_var.destroy();
_varnames.destroy();
- const TString& sql = query_text();
+ const TString& sql = query_text_var();
int diesis = sql.find('#'); // cerco il primo #
for ( ; diesis > 0; diesis = sql.find('#', diesis+1)) // Cerco tutti i #
{
diff --git a/src/include/recset.h b/src/include/recset.h
index fc4d3769f..6d418b51b 100755
--- a/src/include/recset.h
+++ b/src/include/recset.h
@@ -63,6 +63,7 @@ class TRecordset : public TObject
TString_array _varnames;
const TRecordset* _parentset;
char _text_separator;
+ char _query_text_separator;
protected:
virtual bool save_as_html(const char* path);
@@ -71,7 +72,7 @@ protected:
virtual bool save_as_csv(const char* path) { set_text_separator(';'); return save_as_text(path);}
virtual bool save_as_campo(const char* path);
virtual bool save_as_dbf(const char* table, int mode);
-
+
void find_and_reset_vars();
void parsed_text(TString& sql) const;
TVariant& get_tmp_var() const;
@@ -83,11 +84,15 @@ public: // Absolutely needed methods
virtual TRecnotype current_row() const pure;
virtual void requery() pure;
bool empty() const { return items() == 0; }
- virtual const TString& query_text() const pure;
+ virtual const TString& query_text() const pure;
+ virtual const TString& query_text_var() const { return query_text(); }
virtual const TString& driver_version() const;
virtual char text_separator() const { return _text_separator;}
virtual void set_text_separator(char sep) { _text_separator = sep;}
+
+ virtual char query_text_separator() const { return _query_text_separator; }
+ virtual void set_query_text_separator(char sep) { _query_text_separator = sep; }
virtual void freeze() {}
virtual bool move_first() { return move_to(0); }
diff --git a/src/li/li0400.cpp b/src/li/li0400.cpp
index 6c08cd9dd..1780f6fed 100755
--- a/src/li/li0400.cpp
+++ b/src/li/li0400.cpp
@@ -83,9 +83,12 @@ bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
if (get_date(F_DATAREG) < old_data)
return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*) old_data.string());
}
- TDate ultima = ultima_stampa(anno);
- if (get_date(F_DATAREG) <= ultima)
- return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*) ultima.string());
+ else
+ {
+ TDate ultima = ultima_stampa(anno);
+ if (get_date(F_DATAREG) <= ultima)
+ return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*)ultima.string());
+ }
}
}
else
diff --git a/src/mg/f111.dir b/src/mg/f111.dir
index d58886ee9..0745fc618 100755
--- a/src/mg/f111.dir
+++ b/src/mg/f111.dir
@@ -1,3 +1,3 @@
111
0
-$rmovmag|0|0|105|0|Righe movimenti di magazzino|||
+$rmovmag|0|0|111|0|Righe movimenti di magazzino|||
diff --git a/src/mg/f111.trr b/src/mg/f111.trr
index 513acadd2..71a1b383d 100755
--- a/src/mg/f111.trr
+++ b/src/mg/f111.trr
@@ -1,5 +1,5 @@
111
-13
+14
NUMREG|3|7|0|Numero di registrazione
NRIG|2|4|0|Numero di riga
CODMAG|1|5|0|Codice magazzino e deposito
@@ -13,6 +13,7 @@ IMPIANTO|1|5|0|Codice Impianto (MRP)
LINEA|1|5|0|Codice linea (MRP)
AUTOMATICA|1|1|0|Flag di riga automatica
ESPLOSA|8|1|0|Flag di riga esplosa (da DiBa)
+NRRDOC|3|6|0|Numero di riga della riga del documento da cui deriva
2
NUMREG+NRIG|
CODART+LIVGIAC+CODMAG+NUMREG|X
diff --git a/src/mg/rmovmag.h b/src/mg/rmovmag.h
index c7932735d..9c42f3ccc 100755
--- a/src/mg/rmovmag.h
+++ b/src/mg/rmovmag.h
@@ -14,5 +14,6 @@
#define RMOVMAG_ESPLOSA "ESPLOSA"
#define RMOVMAG_IMPIANTO "IMPIANTO"
#define RMOVMAG_LINEA "LINEA"
+#define RMOVMAG_NRRDOC "NRRDOC"
#endif
diff --git a/src/ve/ve0100.cpp b/src/ve/ve0100.cpp
index 1194abc54..4cfaadeea 100755
--- a/src/ve/ve0100.cpp
+++ b/src/ve/ve0100.cpp
@@ -517,7 +517,8 @@ int TMotore_application::write( const TMask& m ) // C 90
// Se ho attivato la creazione automatica delle righe allora cancello quelle vuote finali
if (d.tipo().auto_add())
{
- for (int r = d.rows(); r > 0; r--)
+ // Non devo contare righe sconto o esenzione
+ for (int r = d.physical_rows(); r > 0; r--)
{
const TRiga_documento& dr = d[r];
if (dr.get(RDOC_CODART).empty() && dr.get(RDOC_DESCR).empty())
diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp
index 927a527dc..682958339 100755
--- a/src/ve/velib03.cpp
+++ b/src/ve/velib03.cpp
@@ -1417,7 +1417,10 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
prezzo.change_to_firm_val();
rm.put(RMOVMAG_PREZZO, prezzo.get_num());
rm.put(RMOVMAG_CODCAUS, cod_caus_riga);
- rm.put(RMOVMAG_TIPORIGA, (char) riga_dadocumento);
+ rm.put(RMOVMAG_TIPORIGA, (char) riga_dadocumento);
+
+ // Aggiungo il riferimento alla riga del documento
+ rm.put(RMOVMAG_NRRDOC, r.get(RDOC_NRIGA));
}
if (main_app().has_module(LVAUT))