diff --git a/build/Cg2.vcxproj b/build/Cg2.vcxproj
index 423b6b38b..16a8598dc 100644
--- a/build/Cg2.vcxproj
+++ b/build/Cg2.vcxproj
@@ -118,7 +118,6 @@
_DEBUG;WIN32;__LONGDOUBLE__;_WINDOWS;__LONGDOUBLE__;%(PreprocessorDefinitions)
false
MultiThreadedDebug
-
Level3
true
EditAndContinue
@@ -311,6 +310,9 @@
{2d38a763-3d74-4338-9362-b891784ec90e}
+
+ {41f4c25f-6bd2-4fc9-a0d3-a68cd1c9e4fc}
+
{c575788b-0be4-4f68-b9c9-3c204ec04e07}
diff --git a/build/cg.sln b/build/cg.sln
index af3730030..87f0cb8cc 100644
--- a/build/cg.sln
+++ b/build/cg.sln
@@ -9,6 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cg1", "Cg1.vcxproj", "{9B42
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cg2", "Cg2.vcxproj", "{9304E774-E631-495D-A29D-774222BBF8C9}"
ProjectSection(ProjectDependencies) = postProject
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC} = {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}
{C575788B-0BE4-4F68-B9C9-3C204EC04E07} = {C575788B-0BE4-4F68-B9C9-3C204EC04E07}
EndProjectSection
EndProject
@@ -28,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AgaLib", "AgaLib.vcxproj",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fplib", "fplib.vcxproj", "{C575788B-0BE4-4F68-B9C9-3C204EC04E07}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "f1lib", "f1lib.vcxproj", "{41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -78,6 +81,10 @@ Global
{C575788B-0BE4-4F68-B9C9-3C204EC04E07}.Debug|Win32.Build.0 = Debug|Win32
{C575788B-0BE4-4F68-B9C9-3C204EC04E07}.Release|Win32.ActiveCfg = Release|Win32
{C575788B-0BE4-4F68-B9C9-3C204EC04E07}.Release|Win32.Build.0 = Release|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Debug|Win32.Build.0 = Debug|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Release|Win32.ActiveCfg = Release|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/build/f1lib.vcxproj b/build/f1lib.vcxproj
new file mode 100644
index 000000000..fa7086b48
--- /dev/null
+++ b/build/f1lib.vcxproj
@@ -0,0 +1,173 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}
+ fp
+ 10.0.17763.0
+
+
+
+ StaticLibrary
+ false
+ v141
+
+
+ StaticLibrary
+ false
+ v141
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ ..\lib\
+ ..\obj\$(SolutionName)\$(ProjectName)\
+ false
+ ..\lib\
+ ..\obj\$(SolutionName)\$(ProjectName)\
+ false
+ false
+ false
+ .lib
+ .lib
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ Win32
+ .\..\debug/fplib.tlb
+
+
+
+
+ Disabled
+ ..\src\f1\;..\src\xvtdb\;..\src\cg;..\src\include;..\src\xvaga;%(AdditionalIncludeDirectories)
+ _DEBUG;WIN32;_WINDOWS;__LONGDOUBLE__;%(PreprocessorDefinitions)
+ false
+ MultiThreadedDebug
+ $(IntDir)$(TargetName).pch
+ $(IntDir)
+ $(IntDir)
+ $(IntDir)$(TargetName).pdb
+ Level3
+ true
+ ProgramDatabase
+ true
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0410
+ ..\wx28X\include;%(AdditionalIncludeDirectories)
+
+
+ wsock32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+ true
+ %(IgnoreSpecificDefaultLibraries)
+ true
+ $(TargetDir)$(TargetName).pdb
+ Windows
+ false
+
+
+ MachineX86
+ NotSet
+
+
+ true
+ .\..\debug/fplib.bsc
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ Win32
+ .\..\release/fplib.tlb
+
+
+
+
+ MaxSpeed
+ ..\src\xvtdb\;..\src\cg;..\src\include;..\src\xvaga;%(AdditionalIncludeDirectories)
+ NDEBUG;WIN32;_WINDOWS;%(PreprocessorDefinitions)
+ true
+ MultiThreaded
+ true
+ false
+ Level3
+ true
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0410
+ ..\wx28X\include;%(AdditionalIncludeDirectories)
+
+
+ wsock32.lib;%(AdditionalDependencies)
+ true
+ %(IgnoreSpecificDefaultLibraries)
+ Windows
+
+
+ MachineX86
+ 12.0
+ false
+ $(OutDir)$(TargetName)$(TargetExt)
+ $(TargetDir)$(TargetName).pdb
+
+
+ true
+ .\..\release/fplib.bsc
+
+
+
+
+ Document
+ true
+
+
+ Document
+ true
+
+
+
+
+ {2d38a763-3d74-4338-9362-b891784ec90e}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/f1lib.vcxproj.filters b/build/f1lib.vcxproj.filters
new file mode 100644
index 000000000..c61d72f6b
--- /dev/null
+++ b/build/f1lib.vcxproj.filters
@@ -0,0 +1,21 @@
+
+
+
+
+ {afbf9839-55d1-46a9-9d8a-45e41e3d3d11}
+
+
+ {1ca586f9-1511-48e9-89db-65f13a861684}
+
+
+
+
+ Sources
+
+
+
+
+ Headers
+
+
+
\ No newline at end of file
diff --git a/build/f1lib.vcxproj.user b/build/f1lib.vcxproj.user
new file mode 100644
index 000000000..be2507870
--- /dev/null
+++ b/build/f1lib.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/build/fp.sln b/build/fp.sln
index 8a1c85d07..5b54d3fea 100644
--- a/build/fp.sln
+++ b/build/fp.sln
@@ -21,6 +21,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fp1", "fp1.vcxproj", "{A539
{7BF6939E-DFCD-49ED-B0A8-EDB68DDCE6D5} = {7BF6939E-DFCD-49ED-B0A8-EDB68DDCE6D5}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "f1lib", "f1lib.vcxproj", "{41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -47,6 +49,10 @@ Global
{A539BCC1-D08F-4D78-A8EA-65560F4A60CD}.Debug|Win32.Build.0 = Debug|Win32
{A539BCC1-D08F-4D78-A8EA-65560F4A60CD}.Release|Win32.ActiveCfg = Release|Win32
{A539BCC1-D08F-4D78-A8EA-65560F4A60CD}.Release|Win32.Build.0 = Release|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Debug|Win32.Build.0 = Debug|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Release|Win32.ActiveCfg = Release|Win32
+ {41F4C25F-6BD2-4FC9-A0D3-A68CD1C9E4FC}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/build/fp0.vcxproj b/build/fp0.vcxproj
index 8857b770d..8aa5ec0fe 100644
--- a/build/fp0.vcxproj
+++ b/build/fp0.vcxproj
@@ -176,6 +176,9 @@
{2d38a763-3d74-4338-9362-b891784ec90e}
+
+ {41f4c25f-6bd2-4fc9-a0d3-a68cd1c9e4fc}
+
{a1ce9743-a597-4f92-b55a-345a366c9e55}
diff --git a/build/fp0.vcxproj.user b/build/fp0.vcxproj.user
index be5d31880..6495d1c7c 100644
--- a/build/fp0.vcxproj.user
+++ b/build/fp0.vcxproj.user
@@ -1,7 +1,7 @@

- -2 /uADMIN
+ -3 /uADMIN
$(TargetDir)
WindowsLocalDebugger
diff --git a/cd/test/cg0790.txt b/cd/test/cg0790.txt
new file mode 100644
index 000000000..505e4e508
--- /dev/null
+++ b/cd/test/cg0790.txt
@@ -0,0 +1,11 @@
+cg2100c.msk
+cg2.exe
+cg2fppro.msk
+
+Tolta esportazione protocollo ingresso su movimento (verra' fatto con l'F9)
+Aggiunto flag se registrazione collegata a FPPRO
+Corretta eliminazione massiva movimenti
+Cambiata modalita' modifica: non permetteva di salvare a prescindere dalle modifiche (mantenuto comunque il controllo preventivo)
+Aggiunto controllo per apertura automatica maschera FPPRO:
+Si apriva da sola quando eseguivo dal monitor delle fat. passive
+Dati documento salvati internamente e non su maschera per passaggio da maschera FPPRO a maschera cg
diff --git a/cd/test/cg0790a.ini b/cd/test/cg0790a.ini
new file mode 100644
index 000000000..2807ad729
--- /dev/null
+++ b/cd/test/cg0790a.ini
@@ -0,0 +1,96 @@
+[Main]
+Demo=0
+
+[cg2]
+Edit_23 = cg2 -0
+File(102) = cg2.exe|X
+File(105) = cg2100c.msk|X
+File(115) = cg2fppro.msk|X
+Patch = 0790
+Versione = 21511200
+
+[cg99]
+Kill(0) = bastntb.rep|x
+Kill(1) = bastvet.msk|x
+Kill(2) = bastpdb.msk|x
+Kill(3) = bastmsp.msk|x
+Kill(4) = batbarb.msk|x
+Kill(5) = bastndo.rep|x
+Kill(6) = bastesc.msk|x
+Kill(7) = batbvet.msk|x
+Kill(8) = bastzon.msk|x
+Kill(9) = bastcve.rep|x
+Kill(10) = batbivd.msk|x
+Kill(11) = batbtit.msk|x
+Kill(12) = bastnot.msk|x
+Kill(13) = bastcco.msk|x
+Kill(14) = batbcco.msk|x
+Kill(15) = bastscc.msk|x
+Kill(16) = batbleg.msk|x
+Kill(17) = batblia.msk|x
+Kill(18) = bastpor.msk|x
+Kill(19) = batbcam.msk|x
+Kill(20) = batbind.msk|x
+Kill(21) = bastcco.rep|x
+Kill(22) = batbntb.msk|x
+Kill(23) = bastpor.rep|x
+Kill(24) = bastcve.msk|x
+Kill(25) = batbesc.msk|x
+Kill(26) = bastleg.msk|x
+Kill(27) = bastmsp.rep|x
+Kill(28) = batbcfi.msk|x
+Kill(29) = bastarb.rep|x
+Kill(30) = batbins.msk|x
+Kill(31) = batblia.msk|x
+Kill(32) = batbscc.msk|x
+Kill(33) = bastivd.msk|x
+Kill(34) = batbnot.msk|x
+Kill(35) = bastreg.rep|x
+Kill(36) = bastnot.rep|x
+Kill(37) = batbpdb.msk|x
+Kill(38) = cgtbcon.msk|x
+Kill(39) = bastver.rep|x
+Kill(40) = bastcfi.msk|x
+Kill(41) = bastntb.msk|x
+Kill(42) = bastpdb.rep|x
+Kill(43) = bastesc.rep|x
+Kill(44) = bastdpn.rep|x
+Kill(45) = bastarb.msk|x
+Kill(46) = bastreg.msk|x
+Kill(47) = batbinl.msk|x
+Kill(48) = bastivd.rep|x
+Kill(49) = bastndo.msk|x
+Kill(50) = batbdel.msk|x
+Kill(51) = batbmsp.msk|x
+Kill(52) = batbreg.msk|x
+Kill(53) = bastvet.rep|x
+Kill(54) = batblbu.msk|x
+Kill(55) = bastcam.msk|x
+Kill(56) = bastdpn.msk|x
+Kill(57) = batbzon.msk|x
+Kill(58) = bastscc.rep|x
+Kill(59) = batbdpn.msk|x
+Kill(60) = batbver.msk|x
+Kill(61) = bastleg.rep|x
+Kill(62) = bastzon.rep|x
+Kill(63) = batbcve.msk|x
+Kill(64) = bastcfi.rep|x
+Kill(65) = bastver.msk|x
+Kill(66) = batbndo.msk|x
+Kill(67) = batbtra.msk|x
+Kill(68) = bastcam.rep|x
+Kill(69) = batbpor.msk|x
+
+[cg]
+Data = 16-05-2019
+Descrizione = Contabilita' Generale
+Dischi = 1
+Moduli = ba
+OEM =
+Patch = 790
+PostProcess = bainst -0 CG
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/cg0790a1.zip b/cd/test/cg0790a1.zip
new file mode 100644
index 000000000..3834564e6
Binary files /dev/null and b/cd/test/cg0790a1.zip differ
diff --git a/cd/test/fp0788.txt b/cd/test/fp0788.txt
new file mode 100644
index 000000000..a7f53763d
--- /dev/null
+++ b/cd/test/fp0788.txt
@@ -0,0 +1,3 @@
+fp0.exe
+
+Sistemato calcolo importo riga per chi non espone gli sconti in fattura
\ No newline at end of file
diff --git a/cd/test/fp0788a.ini b/cd/test/fp0788a.ini
new file mode 100644
index 000000000..33cf0c7f1
--- /dev/null
+++ b/cd/test/fp0788a.ini
@@ -0,0 +1,19 @@
+[Main]
+Demo=0
+
+[fp1]
+File(0) = fp0.exe|X
+Patch = 0788
+Versione = 21511200
+
+[fp]
+Data = 13-05-2019
+Descrizione = Fattura Elettronica
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 788
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/fp0788a1.zip b/cd/test/fp0788a1.zip
new file mode 100644
index 000000000..2b1cc2f2c
Binary files /dev/null and b/cd/test/fp0788a1.zip differ
diff --git a/cd/test/fp0790.txt b/cd/test/fp0790.txt
new file mode 100644
index 000000000..3f2dd8d20
--- /dev/null
+++ b/cd/test/fp0790.txt
@@ -0,0 +1,15 @@
+fp0.exe
+fp0400a.msk
+
+Aggiunta contabilizzazione automatica da fp fatt. passive con protocollo ini
+Corretta comportamento bottoni toolbar (abilita/disabilita)
+Aggiunto range data per fatture contabilizzate
+Aggiunto controllo se fornitore e' sospeso non lo propongo
+Aggiunte causali di default per contabilizzazione
+Salvate date e causali default su config. ditta
+Rifatta maschera per separare meglio parte fp da f1
+Aggiunti controlli sui bottoni
+Aggiustati filtri elenco fatture
+Aggiunta possibilita' di aprire registrazione da elenco fatture contabilizzate
+Aggiunto log per stato contabilizzazione (salvate/annullate)
+Corretta esportazione importi negativi
diff --git a/cd/test/fp0790a.ini b/cd/test/fp0790a.ini
new file mode 100644
index 000000000..af2e23e34
--- /dev/null
+++ b/cd/test/fp0790a.ini
@@ -0,0 +1,20 @@
+[Main]
+Demo=0
+
+[fp1]
+File(0) = fp0.exe|X
+File(4) = fp0400a.msk|X
+Patch = 0790
+Versione = 21511200
+
+[fp]
+Data = 17-05-2019
+Descrizione = Fattura Elettronica
+Dischi = 1
+Moduli = cg,ve
+OEM =
+Patch = 790
+PostProcess =
+PreProcess =
+Versione = 21511200
+
diff --git a/cd/test/fp0790a1.zip b/cd/test/fp0790a1.zip
new file mode 100644
index 000000000..50ceb8ccd
Binary files /dev/null and b/cd/test/fp0790a1.zip differ
diff --git a/cd/test/sy0790.txt b/cd/test/sy0790.txt
new file mode 100644
index 000000000..646e5b9ff
--- /dev/null
+++ b/cd/test/sy0790.txt
@@ -0,0 +1,4 @@
+ba0.exe
+campo.aut
+
+Aggiunti nuovi moduli f1, f9
diff --git a/cd/test/sy0790a.ini b/cd/test/sy0790a.ini
new file mode 100644
index 000000000..4d8b4d205
--- /dev/null
+++ b/cd/test/sy0790a.ini
@@ -0,0 +1,22 @@
+[Main]
+Demo=0
+
+[sy1]
+File(0) = ba0.exe|X
+File(36) = campo.aut|X
+Patch = 0790
+Versione = 21511200
+
+[sy]
+Data = 17-05-2019
+Descrizione = Sistema
+Dischi = 1
+Moduli =
+OEM =
+Patch = 790
+PostProcess =
+PreProcess =
+Prezzo(1) =
+Prezzo(2) =
+Versione = 21511200
+
diff --git a/cd/test/sy0790a1.zip b/cd/test/sy0790a1.zip
new file mode 100644
index 000000000..f7915fc49
Binary files /dev/null and b/cd/test/sy0790a1.zip differ
diff --git a/src/cg/cg2100.cpp b/src/cg/cg2100.cpp
index f1291272d..2b401e498 100755
--- a/src/cg/cg2100.cpp
+++ b/src/cg/cg2100.cpp
@@ -123,9 +123,11 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(309, sheet_clifo_handler);
ism.set_handler(CG_RATEO, sheet_rateo_handler);
ism.set_handler(CG_RISCONTO, sheet_risconto_handler);
- if (!is_fp(m))
+ if (!has_f1_db(m))
{
m->hide(F_PROTFPPRO);
+ if (m->find_by_id(F_COLFPPRO) != NULL)
+ m->hide(F_COLFPPRO);
if(m->find_by_id(DLG_LINK) != NULL)
m->disable(DLG_LINK);
}
@@ -1051,7 +1053,12 @@ void TPrimanota_application::init_modify_mode(TMask& m)
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
}
if(m.find_by_id(F_PROTFPPRO) != NULL && !m.field(F_PROTFPPRO).hidden())
+ {
m.set(F_PROTFPPRO, mov.get(MOV_PROGFPPRO));
+ m.set(F_COLFPPRO, mov.get(MOV_KEYFPPRO).empty() ? " " : "X");
+ }
+
+
}
// Controlla sulla causale se il segno del totale documento (ritsoc=false)
@@ -1572,8 +1579,8 @@ void TPrimanota_application::clean_fppro()
// Controlli: solo in mod modifica; che abbia fp (no F8); che non sono in salvataggio
if (_mode != MODE_MOD
- || !is_fp(&msk)
- || last_key != K_DEL && last_key != K_SAVE)
+ || !has_f1_db(&msk)
+ || last_key != K_DEL && last_key != K_SAVE && last_key != K_ELIMMAS)
return;
const TString& numreg = msk.get(F_NUMREG);
@@ -1587,12 +1594,12 @@ void TPrimanota_application::clean_fppro()
fp_db().sq_commit();
}
-bool TPrimanota_application::is_fp(TMask* m)
+bool TPrimanota_application::has_f1_db(TMask* m)
{
static bool is_set_fpcheck = false;
if (!is_set_fpcheck)
{
- _isfp = has_module(FPAUT) && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
+ _isfp = has_module(F1AUT) && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
is_set_fpcheck = true;
}
return _isfp;
@@ -2348,7 +2355,7 @@ int TPrimanota_application::save_fppro()
const KEY last = msk.last_key();
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
- if (!is_fp(&msk))
+ if (!has_f1_db(&msk))
return pro_nofp;
if (!fp_db().sq_is_connect())
{
@@ -2372,8 +2379,6 @@ int TPrimanota_application::save_fppro()
{
message_box(TString("Attenzione!") << " E' stato modificato un movimento già collegato a un documento in ingresso.");
clean_fppro(); // Pulisco db
- msk.set(F_PROKEY, "");
- msk.set(F_PROTFPPRO, "");
save_dbmov(); // Svuoto riferimento doc ingresso sul mov
}
}
@@ -2382,7 +2387,7 @@ int TPrimanota_application::save_fppro()
}
// Controllo che sto registrando un documento FA Fattura di Acquisto o NC Acquisto
- if (!TPro_msk::check_causale(msk.get(F_CODCAUS)))
+ if (!check_causale(msk.get(F_CODCAUS)))
return pro_notsaved;
if (last != K_SAVE) { // Se sto uscendo avvertimento di non salvataggio e salto
message_box("La registrazione del movimento non verrà salvata sul database.");
diff --git a/src/cg/cg2100.h b/src/cg/cg2100.h
index 9c9fb80d2..3389e89b5 100755
--- a/src/cg/cg2100.h
+++ b/src/cg/cg2100.h
@@ -22,6 +22,7 @@
#define F_PROTFPPRO 230
#define F_RITFATT 231
#define F_PROKEY 232
+#define F_COLFPPRO 233
#define F_CLIFO 128
#define F_CODCLIFOR 151
diff --git a/src/cg/cg2100c.uml b/src/cg/cg2100c.uml
index e0930e3d0..88f5e2200 100755
--- a/src/cg/cg2100c.uml
+++ b/src/cg/cg2100c.uml
@@ -609,9 +609,16 @@ BEGIN
DRIVENBY F_VALUTAINTRA
END
+BOOLEAN F_COLFPPRO
+BEGIN
+ PROMPT 1 18 "Registrazione collegata a FPPRO"
+ FLAGS "D"
+END
+
STRING F_PROTFPPRO 18
BEGIN
- PROMPT 1 18 "Codice Protocollo FPPRO "
+ PROMPT 1 19 "Codice Protocollo FPPRO "
+ FIELD PROGFPPRO
FLAGS "D"
END
@@ -619,6 +626,7 @@ STRING F_PROKEY 80
BEGIN
PROMPT 1 18 "db key"
HELP "Chiave database"
+ FIELD KEYFPPRO
FLAGS "H"
END
diff --git a/src/cg/cg2102.cpp b/src/cg/cg2102.cpp
index 194a829a7..ae7d5a85d 100755
--- a/src/cg/cg2102.cpp
+++ b/src/cg/cg2102.cpp
@@ -20,6 +20,7 @@
#include
#include
#include "../fp/fplib.h"
+#include "../f1/f1lib.h"
///////////////////////////////////////////////////////////
// Funzioni di decodifica/calcolo
@@ -2261,15 +2262,15 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
void TPrimanota_application::check_fppro_fields(TMask& m)
{
- if (app().is_fp(&m))
+ if (app().has_f1_db(&m))
{
- if (!TPro_msk::check_causale(m.get(F_CODCAUS)) && m.find_by_id(F_PROTFPPRO) != NULL)
+ if (!check_causale(m.get(F_CODCAUS)) && m.find_by_id(F_PROTFPPRO) != NULL)
{
m.hide(F_PROTFPPRO);
m.disable(DLG_LINK);
}
else
- if (TPro_msk::check_causale(m.get(F_CODCAUS)) && m.find_by_id(F_PROTFPPRO) != NULL && m.field(F_PROTFPPRO).hidden())
+ if (check_causale(m.get(F_CODCAUS)) && m.find_by_id(F_PROTFPPRO) != NULL && m.field(F_PROTFPPRO).hidden())
{
m.show(F_PROTFPPRO);
m.enable(DLG_LINK);
@@ -3006,7 +3007,8 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
const bool ic = ixc->active() && (alleg < 5 || alleg == 7) && paiv.full() && !m.get_bool(F_LIQDIFF);
ixc->set(ic ? "X" : "");
}
- fppro_mask(f, key);
+ if(m.get(F_PROKEY).empty())
+ fppro_mask(f, key);
}
}
@@ -3846,28 +3848,37 @@ bool TPrimanota_application::quadratura_handler(TMask_field& f, KEY key)
bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key)
{
TMask& cg_msk = f.mask();
- if (!app().get_isfp() || key != K_SPACE && key != K_TAB || !TPro_msk::check_causale(f.mask().get(F_CODCAUS)))
+ if (!app().get_isfp() || key != K_SPACE && key != K_TAB || !check_causale(f.mask().get(F_CODCAUS)))
return true;
auto msk = std::make_shared(cg_msk);
+ app()._pro_mask = msk;
- //load_list(msk, key);
- //if(load_fppro_mask(msk))
if (msk->load_fppro_mask(msk.get()))
{
msk->run();
// Riporto dati FPPRO su maschera Prima Nota
- cg_msk.set(F_NUMDOCEXT, msk->get(F_NUMEROI));
- cg_msk.set(F_NUMDOC, TString(msk->get(F_NUMEROI)).right(7));
- cg_msk.set(F_DATADOC, msk->get(F_DATAI));
- cg_msk.set(F_TOTALE, msk->get(F_TOTDOCI));
- cg_msk.set(F_PROTFPPRO, msk->get(F_PROTFPPROI));
- cg_msk.set(F_PROKEY, msk->get(F_FPPROKEYSI));
+ cg_msk.set(F_NUMDOCEXT, msk->get_numdoc());
+ cg_msk.set(F_NUMDOC, msk->get_numdoc().right(7));
+ cg_msk.set(F_DATADOC, msk->get_datadoc());
+ cg_msk.set(F_TOTALE, msk->get_totdoc());
+ //cg_msk.set(F_PROTFPPRO, msk->get_protocollo());
+ cg_msk.set(F_PROKEY, msk->get_fpprokeys());
+ is_collegato(cg_msk.field(F_COLFPPRO));
+
cg_msk.set(F_ANNORIF, cg_msk.get(F_ANNOIVA));
}
return true;
}
+bool TPrimanota_application::is_collegato(TMask_field& f)
+{
+ TMask& cg_msk = f.mask();
+ const bool has_prokey = !cg_msk.get(F_PROKEY).empty();
+ f.set(has_prokey ? "X" : " ");
+ return has_prokey;
+}
+
bool TPro_msk::load_fppro_mask(TMask* msk, KEY k)
{
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
@@ -3955,12 +3966,8 @@ bool TPro_msk::fppro_ok_handler(TMask_field& f, KEY k)
{
if(!loaded && *row->get(0) == 'X')
{
- msk.set(F_NUMEROI, row->get(5));
- msk.set(F_DATAI, row->get(3));
- msk.set(F_TOTDOCI, row->get(4));
- TString protocollo; protocollo << TDate(row->get(2)).year() << "-" << row->get(9) << "/" << row->get(10);
- msk.set(F_PROTFPPROI, protocollo);
- msk.set(F_FPPROKEYSI, row->get(11));
+ //TProtocollo protocollo(TDate(row->get(2)).year(), row->get(9), row->get(10));
+ app()._pro_mask->set_doc(row->get(5), row->get(3), row->get(4), "", row->get(11));
loaded = true;
ok = true;
break;
@@ -3997,21 +4004,6 @@ bool TPro_msk::date_handler(TMask_field& f, KEY k)
return ok;
}
-bool TPro_msk::check_causale(const TString& cod_caus)
-{
- bool nc = false;
- bool nc_acq = false;
- bool fa = false;
- TCausale caus(cod_caus);
-
- if ((nc = caus.tipo_doc() == "NC"))
- nc_acq = caus.reg().tipo() == TIPO_REG_ACQ;
-
- fa = caus.tipo_doc() == "FA";
-
- return fa || nc && nc_acq;
-}
-
void TPro_msk::fppro_selfatt() const
{
const TMask& mask = *this;
@@ -4059,6 +4051,15 @@ bool TPro_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
return true;
}
+void TPro_msk::set_doc(const char* numero, const char* datadoc, const char* totdoc, const char* protfppro, const char* fpprokeys)
+{
+ _numero = numero;
+ _datadoc = datadoc;
+ _totdoc = totdoc;
+ _protfppro.sset(protfppro);
+ _fpprokeys = fpprokeys;
+}
+
TString& TPro_msk::query_fppro(const TString& keyprginvio, const TString& keyheaderfatt, const TString& keybodyfatt,
const TString& where_str)
{
@@ -4142,7 +4143,7 @@ void TPro_msk::abilita_piva(TMask* msk)
}
}
-TPro_msk::TPro_msk(TMask& cg_msk) : TAutomask("cg2fppro"), _parent_mask(cg_msk)
+TPro_msk::TPro_msk(TMask& cg_msk) : TAutomask("cg2fppro")
{
TMask::set_handler(DLG_CONFIG, fppro_handler);
TMask::set_handler(DLG_LINK, fppro_ok_handler);
diff --git a/src/cg/cg2102.h b/src/cg/cg2102.h
index 598f032fb..d4539eaa5 100755
--- a/src/cg/cg2102.h
+++ b/src/cg/cg2102.h
@@ -34,8 +34,10 @@
#endif
#include
+#include "../f1/f1lib.h"
-#define TIPO_REG_ACQ 2
+#define TIPO_REG_ACQ 2
+#define K_ELIMMAS 0 // Key per eliminazione massima
class TPro_msk;
class TDati_mov_auto;
@@ -96,6 +98,8 @@ class TPrimanota_application : public TRelation_application
TAssoc_array _colori; // Colori delle righe
bool _isfp;
+ shared_ptr _pro_mask;
+ friend class TPro_msk;
static bool showpartite_handler(TMask_field& f, KEY k);
static bool speserimb_handler(TMask_field& f, KEY k);
@@ -180,6 +184,7 @@ class TPrimanota_application : public TRelation_application
// Handlers per aggancio FPPRO
// Bottone per maschera FPPRO
static bool fppro_mask(TMask_field& f, KEY key);
+ static bool is_collegato(TMask_field& f);
static void fppromask_set_handl(TMask* msk);
static void load_list(TMask* msk, KEY k);
@@ -204,7 +209,7 @@ protected: // TApplication
bool save_dbmov() const;
// Pulisce il mov e db dai firerimenti FPPRO (in MODE_MOD per edit/delete)
void clean_fppro();
- bool is_fp(TMask* m);
+ bool has_f1_db(TMask* m);
virtual bool save(bool check_dirty);
bool get_mask_swap_file(TFilename& name) const;
@@ -376,7 +381,12 @@ public:
class TPro_msk : public TAutomask
{
- TMask& _parent_mask;
+ TString _numero;
+ TDate _datadoc;
+ real _totdoc;
+ TProtocollo _protfppro;
+ TString _fpprokeys;
+
// Handlers per aggancio FPPRO
// Bottone carica documenti in maschera FPPRO
static bool fppro_handler(TMask_field& f, KEY k);
@@ -388,6 +398,15 @@ class TPro_msk : public TAutomask
void fppro_selfatt() const;
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
public:
+
+ void set_doc(const char* numero, const char* datadoc, const char* totdoc, const char* protfppro, const char* fpprokeys);
+
+ TString get_numdoc() const { return _numero; }
+ TDate get_datadoc() const { return _datadoc; }
+ real get_totdoc() const { return _totdoc; }
+ TProtocollo& get_protocollo() { return _protfppro; }
+ TString get_fpprokeys() const { return _fpprokeys; }
+
static TString& query_fppro(const TString& keyprginvio, const TString& keyheaderfatt, const TString& keybodyfatt, const TString& where_str);
static TString& query_fppro(const TString& codforn, const TString& date);
static TString& query_fppro(const TString& stato_piva, const TString& piva, const TString& date);
@@ -396,7 +415,6 @@ public:
//bool is_fp();
// Carica documenti FPPRO sulla maschera
static bool load_fppro_mask(TMask* msk, KEY k = 32);
- static bool check_causale(const TString& cod_caus);
TPro_msk() = delete;
TPro_msk(TMask& cg_msk);
};
diff --git a/src/f1/f1lib.cpp b/src/f1/f1lib.cpp
new file mode 100644
index 000000000..ab26cb2a9
--- /dev/null
+++ b/src/f1/f1lib.cpp
@@ -0,0 +1,180 @@
+#include "f1lib.h"
+#include "config.h"
+#include "modaut.h"
+#include "cg2103.h"
+#include "cg2102.h"
+#include "execp.h"
+#include "cfven.h"
+#include "../fp/fp0400a.h"
+#include "reputils.h"
+
+TString& TProtocollo::prot_in(const int year, const char* tipoprot, const char* progres)
+{
+ static TString protocollo;
+ TString tipo(tipoprot);
+ if (tipo.empty())
+ tipo << "no_prot";
+ protocollo.cut(0) << year << "-" << tipo << "/" << progres;
+ return protocollo;
+}
+
+void TProtocollo::set(const TProtocollo prot)
+{
+ _year = prot._year;
+ _tipoprot = prot._tipoprot;
+ _progres = prot._progres;
+}
+
+void TProtocollo::sset(const char* prot)
+{
+ TToken_string tok(prot, '-');
+ _year = tok.get_int();
+ TToken_string p(tok.get(), '/');
+ _tipoprot = p.get();
+ _progres = p.get();
+}
+
+TString& TProtocollo::get_prot() const
+{
+ return prot_in(_year, _tipoprot, _progres);
+}
+
+void set_ini_codcaus(const TString& codcaus, const bool nc)
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, nc? F1_CAUSNC : F1_CAUSFA, codcaus);
+}
+
+const char* get_ini_codcaus(const bool nc)
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, nc ? F1_CAUSNC : F1_CAUSFA);
+}
+
+const char* get_codcaus(const char * tipodoc, const char* codcf)
+{
+ TLocalisamfile cfven(LF_CFVEN);
+ cfven.put(CFV_TIPOCF, "F");
+ cfven.put(CFV_CODCF, codcf);
+ const char* codcaus = "";
+ const char* codcausnc = "";
+ const bool nc = TString(tipodoc) == "TD04";
+
+ if (cfven.read() == NOERR)
+ {
+ codcaus = cfven.get(CFV_CODCAUS);
+ codcausnc = cfven.get(CFV_CODCAUSNC);
+ }
+
+ if (nc)
+ {
+ if (!TString(codcausnc).empty())
+ return codcausnc;
+ }
+ else
+ {
+ if (!TString(codcaus).empty())
+ return codcaus;
+ }
+ return get_ini_codcaus(nc);
+}
+
+bool get_endatareg()
+{
+ return ini_get_bool(FILE_CONFIG, FILE_SECTION, "endatareg");
+}
+
+TString get_datainireg()
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, "datainireg");
+}
+
+TString get_dataendreg()
+{
+ return ini_get_string(FILE_CONFIG, FILE_SECTION, "dataendreg");
+}
+
+void set_endatareg(bool enable)
+{
+ ini_set_bool(FILE_CONFIG, FILE_SECTION, "endatareg", enable);
+}
+
+void set_datainireg(const TString& date)
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, "datainireg", date);
+}
+
+void set_dataendreg(const TString& date)
+{
+ ini_set_string(FILE_CONFIG, FILE_SECTION, "dataendreg", date);
+}
+
+bool check_causale(const TString& cod_caus)
+{
+ return check_causale(cod_caus, "FA") || check_causale(cod_caus, "NC");
+}
+
+bool check_causale(const TString& cod_caus, const TString& tipo_doc)
+{
+ TCausale caus(cod_caus);
+
+ if(tipo_doc == "FA")
+ return caus.tipo_doc() == "FA";
+
+ if (tipo_doc == "NC")
+ {
+ bool nc;
+ bool nc_acq = false;
+ if ((nc = caus.tipo_doc() == "NC"))
+ nc_acq = caus.reg().tipo() == iva_acquisti;
+ return nc && nc_acq;
+ }
+ return false;
+}
+
+void run_cont_ini()
+{
+ static TString run_string;
+#ifdef DBG
+ run_string.cut(0) << "cg2 -0 -i" << F1_INIREGCONT << "*" << ".ini" << " /u" << user();
+#else
+ run_string.cut(0) << "cg2 -0 -i" << TFilename().tempdir() << "\\" << F1_INIREGCONT << "*" << ".ini" << " /u" << user();
+#endif
+ TExternal_app(run_string).run();
+}
+
+void TF1_log::log(int severity, const char* msg)
+{
+ if (_log == nullptr)
+ {
+ _log = new TLog_report("Stato contabilizzazione:");
+ // Tento l'eliminazione del file
+ std::remove("f1_cg.log");
+ }
+
+ static TString txt;
+ txt.cut(0);
+ if (severity == LOG_MSG)
+ txt << "[message] : ";
+ else if(severity == LOG_WARN)
+ txt << "[warning] : ";
+ else if (severity == LOG_ERR)
+ txt << "[error] : ";
+ txt << msg;
+ _log->log(severity, txt);
+ // Scrivo anche su file
+ std::filebuf fb;
+ fb.open("f1_cg.log", std::ios::out | std::ios::app);
+ std::ostream os(&fb);
+ os << txt << std::endl;
+ fb.close();
+
+}
+bool TF1_log::show_log()
+{
+ if (_log)
+ {
+ _log->preview();
+ delete _log;
+ _log = NULL;
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/src/f1/f1lib.h b/src/f1/f1lib.h
new file mode 100644
index 000000000..dd522c63a
--- /dev/null
+++ b/src/f1/f1lib.h
@@ -0,0 +1,73 @@
+#ifndef _F1LIBH_
+#define _F1LIBH_
+
+#include "strings.h"
+#include "config.h"
+#include "report.h"
+#include "reputils.h"
+
+#define FILE_CONFIG CONFIG_DITTA
+#define FILE_SECTION "f1"
+#define F1_CAUSFA "causfa"
+#define F1_CAUSNC "causnc"
+#define F1_INIREGCONT "cg2CONTAB"
+#define LOG_MSG 0
+#define LOG_WARN 1
+#define LOG_ERR 2
+
+enum err_cont
+{
+ no_codcaus = -1,
+ no_selected = -2,
+ is_already_cont = -3,
+ is_ready = 0
+};
+
+class TProtocollo : TObject
+{
+ int _year{};
+ TString _tipoprot;
+ TString _progres;
+
+public:
+ TProtocollo() = default;
+ TProtocollo(const int year, const char* tipoprot, const char* progres): _year(year), _tipoprot(tipoprot), _progres(progres) { }
+
+ void set(TProtocollo prot);
+ void sset(const char* prot);
+ TString& get_prot() const;
+ int get_year() const { return _year; }
+ TString& get_tipoprot() { return _tipoprot; }
+ TString& get_progres() { return _progres; }
+
+ static TString& prot_in(int year, const char* tipoprot, const char* progres);
+
+ operator const char*() const { return static_cast(get_prot()); }
+
+};
+
+class TF1_log : TObject
+{
+ TLog_report* _log;
+public:
+ TF1_log() : _log(nullptr){}
+ void log(int severity, const char* msg);
+ bool show_log();
+};
+
+void set_ini_codcaus(const TString& codcaus, bool nc = false);
+const char* get_ini_codcaus(bool nc = false);
+const char* get_codcaus(const char * tipodoc, const char* codcf);
+bool get_endatareg();
+TString get_datainireg();
+TString get_dataendreg();
+void set_endatareg(bool enable);
+void set_datainireg(const TString& date);
+void set_dataendreg(const TString& date);
+// Controlla se il "cod_caus" e' per Fatture d'acquisto o Note Credito d'Acquisto
+bool check_causale(const TString& cod_caus);
+// Controlla se il "cod_caus" ha come "tipo_doc" FA o NC (di acquisto)
+bool check_causale(const TString& cod_caus, const TString& tipo_doc);
+void run_cont_ini();
+
+#endif
\ No newline at end of file
diff --git a/src/fp/fp0400.cpp b/src/fp/fp0400.cpp
index d0c2bffb8..f77b2a55c 100644
--- a/src/fp/fp0400.cpp
+++ b/src/fp/fp0400.cpp
@@ -1,18 +1,19 @@
-/////////////////////////////////////////////////////////////////////////////////////
-// TPassive_mask
-/////////////////////////////////////////////////////////////////////////////////////
-
#include "defmask.h"
#include "automask.h"
#include "applicat.h"
-#include
#include "tsdb.h"
#include "fp0400a.h"
#include "fplib.h"
-#include "sheet.h"
#include "execp.h"
#include "dongle.h"
#include