diff --git a/build/Ba2.vcxproj b/build/Ba2.vcxproj index b8749fe18..d3205a022 100644 --- a/build/Ba2.vcxproj +++ b/build/Ba2.vcxproj @@ -68,7 +68,7 @@ MaxSpeed OnlyExplicitInline - ..\src\include;..\src\xvaga;..\xi;%(AdditionalIncludeDirectories) + ..\src\include;..\src\xvaga;..\xi;..\src\xvtdb;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_WINDOWS;XVT;%(PreprocessorDefinitions) true MultiThreaded @@ -122,7 +122,7 @@ Disabled - ..\src\include;..\src\xvaga;..\src\xvtdb;%(AdditionalIncludeDirectories) + ..\src\include;..\src\xvaga;..\xi;..\src\xvtdb;%(AdditionalIncludeDirectories) _DEBUG;WIN32;__LONGDOUBLE__;_WINDOWS;%(PreprocessorDefinitions) MultiThreadedDebug false diff --git a/build/Ba3.vcxproj b/build/Ba3.vcxproj index a2452e39c..19cbc38d7 100644 --- a/build/Ba3.vcxproj +++ b/build/Ba3.vcxproj @@ -229,15 +229,8 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - - - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -270,7 +263,6 @@ - diff --git a/build/Ba3.vcxproj.filters b/build/Ba3.vcxproj.filters index 0c985bf70..ecfae2123 100644 --- a/build/Ba3.vcxproj.filters +++ b/build/Ba3.vcxproj.filters @@ -51,21 +51,15 @@ Sources - - Sources - - + Sources Sources - + Sources - - Masks - @@ -136,9 +130,6 @@ Headers - - Headers - diff --git a/build/Bacnv.vcxproj b/build/Bacnv.vcxproj index d979d80d8..447d105f9 100644 --- a/build/Bacnv.vcxproj +++ b/build/Bacnv.vcxproj @@ -122,7 +122,6 @@ _DEBUG;WIN32;DBG;__LONGDOUBLE__;%(PreprocessorDefinitions) false MultiThreadedDebug - Level3 true ProgramDatabase @@ -177,6 +176,8 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + diff --git a/build/Bacnv.vcxproj.filters b/build/Bacnv.vcxproj.filters index 844734dc9..3ec9a165e 100644 --- a/build/Bacnv.vcxproj.filters +++ b/build/Bacnv.vcxproj.filters @@ -24,6 +24,12 @@ Sources + + Sources + + + Sources + diff --git a/build/Cg1.vcxproj b/build/Cg1.vcxproj index f62e38006..aa98e7702 100644 --- a/build/Cg1.vcxproj +++ b/build/Cg1.vcxproj @@ -68,7 +68,6 @@ _DEBUG;WIN32;__LONGDOUBLE__;__LONGDOUBLE__;_WINDOWS;%(PreprocessorDefinitions) false MultiThreadedDebug - Level3 true EditAndContinue @@ -257,7 +256,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) diff --git a/build/Cg1.vcxproj.filters b/build/Cg1.vcxproj.filters index 8b59d3059..f679fc060 100644 --- a/build/Cg1.vcxproj.filters +++ b/build/Cg1.vcxproj.filters @@ -87,9 +87,6 @@ Sources - - Sources - Sources diff --git a/build/ba.sln b/build/ba.sln index bbe1cb22c..62efdf77d 100644 --- a/build/ba.sln +++ b/build/ba.sln @@ -43,6 +43,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vedocext", "vedocext.vcxpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cb6", "Cb6.vcxproj", "{99683594-420F-4DD9-BB41-7DC48278B931}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lilib", "lilib.vcxproj", "{B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastrip", "fastrip.vcxproj", "{68251613-3B9A-4F87-9F40-827C46267ADE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "patchdef", "patchdef.vcxproj", "{2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -173,14 +179,24 @@ Global {99683594-420F-4DD9-BB41-7DC48278B931}.Release|Win32.ActiveCfg = Release|Win32 {99683594-420F-4DD9-BB41-7DC48278B931}.Release|Win32.Build.0 = Release|Win32 {99683594-420F-4DD9-BB41-7DC48278B931}.Release|x64.ActiveCfg = Release|Win32 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Debug|Win32.ActiveCfg = Debug|Win32 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Debug|Win32.Build.0 = Debug|Win32 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Debug|x64.ActiveCfg = Debug|x64 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Debug|x64.Build.0 = Debug|x64 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Release|Win32.ActiveCfg = Release|Win32 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Release|Win32.Build.0 = Release|Win32 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Release|x64.ActiveCfg = Release|x64 - {05AAA71C-10DF-420A-BE4C-1A1DF08A4AE3}.Release|x64.Build.0 = Release|x64 + {B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}.Debug|Win32.ActiveCfg = Debug|Win32 + {B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}.Debug|Win32.Build.0 = Debug|Win32 + {B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}.Debug|x64.ActiveCfg = Debug|Win32 + {B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}.Release|Win32.ActiveCfg = Release|Win32 + {B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}.Release|Win32.Build.0 = Release|Win32 + {B61F0AD4-0CCE-4371-8E92-85A26CAF1A7C}.Release|x64.ActiveCfg = Release|Win32 + {68251613-3B9A-4F87-9F40-827C46267ADE}.Debug|Win32.ActiveCfg = Debug|Win32 + {68251613-3B9A-4F87-9F40-827C46267ADE}.Debug|Win32.Build.0 = Debug|Win32 + {68251613-3B9A-4F87-9F40-827C46267ADE}.Debug|x64.ActiveCfg = Debug|Win32 + {68251613-3B9A-4F87-9F40-827C46267ADE}.Release|Win32.ActiveCfg = Release|Win32 + {68251613-3B9A-4F87-9F40-827C46267ADE}.Release|Win32.Build.0 = Release|Win32 + {68251613-3B9A-4F87-9F40-827C46267ADE}.Release|x64.ActiveCfg = Release|Win32 + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}.Debug|Win32.ActiveCfg = Debug|Win32 + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}.Debug|Win32.Build.0 = Debug|Win32 + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}.Debug|x64.ActiveCfg = Debug|Win32 + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}.Release|Win32.ActiveCfg = Release|Win32 + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}.Release|Win32.Build.0 = Release|Win32 + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build/ce0.vcxproj b/build/ce0.vcxproj index 833520ce7..2bd275636 100644 --- a/build/ce0.vcxproj +++ b/build/ce0.vcxproj @@ -71,7 +71,6 @@ $(IntDir) - Level3 true EditAndContinue @@ -133,7 +132,7 @@ NDEBUG;%(PreprocessorDefinitions) 0x0410 - ..\wx28X\include;%(AdditionalIncludeDirectories) + ..\libraries\wx28X\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies) diff --git a/build/ce1.vcxproj b/build/ce1.vcxproj index 0536c4114..f5ae3fc1b 100644 --- a/build/ce1.vcxproj +++ b/build/ce1.vcxproj @@ -78,7 +78,7 @@ NDEBUG;%(PreprocessorDefinitions) 0x0410 - ..\wx28X\include;%(AdditionalIncludeDirectories) + ..\libraries\wx28X\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies) @@ -124,7 +124,6 @@ $(IntDir) - Level3 true EditAndContinue diff --git a/build/ce2.vcxproj b/build/ce2.vcxproj index 12ed0e207..6e23e706d 100644 --- a/build/ce2.vcxproj +++ b/build/ce2.vcxproj @@ -72,7 +72,6 @@ $(IntDir) - Level3 true EditAndContinue @@ -132,7 +131,7 @@ NDEBUG;%(PreprocessorDefinitions) 0x0410 - ..\wx28X\include;%(AdditionalIncludeDirectories) + ..\libraries\wx28X\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies) diff --git a/build/ce3.vcxproj b/build/ce3.vcxproj index 2f1da4713..95a980d96 100644 --- a/build/ce3.vcxproj +++ b/build/ce3.vcxproj @@ -78,7 +78,7 @@ NDEBUG;%(PreprocessorDefinitions) 0x0410 - ..\wx28X\include;%(AdditionalIncludeDirectories) + ..\libraries\wx28X\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies) @@ -123,7 +123,6 @@ $(IntDir) - Level3 true EditAndContinue diff --git a/build/ce4.vcxproj b/build/ce4.vcxproj index d40ab600e..65ec6cc6b 100644 --- a/build/ce4.vcxproj +++ b/build/ce4.vcxproj @@ -72,7 +72,6 @@ $(IntDir) - Level3 true EditAndContinue @@ -133,7 +132,7 @@ NDEBUG;%(PreprocessorDefinitions) 0x0410 - ..\wx28X\include;%(AdditionalIncludeDirectories) + ..\libraries\wx28X\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies) diff --git a/build/fastrip.vcxproj b/build/fastrip.vcxproj index b3cb7895f..1df2f298e 100644 --- a/build/fastrip.vcxproj +++ b/build/fastrip.vcxproj @@ -14,7 +14,7 @@ {68251613-3B9A-4F87-9F40-827C46267ADE} Win32Proj fastrip - 10.0.17134.0 + 10.0.17763.0 @@ -100,7 +100,7 @@ - + diff --git a/build/fastrip.vcxproj.filters b/build/fastrip.vcxproj.filters index c79da4d3d..e34947934 100644 --- a/build/fastrip.vcxproj.filters +++ b/build/fastrip.vcxproj.filters @@ -15,7 +15,7 @@ - + Source Files diff --git a/build/patchdef.vcxproj b/build/patchdef.vcxproj new file mode 100644 index 000000000..4ea6975ee --- /dev/null +++ b/build/patchdef.vcxproj @@ -0,0 +1,108 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2DCB2E4A-EFB6-4561-8D87-C5ADBDB76533} + Win32Proj + fastrip + 10.0.17763.0 + + + + Application + true + Unicode + v141 + + + Application + false + true + NotSet + v141 + + + + + + + + + + + + + true + ..\obj\$(SolutionName)\$(ProjectName)\ + $(ProjectDir)\ + + + false + $(ProjectDir)\ + ..\obj\$(SolutionName)\$(ProjectName)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(IntDir)$(TargetName).pdb + + + Console + true + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).pdb + + + $(IntDir)$(TargetName).bsc + + + $(IntDir)$(TargetName).xml + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(IntDir)$(TargetName).pdb + + + Console + + + true + true + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).pdb + + + $(IntDir)$(TargetName).bsc + + + $(IntDir)$(TargetName).xml + + + + + + + + + \ No newline at end of file diff --git a/build/vedoc.vcxproj b/build/vedoc.vcxproj index 040121770..8172c38fe 100644 --- a/build/vedoc.vcxproj +++ b/build/vedoc.vcxproj @@ -115,12 +115,6 @@ - - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) diff --git a/build/vedoc.vcxproj.filters b/build/vedoc.vcxproj.filters index 753a969f8..22fe66c11 100644 --- a/build/vedoc.vcxproj.filters +++ b/build/vedoc.vcxproj.filters @@ -11,9 +11,6 @@ - - Source Files - Source Files diff --git a/build/vedocext.vcxproj b/build/vedocext.vcxproj index c521441ad..6a7716d91 100644 --- a/build/vedocext.vcxproj +++ b/build/vedocext.vcxproj @@ -129,6 +129,9 @@ + + + diff --git a/build/vedocext.vcxproj.filters b/build/vedocext.vcxproj.filters index 86b31a1bb..e6d6fc142 100644 --- a/build/vedocext.vcxproj.filters +++ b/build/vedocext.vcxproj.filters @@ -83,4 +83,7 @@ Header Files + + + \ No newline at end of file diff --git a/cd/test/tp0972.txt b/cd/test/tp0972.txt new file mode 100644 index 000000000..f11a6cd2d --- /dev/null +++ b/cd/test/tp0972.txt @@ -0,0 +1,4 @@ +tp0.exe + +Modificata la gestione degli addebiti a accrediti di solo CONAI per la dichiarazione. +Bisogna utilizzare righe di spesa a quantità e prezzo con codice corrispondente al codice spesa CONAI corrispondente emettere il codice della sottocategoria nel primo campo CONAI. Il peso unitario non serve e NON viene utilizzato. diff --git a/cd/test/tp0972a.ini b/cd/test/tp0972a.ini new file mode 100644 index 000000000..4d7c6444b --- /dev/null +++ b/cd/test/tp0972a.ini @@ -0,0 +1,21 @@ +[Main] +Demo=0 + +[tp0] +File(0) = tp0.exe|X +Patch = 972 +Versione = 21511200 + +[tp] +Data = 30-06-2020 +Descrizione = Trasferimento PACK +Dischi = 1 +Moduli = ve +OEM = +Patch = 972 +PostProcess = +PreProcess = +Prezzo(1) = +Prezzo(2) = +Versione = 21511200 + diff --git a/cd/test/tp0972a1.zip b/cd/test/tp0972a1.zip new file mode 100644 index 000000000..190a9322b Binary files /dev/null and b/cd/test/tp0972a1.zip differ diff --git a/cd/test/ve0972.txt b/cd/test/ve0972.txt new file mode 100644 index 000000000..f2b66892c --- /dev/null +++ b/cd/test/ve0972.txt @@ -0,0 +1,5 @@ +verig01.msk +verig03.msk +verig02.msk + +Aggiunti i campi CONAI alle righe di spesa a quantità e prezzo diff --git a/cd/test/ve0972a.ini b/cd/test/ve0972a.ini new file mode 100644 index 000000000..5ac7c589f --- /dev/null +++ b/cd/test/ve0972a.ini @@ -0,0 +1,131 @@ +[Main] +Demo=0 + +[ve1] +File(105) = verig01.msk|X +File(107) = verig02.msk|X +File(109) = verig03.msk|X +Patch = 0972 +Versione = 21511200 + +[ve99] +Kill(0) = batbcld.msk|x +Kill(1) = bastspp.rep|x +Kill(2) = bastfrr.msk|x +Kill(3) = bastbnp.rep|x +Kill(4) = bastgmc.msk|x +Kill(5) = batbrfc.msk|x +Kill(6) = batbfca.msk|x +Kill(7) = bastcra.rep|x +Kill(8) = bastprs.rep|x +Kill(9) = bastgcg.rep|x +Kill(10) = bastbnp.msk|x +Kill(11) = bastrfa.rep|x +Kill(12) = bastgca.msk|x +Kill(13) = bastgcg.msk|x +Kill(14) = bastnum.rep|x +Kill(15) = basttag.msk|x +Kill(16) = bastasf.rep|x +Kill(17) = batbrfa.msk|x +Kill(18) = batbctr.msk|x +Kill(19) = efstbnp.rep|x +Kill(20) = batbgca.msk|x +Kill(21) = ve7600a.msk|x +Kill(22) = ve7300a.frm|x +Kill(23) = ve7100a.msk|x +Kill(24) = basteld.rep|x +Kill(25) = batbprs.msk|x +Kill(26) = batbfrr.msk|x +Kill(27) = batbmre.msk|x +Kill(28) = ve7701a.ini|x +Kill(29) = batbfsa.msk|x +Kill(30) = batbstd.msk|x +Kill(31) = bastfrr.rep|x +Kill(32) = batbubi.msk|x +Kill(33) = ve7200a.msk|x +Kill(34) = bastctr.msk|x +Kill(35) = batbspp.msk|x +Kill(36) = batbtri.msk|x +Kill(37) = bastabe.rep|x +Kill(38) = bastprs.msk|x +Kill(39) = bastfrd.msk|x +Kill(40) = bastcau.msk|x +Kill(41) = bastfca.rep|x +Kill(42) = ve7700a.msk|x +Kill(43) = batbbnp.msk|x +Kill(44) = bastspp.msk|x +Kill(45) = bastnum.msk|x +Kill(46) = bastrfc.rep|x +Kill(47) = basttri.rep|x +Kill(48) = baststd.msk|x +Kill(49) = batbcaa.msk|x +Kill(50) = ve7400conf.ini|x +Kill(51) = basttip.rep|x +Kill(52) = bastrfc.msk|x +Kill(53) = eftbbnp.msk|x +Kill(54) = batbgmc.msk|x +Kill(55) = bastfca.msk|x +Kill(56) = batbspt.msk|x +Kill(57) = bastabe.msk|x +Kill(58) = ve7400a.msk|x +Kill(59) = bastcra.msk|x +Kill(60) = batbfrd.msk|x +Kill(61) = bastfrm.msk|x +Kill(62) = basttri.msk|x +Kill(63) = batbgsa.msk|x +Kill(64) = bastcaa.msk|x +Kill(65) = batbpro.msk|x +Kill(66) = bastimb.msk|x +Kill(67) = basttag.rep|x +Kill(68) = batbgcg.msk|x +Kill(69) = baststd.rep|x +Kill(70) = batbtag.msk|x +Kill(71) = bastfrm.rep|x +Kill(72) = bastcau.rep|x +Kill(73) = bastums.msk|x +Kill(74) = ve7200a.frm|x +Kill(75) = bastcaa.rep|x +Kill(76) = bastgca.rep|x +Kill(77) = bastubi.msk|x +Kill(78) = bastasf.msk|x +Kill(79) = bastctr.rep|x +Kill(80) = bastums.rep|x +Kill(81) = batbprv.msk|x +Kill(82) = ve7500a.msk|x +Kill(83) = batbfid.msk|x +Kill(84) = batbums.msk|x +Kill(85) = bastfrd.rep|x +Kill(86) = basteld.msk|x +Kill(87) = batbnum.msk|x +Kill(88) = batbtip.msk|x +Kill(89) = batbcau.msk|x +Kill(90) = ve7300a.msk|x +Kill(91) = batbcra.msk|x +Kill(92) = bastrfa.msk|x +Kill(93) = bastimb.rep|x +Kill(94) = ve7.exe|x +Kill(95) = bastgmc.rep|x +Kill(96) = efstbnp.msk|x +Kill(97) = batbfrm.msk|x +Kill(98) = batbacr.msk|x +Kill(99) = batbimb.msk|x +Kill(100) = ve7400a.ini|x +Kill(101) = bastubi.rep|x +Kill(102) = batbeld.msk|x +Kill(103) = batbasf.msk|x +Kill(104) = basttip.msk|x +Kill(105) = batbabe.msk|x + +[ve] +Data = 30-06-2020 +Descrizione = Vendite +Dischi = 1 +Moduli = ba,cg9,pr9,mg9,sv9,in9,ef9 +OEM = +Patch = 0972 +PostProcess = bainst -0 VE +PreProcess = +Prezzo(1) = +Prezzo(2) = +Versione = 21511200 + diff --git a/cd/test/ve0972a1.zip b/cd/test/ve0972a1.zip new file mode 100644 index 000000000..72d40b30a Binary files /dev/null and b/cd/test/ve0972a1.zip differ diff --git a/src/ba/ba3100.cpp b/src/ba/ba3100.cpp index c6b0560b4..23e25b641 100755 --- a/src/ba/ba3100.cpp +++ b/src/ba/ba3100.cpp @@ -3,7 +3,7 @@ #include #include -#include "../cg/cglib03.h" +#include "../cg/cglib.h" #include "../cg/cgtbcam.h" #include "../cg/cgtbdel.h" diff --git a/src/ca/calib01.cpp b/src/ca/calib01.cpp index 9788549cd..da1d2b990 100755 --- a/src/ca/calib01.cpp +++ b/src/ca/calib01.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -14,7 +15,7 @@ #include "calib01.h" #include "calib02.h" #include "calibmsk.h" -#include "../cg/cg2103.h" +#include "../cg/cglib.h" #include "cdc.h" #include "commesse.h" @@ -35,7 +36,7 @@ class TConfig_anal : public TConfig int _level; public: - virtual const TString& get(const char* var, const char* section = NULL, int index = -1, const char* def = ""); + virtual const TString& get(const char* var, const char* section = nullptr, int index = -1, const char* def = ""); TConfig_anal(); }; @@ -46,7 +47,7 @@ TConfig_anal::TConfig_anal() : TConfig(CONFIG_DITTA, "ca"), _level(0) if (a.active(CIAUT)) _level |= 2; // Controllo se è veramente configurato il primo livello a CMS o CDC - if (_level > 1 && TConfig::get("Level", NULL, 1).blank()) + if (_level > 1 && TConfig::get("Level", nullptr, 1).blank()) _level = 0; } @@ -88,11 +89,10 @@ const TString& TConfig_anal::get(const char* varname, const char* section, int i TConfig& ca_config(bool force_reload) { - static TConfig_anal* cfg = NULL; - if (cfg == NULL || force_reload) + static TConfig_anal* cfg = nullptr; + if (cfg == nullptr || force_reload) { - if (cfg != NULL) - delete cfg; + SAFE_DELETE(cfg); cfg = new TConfig_anal; } return *cfg; @@ -275,12 +275,12 @@ TMultilevel_code_info::TMultilevel_code_info(int logicnum) : _logicnum(logicnum) int from = 1, to = 1; for (int level = 1; ; level++) { - const TString& prompt = cfg.get(desvar, NULL, level); + const TString& prompt = cfg.get(desvar, nullptr, level); if (prompt.blank()) break; _prompt.add(prompt); - const TString& picture = cfg.get(keyvar, NULL, level); + const TString& picture = cfg.get(keyvar, nullptr, level); _picture.add(picture); const int keylen = picture.len(); @@ -297,11 +297,14 @@ TMultilevel_code_info::TMultilevel_code_info(int logicnum) : _logicnum(logicnum) const TMultilevel_code_info& ca_multilevel_code_info(int logicnum) { - static TArray* cache = NULL; - if (cache == NULL) + static TArray* cache = nullptr; + + if (cache == nullptr) cache = new TArray; + TMultilevel_code_info* info = (TMultilevel_code_info*)cache->objptr(logicnum); - if (info == NULL) + + if (info == nullptr) { info = new TMultilevel_code_info(logicnum); cache->add(info, logicnum); @@ -321,7 +324,8 @@ const TMultilevel_code_info* ca_multilevel_code_info_by_index(int level) if (_logicnum[0] < 0) { TConfig& cfg = ca_config(); - const TString& lev1 = cfg.get("Level", NULL, 1); + const TString& lev1 = cfg.get("Level", nullptr, 1); + if (lev1.full()) { const TMultilevel_code_info& fasi = ca_multilevel_code_info(LF_FASI); @@ -330,7 +334,7 @@ const TMultilevel_code_info* ca_multilevel_code_info_by_index(int level) if (fasi.parent() == _logicnum[k]) _logicnum[++k] = LF_FASI; - const TString& lev2 = cfg.get("Level", NULL, 2); + const TString& lev2 = cfg.get("Level", nullptr, 2); if (lev2.full()) { _logicnum[++k] = _logicnum[0] == LF_COMMESSE ? LF_CDC : LF_COMMESSE; @@ -344,7 +348,7 @@ const TMultilevel_code_info* ca_multilevel_code_info_by_index(int level) logic = _logicnum[level]; } - return logic > 0 ? &ca_multilevel_code_info(logic) : NULL; + return logic > 0 ? &ca_multilevel_code_info(logic) : nullptr; } bool ca_test_multilevel_field(TEdit_field& fld, int level) @@ -420,7 +424,7 @@ const char* ca_dollar2fieldname(int logic, const char* dollar) default : return FASI_CODFASE; } } - return NULL; + return nullptr; } void ca_append_and(TString& query, const TString& clause) @@ -452,7 +456,8 @@ static const TString& ca_get_user_permissions(const TString& utente, const int l if (ini_permessi.set_paragraph(utente)) { - const char* fieldname = NULL; + const char* fieldname = nullptr; + switch (logic) { case LF_COMMESSE: fieldname = "Cms"; break; @@ -460,7 +465,7 @@ static const TString& ca_get_user_permissions(const TString& utente, const int l case LF_FASI: fieldname = "Fas"; break; default: break; } - if (fieldname != NULL) + if (fieldname != nullptr) { const TString& expr = ini_permessi.get(fieldname); ca_append_and(select, expr); @@ -473,7 +478,7 @@ static const TString& ca_get_user_permissions(const TString& utente, const int l TToken_string row(80, SAFE_PIPE_CHR); for (int r = 0;; r++) { - row = ini_permessi.get("Prog", NULL, r); + row = ini_permessi.get("Prog", nullptr, r); if (row.blank()) break; if (key == row.get(0)) @@ -524,7 +529,8 @@ const TString& ca_create_user_select_clause(int logic) { static TArray clauses; TString* clause = (TString*)clauses.objptr(logic); - if (clause == NULL) + + if (clause == nullptr) { clause = new TString; switch (logic) @@ -579,7 +585,7 @@ bool ca_filter_record(const TRectype& rec) bool ca_filter_function(const TRelation* rel) { - return rel != NULL && ca_filter_record(rel->curr()); + return rel != nullptr && ca_filter_record(rel->curr()); } @@ -837,13 +843,14 @@ int ca_create_fields(TMask& msk, int page, int logicnum, int x, int y, prompt.left_just(maxdeslen); const char* flags = picture[0] == '0' || picture[0] == '9' ? "BUZ" : "BU"; - TEdit_field* kfld = NULL; + TEdit_field* kfld = nullptr; + if (mci.is_numeric_picture(i)) // Numeric kfld = &msk.add_number(kid, page, prompt, tab0, y+i, picture.len(), flags); else kfld = &msk.add_string(kid, page, prompt, tab0, y+i, picture.len(), flags); ca_create_browse1(*kfld, i, logicnum, key_id, desc_in_sh && (i == mci.levels() - 1) ? key_id + mci.levels() - i : des_id); - if ((mode & 0x1) != 0 && fieldname == NULL) + if ((mode & 0x1) != 0 && fieldname == nullptr) kfld->set_key(1); // Ho specificato un nome di campo speciale @@ -872,7 +879,7 @@ int ca_create_fields(TMask& msk, int page, int logicnum, int x, int y, const short did = desc_in_sh && (i == mci.levels() - 1) ? key_id+mci.levels() : des_id+i; TEdit_field& dfld = msk.add_string(did, page, "", tab1, y+i, 50, "B", 72+tab0-tab1); ca_create_browse2(dfld, i, logicnum, key_id); - if ((mode & 0x2) != 0 && fieldname == NULL) + if ((mode & 0x2) != 0 && fieldname == nullptr) dfld.set_key(2); else dfld.set_field(""); @@ -964,14 +971,14 @@ int ca_create_fields_compact(TMask& msk, int page, int logicnum, int x, int y, const char* flags = picture[0] == '0' || picture[0] == '9' ? "BUZG" : "BUG"; - TEdit_field* kfld = NULL; + TEdit_field* kfld = nullptr; if (mci.is_numeric_picture(i)) // Numeric kfld = &msk.add_number(kid, page, prompt, tab0 + offset, y + row_offset, picture.len(), flags); else kfld = &msk.add_string(kid, page, prompt, tab0 + offset, y + row_offset, picture.len(), flags); ca_create_browse1(*kfld, i, logicnum, key_id, des_id); - if ((mode & 0x1) != 0 && fieldname == NULL) + if ((mode & 0x1) != 0 && fieldname == nullptr) kfld->set_key(1); // Ho specificato un nome di campo speciale @@ -995,7 +1002,7 @@ int ca_create_fields_compact(TMask& msk, int page, int logicnum, int x, int y, } // Copio il checktype nel campo fantasma per colorare correttamente la colonna - if (msk.get_sheet() != NULL && kfld->required()) + if (msk.get_sheet() != nullptr && kfld->required()) msk.efield(kid-100).check_type(kfld->check_type()); } @@ -1010,7 +1017,7 @@ int ca_create_fields_compact(TMask& msk, int page, int logicnum, int x, int y, TEdit_field& dfld = (i < mci.levels() - 1) && (i != par_items -1) ? msk.add_string(did, page, "", 50, 50, 50, "B") : msk.add_string(did, page, "", tab1, y + row_offset, 50, "B", 72+tab0-tab1); ca_create_browse2(dfld, i, logicnum, key_id); - if ((mode & 0x2) != 0 && fieldname == NULL) + if ((mode & 0x2) != 0 && fieldname == nullptr) dfld.set_key(2); else dfld.set_field(""); @@ -1034,7 +1041,7 @@ int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, for (int i = 0; i < 2; i++) { - const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2 + const TString& level = ini.get("Level", nullptr, i+1); // Legge il livello 1 o 2 if (level == "CDC" && cdc_fld && *cdc_fld) // Crea centro di costo { @@ -1117,7 +1124,7 @@ int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, numero_campi += nfields; } - if (m.get_sheet() != NULL) //Se è una maschera di riga, sistemo le colonne delle sheet + if (m.get_sheet() != nullptr) //Se è una maschera di riga, sistemo le colonne delle sheet { TSheet_field& s = *m.get_sheet(); for (short id = first_id + 116; id >= first_id + 100; id--) @@ -1472,8 +1479,9 @@ bool TSimple_anal_msk::on_field_event(TOperable_field& o, TField_event e, long j const TTree_field& fld = (const TTree_field&)o; const TTree& tree = *fld.tree(); TToken_string curr; tree.curr_id(curr); - TEdit_field* last = NULL; - for (int i = 0; ; i++) + TEdit_field* last = nullptr; + + for (int i = 0; ; i++) { const short id = get_field_id(i); if (id <= 0) @@ -1488,7 +1496,7 @@ bool TSimple_anal_msk::on_field_event(TOperable_field& o, TField_event e, long j if (tok && *tok) last = &e; } - if (last != NULL) + if (last != nullptr) { if (last->check()) stop_run(K_AUTO_ENTER); @@ -1658,7 +1666,8 @@ const TToken_string& TSimple_anal_msk::get_key_value(const TRectype& rec, int c) const TToken_string& TSimple_anal_msk::get_key_value(int c) const { TToken_string& val = get_tmp_string(); - for (TEditable_field* f = get_key_field(c, true); f != NULL; f = get_key_field(c, false)) + + for (TEditable_field* f = get_key_field(c, true); f != nullptr; f = get_key_field(c, false)) { val.add(f->get()); } @@ -1780,8 +1789,9 @@ void TAnal_tree::node2id(const TObject* node, TString& id) const bool TAnal_tree::goto_root() { bool ok = false; + //gestione speciale per le fasi con babbo - if (_father_curs != NULL) + if (_father_curs != nullptr) { if (_father_curs->items() > 0) { @@ -2013,7 +2023,7 @@ TImage* TAnal_tree::image(bool selected) const return get_res_image(bmp_id); } -TAnal_tree::TAnal_tree(int logicnum) : _curs(NULL), _father_curs(NULL), _is_father(false) +TAnal_tree::TAnal_tree(int logicnum) : _curs(nullptr), _father_curs(nullptr), _is_father(false) { TString select; _curs = new TCursor(new TRelation(logicnum), ca_create_user_select_clause(logicnum)); @@ -2170,10 +2180,8 @@ bool TAnal_app::remove() bool TAnal_app::user_destroy() { - if (_msk != NULL) - delete _msk; - if (_rel != NULL) - delete _rel; + SAFE_DELETE(_msk); + SAFE_DELETE(_rel); return true; } @@ -2219,7 +2227,7 @@ const char * TAnal_mov::row_code(int row) const for (int i = 0; i < 2; i++) { - const TString& level = cfg.get("Level", NULL, i+1); // Legge il livello 1 o 2 + const TString& level = cfg.get("Level", nullptr, i+1); // Legge il livello 1 o 2 if (level == "CDC") // Crea centro di costo { @@ -2344,7 +2352,7 @@ void TAnal_mov::saldo_set_reset(const TRectype& row, bool reset) TImporto curr_imp(imp_row.sezione(), texaco.get()); key.add(es, 1); //sistema l'anno di esercizio nella chiave TImporto* imp = (TImporto*)_saldi.objptr(key); - if (imp == NULL) + if (imp == nullptr) { imp = new TImporto; _saldi.add(key, imp); @@ -2356,7 +2364,8 @@ void TAnal_mov::saldo_set_reset(const TRectype& row, bool reset) if (ca_ori_present(row)) { TImporto* impind = (TImporto*)_saldind.objptr(key); - if (impind == NULL) + + if (impind == nullptr) { impind = new TImporto; _saldind.add(key, impind); @@ -2371,7 +2380,8 @@ void TAnal_mov::saldo_set_reset(const TRectype& row, bool reset) else //saldo in un solo anno (caso standard) { TImporto* imp = (TImporto*)_saldi.objptr(key); - if (imp == NULL) + + if (imp == nullptr) { imp = new TImporto; _saldi.add(key, imp); @@ -2383,7 +2393,8 @@ void TAnal_mov::saldo_set_reset(const TRectype& row, bool reset) if (ca_ori_present(row)) { TImporto* impind = (TImporto*)_saldind.objptr(key); - if (impind == NULL) + + if (impind == nullptr) { impind = new TImporto; _saldind.add(key, impind); @@ -2483,8 +2494,9 @@ bool TAnal_mov::save_saldi(const int annoes) if (err == NOERR) { - const char* fld_sez = NULL; - const char* fld_val = NULL; + const char* fld_sez = nullptr; + const char* fld_val = nullptr; + switch (tipo) { case 'P': fld_sez = SALDANA_SEZIONEP; fld_val = SALDANA_SALDOP; break; @@ -2500,7 +2512,7 @@ bool TAnal_mov::save_saldi(const int annoes) const TImporto * ind = (const TImporto*) _saldind.objptr(key); - if (ind != NULL) + if (ind != nullptr) { const TImporto& impind = *(const TImporto*)ind; switch (tipo) @@ -2671,7 +2683,8 @@ int TAnal_mov::save_rmov_comp() const { const TRectype* rmov_old = (TRectype*)itm; const TRectype* rmov_new = (TRectype*)new_rows.objptr(key); - if (rmov_new == NULL) + + if (rmov_new == nullptr) rmov_old->remove(file); } } @@ -3296,10 +3309,12 @@ bool ca_extract_sheet_field(const TSheet_field& sheet, const int row, const int FOR_EACH_MASK_FIELD(mask_sheet, i, f) //giro sui campi della maschera di riga { const TFieldref* fr = f->field(); //campo corrente della maschera - if (fr != NULL && f->is_edit()) //deve essere un campo di tipo edit + + if (fr != nullptr && f->is_edit()) //deve essere un campo di tipo edit { TEdit_field& e = *(TEdit_field*)f; //visto che è di tipo edit può creare l'edit_field per farne la browse - if (e.browse() != NULL) + + if (e.browse() != nullptr) { const TCursor& cur = *e.browse()->cursor(); const int ln = cur.file().num(); //Allah! dal campo ricava il cursore sul file di numero ln diff --git a/src/ca/calib01.h b/src/ca/calib01.h index 00d54accd..5a152cbdb 100755 --- a/src/ca/calib01.h +++ b/src/ca/calib01.h @@ -13,8 +13,8 @@ #include #endif -#ifndef __CGLIB03_H -class TBill; +#ifndef __CGLIB_H +#include "../cg/cglib.h" #endif class TRecordset ; diff --git a/src/ca/calib02.cpp b/src/ca/calib02.cpp index 4e7c1fe87..c016c1933 100755 --- a/src/ca/calib02.cpp +++ b/src/ca/calib02.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "movana.h" #include "pconana.h" @@ -263,7 +264,7 @@ bool TPconana_recordset::valid_record(const TRelation& rel) const return true; } -static const TPconana_recordset* _current_recset = NULL; +static const TPconana_recordset* _current_recset = nullptr; bool TPconana_recordset::pianoconti_filter(const TRelation* rel) { return _current_recset->valid_record(*rel); } @@ -365,12 +366,13 @@ size_t TAnal_report::get_usr_words(TString_array& words) const "CA_FORMAT_CONTO", "CA_FORMAT_CMSCDC", "CA_FORMAT_CONTO_DESCR", - NULL + nullptr }; ((TAnal_report*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile size_t i; - for (i = 0; name[i] != NULL; i++) + + for (i = 0; name[i] != nullptr; i++) words.add(name[i]); return words.items(); @@ -1125,13 +1127,11 @@ TSaldi_cache::TSaldi_cache() : TCache(3881) // Numero primo const TSaldanal& ca_saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi) { - static TSaldi_cache* cache = NULL; - if (tipi == 0 && cache != NULL) - { - delete cache; - cache = NULL; - } - if (cache == NULL) + static TSaldi_cache* cache = nullptr; + + if (tipi == 0) + SAFE_DELETE(cache); + if (cache == nullptr) cache = new TSaldi_cache; return cache->saldo(bill, dal, al, tipi); } @@ -1168,7 +1168,8 @@ int TAnal_report_mask::create_sheet_fields(short sheet_id, int lf, int& y, short } } - const char* fieldname = NULL; + const char* fieldname = nullptr; + switch(logic) { case LF_CDC : fieldname = RMOVANA_CODCCOSTO; break; @@ -1207,7 +1208,8 @@ void TAnal_report_mask::create_sheet(short sheet_id) for (int i = 0; i < 2; i++) { - const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2 + const TString& level = ini.get("Level", nullptr, i+1); // Legge il livello 1 o 2 + if (level == "CDC") // Crea centro di costo { if (fasinfo.parent() == LF_CDC) @@ -1255,7 +1257,8 @@ int TAnal_report_mask::get_row_bill(TSheet_field& sf, int r, TAnal_bill& bill) for (int level = 0; level <= 2; level++) { const TMultilevel_code_info* info = ca_multilevel_code_info_by_index(level); - if (info == NULL) + + if (info == nullptr) break; TString20 code; for (int i = 0; i < info->levels(); i++) @@ -1280,7 +1283,8 @@ int TAnal_report_mask::set_row_bill(TSheet_field& sf, int r, const TAnal_bill& b for (int level = 0; level <= 2; level++) { const TMultilevel_code_info* info = ca_multilevel_code_info_by_index(level); - if (info == NULL) + + if (info == nullptr) break; TToken_string code; switch (info->logic()) diff --git a/src/ca/calib02.h b/src/ca/calib02.h index d8e90d47c..1e535312c 100755 --- a/src/ca/calib02.h +++ b/src/ca/calib02.h @@ -9,8 +9,8 @@ #include #endif -#ifndef __CGLIB01_H -#include "../cg/cglib01.h" +#ifndef __CGLIB_H +#include "../cg/cglib.h" #endif /////////////////////////////////////////////////////////// diff --git a/src/cg/cg1312.cpp b/src/cg/cg1312.cpp index c773d4bdc..5bf3b72a9 100644 --- a/src/cg/cg1312.cpp +++ b/src/cg/cg1312.cpp @@ -13,7 +13,7 @@ #include #include "cgsaldac.h" -#include "cglib03.h" +#include "cglib.h" #include "cg1300m.h" #include diff --git a/src/cg/cg1313.cpp b/src/cg/cg1313.cpp index 890615d3b..f5cdba609 100644 --- a/src/cg/cg1313.cpp +++ b/src/cg/cg1313.cpp @@ -5,7 +5,7 @@ #include "cg1300.h" #include "cg1313.h" -#include "cg2103.h" +#include "cglib.h" #include diff --git a/src/cg/cg1314.cpp b/src/cg/cg1314.cpp index 827e48127..39a795bf5 100644 --- a/src/cg/cg1314.cpp +++ b/src/cg/cg1314.cpp @@ -15,7 +15,7 @@ #include #include "cg1314.h" #include "cg1300n.h" -#include "cglib01.h" +#include "cglib.h" bool TAgg_tcontoCF::create() { diff --git a/src/cg/cg1500.cpp b/src/cg/cg1500.cpp index e582c80b9..b6b1b13ce 100755 --- a/src/cg/cg1500.cpp +++ b/src/cg/cg1500.cpp @@ -5,8 +5,8 @@ // - Non esistono piu' i progressivi dei movimenti scaricati PDARESCA e PAVERESCA; // - Ora esistono un record per i movimenti normali e un record per i movimenti scaricati; la // distinzione e' resa possibile dall' introduzione in chiave di un flag FLSCA (vedi tracciato) -// che e' un booleano. Il record con FLSCA = FALSE contiene la somma dei saldi dei movimenti -// normali e dei movimenti scaricati, mentre il record con FLSCA = TRUE, contiene solo i saldi +// che e' un booleano. Il record con FLSCA = false contiene la somma dei saldi dei movimenti +// normali e dei movimenti scaricati, mentre il record con FLSCA = true, contiene solo i saldi // dei movimenti scaricati. // Tutti i progressivi che nel programma venivano memorizzati nei campi PDARESCA e PAVERESCA dei // file temporanei ora sono memorizzati in PDAREPRO e PAVEREPRO. @@ -41,17 +41,17 @@ #include "cg1.h" #include "cg1500.h" -#include "cglib01.h" -#include "cglib02.h" +#include "cglib.h" + class TStampa_bilanci : public TPrintapp { - static bool mask_anno (TMask_field& f, KEY k); + static bool mask_anno (TMask_field& f, KEY k); static bool mask_datalim (TMask_field& f, KEY k); static bool verifica_handler(TMask_field& f, KEY k); - static bool mask_date (TMask_field& f, KEY k); + static bool mask_dataini (TMask_field& f, KEY k); static bool mask_bilancio(TMask_field& f, KEY k); - static bool mask_tipost (TMask_field& f, KEY k); + static bool mask_tipost (TMask_field& f, KEY k); struct cli_for { @@ -72,7 +72,6 @@ class TStampa_bilanci : public TPrintapp TRelation* _rel; TCursor * _cur; - TProgress_monitor * _prog; TSaldi_list* _listacf, * _lista; TLocalisamfile* _com, * _pcn, * _mov, * _rmov, * _clifo, * _saldi, * _nditte,* _anag,* _caus; TIsamtempfile * _tmp_saldi_att, * _tmp_saldi_pass, * _tmp_saldi_conti_uno; @@ -84,13 +83,12 @@ class TStampa_bilanci : public TPrintapp TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis; TString _descr_dare, _descr_avere, _gc_corr_dare, _gc_corr_avere, _descr; TString _gc_prec_dare, _gc_prec_avere, _situazione, _descr_succ; - TString _tmp; #ifdef CONT_SEP TString _cont_sep; #endif char _tipo_conto, _tipoc_succ; - int _annoes, _bilancio, _tipo_stampa, _tipo_stampa1,_stampa_width,_gp,_cp,_i; + int _annoes, _bilancio, _tipo_stampa,_stampa_width,_gp,_cp,_i; int _eof1, _eof2, _gruppo_dare, _gruppo_avere, _conto_dare, _conto_avere; int _add_file_da, _add_file_a, _indbil_dare, _indbil_avere, _indbil; int _eof3, _eof4, _eof5, _eof6, _verifica, _stampac, _stampav, _ordinamento, _print_full_code; @@ -110,13 +108,14 @@ class TStampa_bilanci : public TPrintapp real _prg_saldoini_dare, _prg_saldoini_avere, _prg_inidare_ord, _prg_iniavere_ord; real _nuovo_tot_saldo_d, _nuovo_tot_saldo_a; - TDate _datalim, _data, _datada, _dataa, _dataini, _ultima_data, _u_max; + TDate _data, _dal, _al, _dataini, _ultima_data, _u_max; bool _cambiato_conto_1, _cambiato_conto_2, _add_file_avere; bool _add_file_dare, _prima_volta, _seconda_volta, _totali, _codici, _saldo; bool _add_dare, _add_avere, _controlla, _salto_pagina, _flag, _stampato; bool _sottoc_dare, _sottoc_avere, _salto_pagina1, _livello_conto; bool _mov_ap,_quadratura; bool _print_exercise, _hide_clifo; + TTipo_data _tipo_data; int _stampa_mov_prov; TBill _bill_from, _bill_to; TArray _clienti, _fornitori; @@ -126,10 +125,6 @@ class TStampa_bilanci : public TPrintapp #endif public: - TDate _inizioEs, _fineEs; - - int date2esc(const TDate& d, int* prevesc = NULL); - bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; } virtual bool user_create() ; virtual bool user_destroy(); @@ -144,8 +139,6 @@ public: virtual void postclose_print(); virtual void set_page(int,int); real compensazione(bool compensa, int indbil_conto, real& saldo); - //const char* causale_chiusura() { return _causale_chi;} - //const char* causale_apertura() { return _causale_ap;} bool bil_sez_contr(); bool bil_verifica(); bool ricerca_sottoc_clifo(int,int,bool,int,real&); @@ -179,7 +172,6 @@ public: void stampa_totali(); void stampa_totali_uno(const real&, const real&); void controlla_conto(int,int); - const char* DescrizioneConto(int,int,long,char); //chiama quella di TConto TDate UltimaData(int,int,long,int); void stampa_un_bilancio(const TMask& m); @@ -188,361 +180,139 @@ public: HIDDEN inline TStampa_bilanci& app() { return (TStampa_bilanci&)main_app(); } -TDate InizioEsercizio(int anno) -{ - TEsercizi_contabili esc; - TDate inizio_es; - if (esc.exist(anno)) - inizio_es = esc[anno].inizio(); - return inizio_es; -} - -TDate FineEsercizio(int anno) -{ - TEsercizi_contabili esc; - TDate fine_es; - if (esc.exist(anno)) - fine_es = esc[anno].fine(); - return fine_es; -} - -bool IsEsercizio (const TDate& datalim, int anno_eser) -{ - TEsercizi_contabili esc; - bool yes = esc.date2esc(datalim) == anno_eser; - return yes; -} - -int TStampa_bilanci::date2esc(const TDate& d, int* prevesc) -{ - TEsercizi_contabili esc; - int anno = esc.date2esc(d); - if (prevesc) - *prevesc = esc.pred(anno); - return anno; -} - bool TStampa_bilanci::mask_anno(TMask_field& f, KEY k) { + TMask& m = f.mask(); + if (k == K_ENTER) { - int tipo_stampa; - int anno = f.mask().get_int(F_ANNO); - int bilancio = f.mask().get_int(F_BILANCIO); - if (bilancio == 1) - tipo_stampa = f.mask().get_int(F_STAMPA); - else - tipo_stampa = f.mask().get_int(F_STAMPA1); - if (tipo_stampa == 2) - if (anno == 0) - { - f.error_box(TR("Indicare l'anno di esercizio")); - return FALSE; - } + const int tipo_stampa = m.get_int(F_STAMPA); + const int anno = m.get_int(F_ANNO); + + if (tipo_stampa == 2 && anno == 0) + return f.error_box(TR("Indicare l'anno di esercizio")); } - if ( k == K_TAB || f.focusdirty()) + if (f.running_check(k)) { - int tipo_stampa; - int anno = f.mask().get_int(F_ANNO); - int bilancio = f.mask().get_int(F_BILANCIO); - if (bilancio == 1) - tipo_stampa = f.mask().get_int(F_STAMPA); - else - tipo_stampa = f.mask().get_int(F_STAMPA1); - - if ((bilancio == 2) && (tipo_stampa == 1)) - if (anno != 0) - { - f.mask().show(F_DATADA); - f.mask().show(F_DATAA); - //f.mask().show(F_STAMPAMPROV); - f.mask().show(96); - f.mask().show(97); - f.mask().hide(98); - f.mask().hide(99); - } - else - { - f.mask().show(F_DATADA); - f.mask().show(F_DATAA); - //f.mask().show(F_STAMPAMPROV); - f.mask().show(98); - f.mask().show(99); - f.mask().hide(96); - f.mask().hide(97); - } - } - if (k == K_TAB) - { - int tipo_bil, tipo_stp; - tipo_bil = f.mask().get_int(F_BILANCIO); - if (tipo_bil == 1) - tipo_stp = f.mask().get_int(F_STAMPA); - else - tipo_stp = f.mask().get_int(F_STAMPA1); - if (tipo_bil == 2 && tipo_stp == 1 /* && f.mask().get_int(F_ANNO) == 0 */) - f.mask().show(F_QUADRATURA); - else - { - f.mask().set (F_QUADRATURA,""); - f.mask().hide(F_QUADRATURA); - } + const int tipo_stampa = m.get_int(F_STAMPA); + const int anno = m.get_int(F_ANNO); + const int bilancio = m.get_int(F_BILANCIO); + const TDate datalim = m.get_date(F_DATALIM); + TDate data; + + if (esercizi().exist(datalim)) + data = esercizio(datalim).fine(); + m.enable_page(1, bilancio != 1); + m.show(F_DATAINI, bilancio == 2 && tipo_stampa == 1); + m.show(F_QUADRATURA, bilancio == 2 && tipo_stampa == 1 && data == datalim); } - return TRUE; + return true; } bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k) { - int tipo_bil, tipo_stp; - if (k == K_SPACE) { TMask& m = f.mask(); const int anno = m.get_int(F_ANNO); const int bilancio = m.get_int(F_BILANCIO); - int tipo_stampa; - if (bilancio == 1) //bilancio a sezioni contrapposte - { - tipo_stampa = m.get_int(F_STAMPA); - m.disable_page(1); - } - else - { - tipo_stampa = m.get_int(F_STAMPA1); - m.enable_page(1); - } + const int tipo_stampa = m.get_int(F_STAMPA); + const TDate datalim = m.get_date(F_DATALIM); + TDate data; - if (tipo_stampa == 2) //all'ultima immissione - { - m.hide(F_DATADA); - m.hide(F_DATAA); - //m.hide(F_STAMPAMPROV); - m.hide(98); - m.hide(99); - m.hide(96); - m.hide(97); - - // Disabilito le commesse nelle stampe all'ultima immissione - m.hide(-4); - m.reset(-4); - } - else - { - if (bilancio == 2) - if (anno != 0) - { - m.show(F_DATADA); - m.show(F_DATAA); - //m.show(F_STAMPAMPROV); - m.show(96); - m.show(97); - m.hide(98); - m.hide(99); - } - else - { - m.show(F_DATADA); - m.show(F_DATAA); - //m.show(F_STAMPAMPROV); - m.show(98); - m.show(99); - m.hide(96); - m.hide(97); - } - - // Abilito eventualmente le commesse - if (main_app().has_module(CMAUT)) - m.show(-4); - else - { - m.hide(-4); - m.reset(-4); - } - } - - tipo_bil = f.mask().get_int(F_BILANCIO); - if (tipo_bil == 1) - tipo_stp = f.mask().get_int(F_STAMPA); - else - tipo_stp = f.mask().get_int(F_STAMPA1); - if (tipo_bil == 2 && tipo_stp == 1 /* && f.mask().get_int(F_ANNO) == 0 */) - f.mask().show(F_QUADRATURA); - else - { - f.mask().set (F_QUADRATURA,""); - f.mask().hide(F_QUADRATURA); - } - } - return TRUE; + m.enable_page(1, bilancio != 1); + if (esercizi().exist(datalim)) + data = esercizio(datalim).fine(); + m.show(F_DATAINI, bilancio == 2 && tipo_stampa == 1); + m.show(F_QUADRATURA, bilancio == 2 && tipo_stampa == 1 && data == datalim); + } + return true; } bool TStampa_bilanci::mask_datalim (TMask_field& f, KEY k) -{ +{ if (k == K_ENTER) { - int anno = f.mask().get_int(F_ANNO); - int bilancio = f.mask().get_int(F_BILANCIO); - TDate datalim(f.mask().get(F_DATALIM)); - if (bilancio == 1) - if (anno != 0) - { - if ( datalim.ok() ) - { - if (!IsEsercizio(datalim,anno)) - { - f.error_box (TR("La data limite deve appartenere all'esercizio indicato")); - return FALSE; - } - } - else - f.mask().field(F_DATALIM).set(FineEsercizio(anno)); - } - else //anno == 0 + TMask& m = f.mask(); + const int anno = m.get_int(F_ANNO); + const int bilancio = m.get_int(F_BILANCIO); + const TDate data = m.get_date(F_DATALIM); + + if (anno != 0) + { + if (data.ok()) { - if (!datalim.ok()) - { - f.error_box (TR("La data limite e' obbligatoria")); - return FALSE; - } - long anno = app().date2esc(datalim); - if (anno == 0) - { - f.error_box (TR("La data limite deve appartenere ad un esercizio attivo della ditta")); - return FALSE; - } + if (!esercizi().exist(data) || (esercizio(data).codice() != anno)) + return f.error_box (TR("La data limite deve appartenere all'esercizio indicato")); } + else + m.field(F_DATALIM).set(esercizio(anno).fine()); + app()._annoapp = anno; + } + else //anno == 0 + { + if (!data.ok()) + return f.error_box (TR("La data limite e' obbligatoria")); + if (!esercizi().exist(data)) + return f.error_box (TR("La data limite deve appartenere ad un esercizio attivo della ditta")); + } + if (m.get_date(F_DATALIM) < m.get_date(F_DATAINI)) + return f.error_box(TR("La data limite deve essere maggiore o uguale alla data iniziale")); } - return TRUE; + return true; } -bool TStampa_bilanci::mask_date(TMask_field& f, KEY k) +bool TStampa_bilanci::mask_dataini(TMask_field& f, KEY k) { - if (k == K_TAB) - { - const short id = f.dlg(); + TMask& m = f.mask(); + const short id = f.dlg(); - if (id == F_DATAA) - { - TDate data (f.get()); - int bil = f.mask().get_int(F_BILANCIO); - TEsercizi_contabili esc; - int anno = esc.date2esc(data); - if (anno) - { - TDate dataini = esc[anno].fine(); - if (data == dataini && bil == 2 /*&& f.mask().get_int(F_ANNO) == 0*/) - f.mask().show(F_QUADRATURA); - else - { - f.mask().reset(F_QUADRATURA); - f.mask().hide(F_QUADRATURA); - } - } - } - } - - if (k == K_ENTER) - { - const short id = f.dlg(); - int anno = f.mask().get_int(F_ANNO); - int bilancio = f.mask().get_int(F_BILANCIO); - if (bilancio == 2) - { - TDate data (f.mask().get(id)); - if (anno != 0) - { - if (data.ok()) - { - if (!IsEsercizio(data,anno)) - { - f.error_box(TR("La data indicata deve essere all'interno dell'esercizio")); - return FALSE; - } - } - if (!data.ok()) - { - if (id == F_DATADA) - f.mask().field(F_DATADA).set(InizioEsercizio(anno)); - else if (id == F_DATAA) - f.mask().field(F_DATAA).set(FineEsercizio(anno)); - } - app()._annoapp = anno; - } - else - { - if ( !data.ok() ) - { - f.error_box(TR("Indicare una data appartenente ad un esercizio attivo della ditta")); - return FALSE; - } - else - { - if (id == F_DATAA) - { - TDate from (f.mask().get(id - 1)); - app()._annoapp = app().date2esc(from); - if ( app()._annoapp != app().date2esc(data) ) - { - f.error_box(TR("Le date devono appartenere ad uno stesso esercizio attivo della ditta")); - return FALSE; - } - if (from > data) - { - f.error_box(TR("La data limite inferiore non puo' essere maggiore della data limite superiore")); - return FALSE; - } - } - } - } - } + if (k == K_ENTER) + { + const int anno = m.get_int(F_ANNO); + int bilancio = m.get_int(F_BILANCIO); + TDate data = f.get_date(); + + if (anno != 0) + { + if (data.ok()) + { + if (!esercizi().exist(data) || (esercizio(data).codice() != anno)) + return f.error_box(TR("La data iniziale deve appartenere all'esercizio indicato")); + } + else + m.field(F_DATALIM).set(esercizio(anno).inizio()); + app()._annoapp = anno; + } + else //anno == 0 + { + const TDate datalim = m.get_date(F_DATALIM); + + if (!data.ok() && datalim.ok() && esercizi().exist(datalim)) + m.field(F_DATAINI).set(data = esercizio(datalim).inizio()); + if (!data.ok()) + return f.error_box(TR("La data limite e' obbligatoria")); + if (!esercizi().exist(data)) + return f.error_box(TR("La data limite deve appartenere ad un esercizio attivo della ditta")); + app()._annoapp = esercizio(data).codice(); + } } - return TRUE; + return true; } bool TStampa_bilanci::verifica_handler(TMask_field& f, KEY k) { if (k == K_SPACE) { - int tipo_stampa = atoi(f.mask().get(F_STAMPA1)); - int verifica = atoi(f.mask().get(F_VERIFICA)); - if ( (tipo_stampa == 1) && ((verifica == 1) || (verifica == 2)) ) - { - f.mask().hide (F_SITUAZIONE); - f.mask().hide (F_STAMPAC); - f.mask().hide (F_ORDINAMENTO); - f.mask().show (F_STAMPAV); - f.mask().show (F_DATADA); - f.mask().show (F_DATAA); - } - if ( (tipo_stampa == 1) && (verifica == 3) ) - { - f.mask().show (F_SITUAZIONE); - f.mask().show (F_STAMPAC); - f.mask().show (F_ORDINAMENTO); - f.mask().show (F_DATADA); - f.mask().show (F_DATAA); - f.mask().hide (F_STAMPAV); - } - if ( (tipo_stampa == 2) && ((verifica == 1)||(verifica == 2)) ) - { - f.mask().hide (F_SITUAZIONE); - f.mask().hide (F_STAMPAC); - f.mask().hide (F_ORDINAMENTO); - f.mask().hide (F_DATADA); - f.mask().hide (F_DATAA); - f.mask().show (F_STAMPAV); - } - if ( (tipo_stampa == 2) && (verifica == 3) ) - { - f.mask().show (F_SITUAZIONE); - f.mask().show (F_STAMPAC); - f.mask().show (F_ORDINAMENTO); - f.mask().hide (F_DATADA); - f.mask().hide (F_DATAA); - f.mask().hide (F_STAMPAV); - } + TMask& m = f.mask(); + const int verifica = m.get_int(F_VERIFICA); + + m.show(F_SITUAZIONE, verifica == 3); + m.show(F_STAMPAC, verifica == 3); + m.show(F_ORDINAMENTO, verifica == 3); + m.show(F_STAMPAV, verifica != 3); } - return TRUE; + return true; } void TStampa_bilanci::scrivig_file_temp() @@ -580,7 +350,7 @@ void TStampa_bilanci::scrivig_file_temp() tmp->put(SLD_CONTO,0); tmp->put(SLD_SOTTOCONTO,0L); tmp->put(SLD_ANNOES,0); // W96SALDI del 07-06-96 - tmp->put(SLD_FLSCA,FALSE); + tmp->put(SLD_FLSCA,false); if (tmp->read() == NOERR) { tmp->put(SLD_CONTO,0); @@ -594,7 +364,7 @@ void TStampa_bilanci::scrivig_file_temp() tmp->put(SLD_CONTO,0); tmp->put(SLD_SOTTOCONTO,0L); tmp->put(SLD_ANNOES,0); // W96SALDI del 07-06-96 - tmp->put(SLD_FLSCA,FALSE); + tmp->put(SLD_FLSCA,false); tmp->put(nome_campo, valore); tmp->write(); } @@ -626,7 +396,7 @@ void TStampa_bilanci::scrivig_file_temp() tmp->put(SLD_CONTO,0); tmp->put(SLD_SOTTOCONTO,0L); tmp->put(SLD_ANNOES,0); // W96SALDI del 07-06-96 - tmp->put(SLD_FLSCA,FALSE); + tmp->put(SLD_FLSCA,false); if (tmp->read() == NOERR) { tmp->put(SLD_CONTO,0); @@ -640,13 +410,13 @@ void TStampa_bilanci::scrivig_file_temp() tmp->put(SLD_CONTO,0); tmp->put(SLD_SOTTOCONTO,0L); tmp->put(SLD_ANNOES,0); // W96SALDI del 07-06-96 - tmp->put(SLD_FLSCA,FALSE); + tmp->put(SLD_FLSCA,false); tmp->put(nome_campo, valore); tmp->write(); } } } - _add_dare = _add_avere = FALSE; + _add_dare = _add_avere = false; } void TStampa_bilanci::scrivic_file_temp() @@ -657,7 +427,7 @@ void TStampa_bilanci::scrivic_file_temp() if (_add_file_dare) { - _add_dare = TRUE; + _add_dare = true; nome_campo = SLD_PDARE; valore = _conto_da; if (_indbil == 1 || _indbil==2) tmp = _tmp_saldi_att; // da stampare a sx @@ -675,7 +445,7 @@ void TStampa_bilanci::scrivic_file_temp() } if (_add_file_avere) { - _add_avere = TRUE; + _add_avere = true; nome_campo = SLD_PAVERE; valore = _conto_a; if (_indbil==2 || _indbil==1) tmp = _tmp_saldi_pass; //da stampare a dx @@ -820,24 +590,18 @@ bool TStampa_bilanci::bil_sez_contr() long s; char tipo_conto = ' '; real saldo; - bool compensa=FALSE, dettaglio=FALSE, cambiato=FALSE; - bool esiste_conto=FALSE, esiste_sc = FALSE; - bool movimentato = FALSE; + bool compensa = false, dettaglio = false, cambiato = false; + bool esiste_conto = false, esiste_sc = false; + bool movimentato = false; + TProgress_monitor p(_pcn->eod(), TR("Elaborazione conti")); CHECK(_tmp_saldi_att == NULL, "Non posso riaprire cg01"); - _tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", TRUE, TRUE); - _prog->addstatus(1); - _tmp_saldi_pass = new TIsamtempfile(LF_SALDI, "cg02", TRUE, TRUE); - _prog->addstatus(1); - _tmp_saldi_costi = new TIsamtempfile(LF_SALDI, "cg03", TRUE, TRUE); - _prog->addstatus(1); - _tmp_saldi_ricavi = new TIsamtempfile(LF_SALDI, "cg04", TRUE, TRUE); - _prog->addstatus(1); - _tmp_saldi_conti_uno = new TIsamtempfile(LF_SALDI, "cg05", TRUE, TRUE); - _prog->addstatus(1); - _tmp_saldi_conti_due = new TIsamtempfile(LF_SALDI, "cg06", TRUE, TRUE); - _prog->addstatus(1); - + _tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", true, true); + _tmp_saldi_pass = new TIsamtempfile(LF_SALDI, "cg02", true, true); + _tmp_saldi_costi = new TIsamtempfile(LF_SALDI, "cg03", true, true); + _tmp_saldi_ricavi = new TIsamtempfile(LF_SALDI, "cg04", true, true); + _tmp_saldi_conti_uno = new TIsamtempfile(LF_SALDI, "cg05", true, true); + _tmp_saldi_conti_due = new TIsamtempfile(LF_SALDI, "cg06", true, true); _gp=-1; _cp=-1; _gruppo_a = ZERO; @@ -850,22 +614,18 @@ bool TStampa_bilanci::bil_sez_contr() _prg_iniavere_ord = ZERO; _conto_a = ZERO; _conto_da = ZERO; - _add_dare = FALSE; - _add_avere = FALSE; + _add_dare = false; + _add_avere = false; sld.set_annoes(_annoes); - - for (_pcn->first(); !_pcn->eof(); _pcn->next()) + for (_pcn->first(); !_pcn->eof() && p.addstatus(1L); _pcn->next()) { - _prog->addstatus(1); - - g = _pcn->get_int (PCN_GRUPPO); c = _pcn->get_int (PCN_CONTO); s = _pcn->get_long(PCN_SOTTOCONTO); if (c != _cp) - cambiato = TRUE; + cambiato = true; if ( (((_cp != -1) && (c != _cp)) || ((_gp != -1) && (g != _gp))) && esiste_sc ) @@ -873,7 +633,7 @@ bool TStampa_bilanci::bil_sez_contr() scrivic_file_temp(); scrivig_file_temp(); _cp = c; - esiste_conto = TRUE; + esiste_conto = true; _conto_da = ZERO; _conto_a = ZERO; } @@ -881,7 +641,7 @@ bool TStampa_bilanci::bil_sez_contr() if ( ((_gp != -1) && (g != _gp)) && esiste_conto ) { scrivig_file_temp(); - esiste_conto = FALSE; + esiste_conto = false; _gp = g; _gruppo_da = ZERO; _gruppo_a = ZERO; @@ -891,9 +651,9 @@ bool TStampa_bilanci::bil_sez_contr() if (cambiato) { - _add_file_avere = FALSE; - _add_file_dare = FALSE; - cambiato = FALSE; + _add_file_avere = false; + _add_file_dare = false; + cambiato = false; } if ( (s == 0) && (c != 0) ) //si tratta di un conto @@ -928,8 +688,9 @@ bool TStampa_bilanci::bil_sez_contr() scrivic_file_temp(); scrivig_file_temp(); } - else if (esiste_conto) - scrivig_file_temp(); + else + if (esiste_conto) + scrivig_file_temp(); } _pcn->readat(recnum); @@ -939,16 +700,16 @@ bool TStampa_bilanci::bil_sez_contr() if ( (c == 0) || (s == 0) ) //si tratta di un conto o di un gruppo { - esiste_sc = FALSE; + esiste_sc = false; continue; } if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite { #ifdef CONT_SEP - movimentato = sld.saldo_cont_sep(g, c, s, _annoes, _datalim, indbil_conto, _cont_sep, _stampa_mov_prov) ; + movimentato = sld.saldo_cont_sep(_tipo_data,g, c, s, _annoes, _datalim, indbil_conto, _cont_sep, _stampa_mov_prov) ; #else - movimentato = sld.data_limite_bilancio(_bilancio, g, c, s, _dataini, _datalim, indbil_conto, _stampa_mov_prov); + movimentato = sld.data_limite_bilancio(_tipo_data, g, c, s, _dataini, _al, indbil_conto, _stampa_mov_prov); #endif } else @@ -965,7 +726,8 @@ bool TStampa_bilanci::bil_sez_contr() } saldo = sld.saldo(); - real app = sld.saldoini(); + + real app = sld.saldoini(); bool flag = sld.flagprec(); if (_saldo) //se richiesto di NON stampare i conti con saldo a zero @@ -974,8 +736,6 @@ bool TStampa_bilanci::bil_sez_contr() //modifica del 06/07/1995 if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) { - //real app = sld.saldoini(); - //bool flag = sld.flagprec(); if (flag) { if (app > ZERO) @@ -984,13 +744,14 @@ bool TStampa_bilanci::bil_sez_contr() _prg_inidare_ord += app; else _prg_saldoini_dare += app; } - else if (app < ZERO) - { - app = -app; - if (indbil_conto == 5) - _prg_iniavere_ord += app; - else _prg_saldoini_avere += app; - } + else + if (app < ZERO) + { + app = -app; + if (indbil_conto == 5) + _prg_iniavere_ord += app; + else _prg_saldoini_avere += app; + } } } //fine @@ -998,12 +759,12 @@ bool TStampa_bilanci::bil_sez_contr() continue; } - esiste_sc = TRUE; + esiste_sc = true; _indbil = indbil_conto; //i due flag seguenti servono solo per i conti d'ordine - _sottoc_dare = FALSE; - _sottoc_avere = FALSE; + _sottoc_dare = false; + _sottoc_avere = false; if (saldo != ZERO) saldo = compensazione(compensa, indbil_conto, saldo); @@ -1014,26 +775,27 @@ bool TStampa_bilanci::bil_sez_contr() { if (app > ZERO) _prg_saldoini_dare += app; - else if (app < ZERO) - { - app = -app; - _prg_saldoini_avere += app; - } + else + if (app < ZERO) + { + app = -app; + _prg_saldoini_avere += app; + } } } if (_indbil == 5) { - //real app = sld.saldoini(); if (flag) { if (app > ZERO) _prg_inidare_ord += app; - else if (app < ZERO) - { - app = -app; - _prg_iniavere_ord += app; - } + else + if (app < ZERO) + { + app = -app; + _prg_iniavere_ord += app; + } } } @@ -1041,14 +803,14 @@ bool TStampa_bilanci::bil_sez_contr() { _gruppo_da += saldo; _conto_da += saldo; - _add_file_dare = TRUE; + _add_file_dare = true; } if ( _indbil==2 || _indbil==4 ) { _gruppo_a += saldo; _conto_a += saldo; - _add_file_avere = TRUE; + _add_file_avere = true; } if (_indbil==5) @@ -1057,16 +819,16 @@ bool TStampa_bilanci::bil_sez_contr() { _gruppo_da_ordine += saldo; _conto_da += saldo; - _add_file_dare = TRUE; - _sottoc_dare = TRUE; + _add_file_dare = true; + _sottoc_dare = true; } else { saldo = -saldo; _gruppo_a_ordine += saldo; _conto_a += saldo; - _add_file_avere = TRUE; - _sottoc_avere = TRUE; + _add_file_avere = true; + _sottoc_avere = true; } scrivig_file_temp(); } @@ -1087,7 +849,7 @@ bool TStampa_bilanci::bil_sez_contr() _pcn->readat(recnum); } - return TRUE; + return true; } bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbil_conto,real& saldo) @@ -1095,8 +857,8 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi TSaldo sld; int aep=0; long s, items; - bool esiste_sc = FALSE; - bool movimentato = FALSE; + bool esiste_sc = false; + bool movimentato = false; if (_annoes) { @@ -1119,9 +881,9 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite { #ifdef CONT_SEP - movimentato = sld.saldo_cont_sep(g, c, s, _annoes, _datalim, indbil_conto, _cont_sep, _stampa_mov_prov); + movimentato = sld.saldo_cont_sep(_tipo_data, g, c, s, _annoes, _datalim, indbil_conto, _cont_sep, _stampa_mov_prov); #else - movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov); + movimentato = sld.data_limite_bilancio(_tipo_data ,g,c,s,_dataini,_al,indbil_conto,_stampa_mov_prov); #endif } else @@ -1142,7 +904,6 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi //modifica del 06/07/1995 if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) { - //real app = sld.saldoini(); if (flag) { if (app > ZERO) @@ -1151,25 +912,26 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi _prg_inidare_ord += app; else _prg_saldoini_dare += app; } - else if (app < ZERO) - { - app = -app; - if (indbil_conto == 5) - _prg_iniavere_ord += app; - else _prg_saldoini_avere += app; - } + else + if (app < ZERO) + { + app = -app; + if (indbil_conto == 5) + _prg_iniavere_ord += app; + else _prg_saldoini_avere += app; + } } } //fine continue; } - esiste_sc = TRUE; + esiste_sc = true; _indbil = indbil_conto; //i due flag seguenti servono solo per i conti d'ordine - _sottoc_dare = FALSE; - _sottoc_avere = FALSE; + _sottoc_dare = false; + _sottoc_avere = false; if (saldo != ZERO) saldo = compensazione(compensa, indbil_conto, saldo); @@ -1180,26 +942,27 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi { if (app > ZERO) _prg_saldoini_dare += app; - else if (app < ZERO) - { - app = -app; - _prg_saldoini_avere += app; - } + else + if (app < ZERO) + { + app = -app; + _prg_saldoini_avere += app; + } } } if (_indbil == 5) { - //real app = sld.saldoini(); if (flag) { if (app > ZERO) _prg_inidare_ord += app; - else if (app < ZERO) - { - app = -app; - _prg_iniavere_ord += app; - } + else + if (app < ZERO) + { + app = -app; + _prg_iniavere_ord += app; + } } } @@ -1207,14 +970,14 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi { _gruppo_da += saldo; _conto_da += saldo; - _add_file_dare = TRUE; + _add_file_dare = true; } if ( (_indbil==2) || (_indbil==4) ) { _gruppo_a += saldo; _conto_a += saldo; - _add_file_avere = TRUE; + _add_file_avere = true; } if (_indbil==5) @@ -1223,16 +986,16 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi { _gruppo_da_ordine += saldo; _conto_da += saldo; - _add_file_dare = TRUE; - _sottoc_dare = TRUE; + _add_file_dare = true; + _sottoc_dare = true; } else //il sottoconto ha saldo in avere { saldo = -saldo; _gruppo_a_ordine += saldo; _conto_a += saldo; - _add_file_avere = TRUE; - _sottoc_avere = TRUE; + _add_file_avere = true; + _sottoc_avere = true; } scrivig_file_temp(); } @@ -1250,10 +1013,11 @@ bool TStampa_bilanci::bil_verifica() real saldo_finale, saldo_conto, saldo_gruppo, saldo_iniziale; real mov_conto_dare, mov_conto_avere, prg_conto_dare, prg_conto_avere; real mov_gruppo_dare, mov_gruppo_avere, prg_gruppo_dare, prg_gruppo_avere; - bool esiste_conto = FALSE, esiste_sc = FALSE, movimentato = FALSE; - + bool esiste_conto = false, esiste_sc = false, movimentato = false; + TProgress_monitor p(_pcn->eod(), "Elaborazione saldi"); + CHECK(_tmp_saldi_att == NULL, "Non posso riaprire cg01"); - _tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", TRUE, TRUE); + _tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", true, true); _gp=-1; _cp=-1; @@ -1300,9 +1064,8 @@ bool TStampa_bilanci::bil_verifica() else _pcn->first(); //..se non e' stato selezionato nessun gruppo parto dal primo - for ( ; !_pcn->eof(); _pcn->next()) + for ( ; !_pcn->eof() && p.addstatus(1L); _pcn->next()) { - _prog->addstatus(1); g = _pcn->get_int (PCN_GRUPPO); c = _pcn->get_int (PCN_CONTO); s = _pcn->get_long(PCN_SOTTOCONTO); @@ -1313,7 +1076,7 @@ bool TStampa_bilanci::bil_verifica() if (!((_stampav == 2) && (saldo_conto == 0))) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _saldo_ini_gruppo_dare += _saldo_ini_conto_dare; _saldo_ini_gruppo_avere += _saldo_ini_conto_avere; @@ -1322,7 +1085,8 @@ bool TStampa_bilanci::bil_verifica() //fine { const real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; - if (app < ZERO) + + if (app < ZERO) _saldo_ini_gruppo_avere += app; else _saldo_ini_gruppo_dare += app; @@ -1339,7 +1103,7 @@ bool TStampa_bilanci::bil_verifica() { scrivi_record_conto(prg_conto_dare,prg_conto_avere,mov_conto_dare, mov_conto_avere,saldo_conto); - esiste_conto = TRUE; + esiste_conto = true; } _cp = c; _saldo_ini_conto_dare = ZERO; @@ -1369,7 +1133,7 @@ bool TStampa_bilanci::bil_verifica() scrivi_record_gruppo(prg_gruppo_dare,prg_gruppo_avere,mov_gruppo_dare, mov_gruppo_avere,saldo_gruppo); _gp = g; - esiste_conto = FALSE; + esiste_conto = false; _saldo_ini_gruppo_dare = ZERO; _saldo_ini_gruppo_avere = ZERO; saldo_gruppo = ZERO; @@ -1400,7 +1164,7 @@ bool TStampa_bilanci::bil_verifica() if (_verifica == 2) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _saldo_ini_gruppo_dare += _saldo_ini_conto_dare; _saldo_ini_gruppo_avere += _saldo_ini_conto_avere; @@ -1409,7 +1173,8 @@ bool TStampa_bilanci::bil_verifica() //fine { real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; - if (app < ZERO) + + if (app < ZERO) _saldo_ini_gruppo_avere += app; else _saldo_ini_gruppo_dare += app; @@ -1439,16 +1204,16 @@ bool TStampa_bilanci::bil_verifica() if ( (c == 0) || (s == 0) ) { - esiste_sc = FALSE; + esiste_sc = false; continue; } saldo_finale = saldo_iniziale = ZERO; //saldi relativi a ciascun sottoconto _indbil = indbil_conto; - if (_tipo_stampa1 == 1) //bil. di verifica per data limite + if (_tipo_stampa == 1) //bil. di verifica per data limite { //modifica del 21/11/95 - _mov_ap = FALSE; + _mov_ap = false; //modifica del 19/06/95 movimentato = calcola(g,c,s); if (_stampa_mov_prov & 0x1) @@ -1463,14 +1228,15 @@ bool TStampa_bilanci::bil_verifica() TLocalisamfile saldi(LF_SALDI); // W96SALDI saldi.zero(); // Modifica SALDI per movimenti saldi.put(SLD_ANNOES, _annoes); // scaricati del 05-06-96 - saldi.put(SLD_FLSCA, FALSE); // Ho aggiunto saldi.put(SLD_FLSCA, FALSE); + saldi.put(SLD_FLSCA, false); // Ho aggiunto saldi.put(SLD_FLSCA, false); saldi.put(SLD_GRUPPO, g); // In questo modo considero il record con saldi.put(SLD_CONTO, c); // la somma fra progressivi normali e scaricati saldi.put(SLD_SOTTOCONTO, s); if (saldi.read() == NOERR) { const real ss = saldi.get_real(SLD_SALDO); - if (ss.is_zero()) + + if (ss.is_zero()) { if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)) { @@ -1500,7 +1266,7 @@ bool TStampa_bilanci::bil_verifica() } } } - else // !movimentato -> _mov_ap e' di sicuro FALSE + else // !movimentato -> _mov_ap e' di sicuro false { if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)) { @@ -1511,7 +1277,7 @@ bool TStampa_bilanci::bil_verifica() else _saldo_ini_avere = -saldo_iniziale; //fine if (_stampav == 1 && sld.significativo()) - movimentato = TRUE; + movimentato = true; } } } @@ -1525,19 +1291,17 @@ bool TStampa_bilanci::bil_verifica() _nuovo_tot_saldo_d += _saldo_ini_dare; _nuovo_tot_saldo_a += _saldo_ini_avere; - if (_datada == _dataini) + if (_dal == _dataini) saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; - else if (_datada > _dataini) - { - if (saldo_iniziale > 0) - _prg_prec_dare += saldo_iniziale; - else _prg_prec_avere -= saldo_iniziale; - saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare-_mov_periodo_avere; - - } - //if (saldo_finale == ZERO) - // if (_stampav == 2) - // continue; + else + if (_dal > _dataini) + { + if (saldo_iniziale > 0) + _prg_prec_dare += saldo_iniziale; + else + _prg_prec_avere -= saldo_iniziale; + saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare-_mov_periodo_avere; + } } //se saldo_finale < 0 verra' stampato con una A, se no con una D } @@ -1553,9 +1317,9 @@ bool TStampa_bilanci::bil_verifica() { if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) { - saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s,FALSE,_stampa_mov_prov); + saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s,false,_stampa_mov_prov); if (_stampav == 1 && sld.significativo()) - movimentato = TRUE; + movimentato = true; } } } @@ -1578,15 +1342,17 @@ bool TStampa_bilanci::bil_verifica() if ((movimentato || _stampav != 1) && !(saldo_finale.is_zero() && _stampav == 2)) { - esiste_sc = TRUE; - esiste_conto = TRUE; + esiste_sc = true; + esiste_conto = true; - if (_tipo_stampa1 == 2) + if (_tipo_stampa == 2) { _nuovo_tot_saldo_d += _mov_periodo_dare; _nuovo_tot_saldo_a += _mov_periodo_avere; - real nuovo = sld.saldoinisusaldi(); - if (nuovo > ZERO) + + real nuovo = sld.saldoinisusaldi(); + + if (nuovo > ZERO) _nuovo_tot_saldo_d += nuovo; else { @@ -1595,7 +1361,7 @@ bool TStampa_bilanci::bil_verifica() } } //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _saldo_ini_conto_dare += _saldo_ini_dare; _saldo_ini_conto_avere += _saldo_ini_avere; @@ -1623,10 +1389,10 @@ bool TStampa_bilanci::bil_verifica() _tmp_saldi_att->put(SLD_SOTTOCONTO,s); _tmp_saldi_att->put(SLD_FLAGSALINI,tipo_conto); - if ( (_datada == _dataini) || (_tipo_stampa1 != 1) ) + if ((_dal == _dataini) || (_tipo_stampa != 1)) { //modifica del 21/11/1995 - if (_datada == _dataini && _tipo_stampa1 == 1) + if (_dal == _dataini && _tipo_stampa == 1) { _tmp_saldi_att->put(SLD_PDAREPRO,_saldo_ini_dare); // W96SALDI del 05-06-96 _tmp_saldi_att->put(SLD_PAVEREPRO,_saldo_ini_avere); @@ -1635,18 +1401,20 @@ bool TStampa_bilanci::bil_verifica() { if (saldo_iniziale > ZERO) //va stampato in Dare _tmp_saldi_att->put(SLD_PDAREPRO,saldo_iniziale); // W96SALDI del 05-06-96 - else if (saldo_iniziale < ZERO) - { - saldo_iniziale = -saldo_iniziale; - _tmp_saldi_att->put(SLD_PAVEREPRO,saldo_iniziale); // W96SALDI del 05-06-96 - } + else + if (saldo_iniziale < ZERO) + { + saldo_iniziale = -saldo_iniziale; + _tmp_saldi_att->put(SLD_PAVEREPRO,saldo_iniziale); // W96SALDI del 05-06-96 + } } } - else if (_datada > _dataini) - { - _tmp_saldi_att->put(SLD_PDAREPRO,_prg_prec_dare); // W96SALDI del 05-06-96 - _tmp_saldi_att->put(SLD_PAVEREPRO,_prg_prec_avere); - } + else + if (_dal > _dataini) + { + _tmp_saldi_att->put(SLD_PDAREPRO,_prg_prec_dare); // W96SALDI del 05-06-96 + _tmp_saldi_att->put(SLD_PAVEREPRO,_prg_prec_avere); + } _tmp_saldi_att->put(SLD_PDARE,_mov_periodo_dare); _tmp_saldi_att->put(SLD_PAVERE,_mov_periodo_avere); _tmp_saldi_att->put(SLD_SALDO,saldo_finale); @@ -1664,7 +1432,7 @@ bool TStampa_bilanci::bil_verifica() if ( (_verifica == 2) && esiste_conto ) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _saldo_ini_gruppo_dare += _saldo_ini_conto_dare; _saldo_ini_gruppo_avere += _saldo_ini_conto_avere; @@ -1673,7 +1441,8 @@ bool TStampa_bilanci::bil_verifica() //fine { real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; - if (app < ZERO) + + if (app < ZERO) _saldo_ini_gruppo_avere += app; else _saldo_ini_gruppo_dare += app; @@ -1695,7 +1464,7 @@ bool TStampa_bilanci::bil_verifica() } _pcn->readat(recnum); } -return TRUE; +return true; } // bilancio di verifica per data limite @@ -1703,17 +1472,8 @@ return TRUE; bool TStampa_bilanci::calcola(int g, int c, long s) { int annoe; - long num_reg; - TDate data_reg, data; - bool conto_mov = FALSE; - + bool conto_mov = false; TDecoder causali(LF_CAUSALI, CAU_MOVAP); - - TRelation rel(LF_RMOV); - rel.add(LF_MOV, "NUMREG==NUMREG"); - - TRectype& rmov = rel.curr(); - const TRectype& mov = rel.curr(LF_MOV); _mov_periodo_dare = ZERO; _mov_periodo_avere = ZERO; @@ -1723,37 +1483,39 @@ bool TStampa_bilanci::calcola(int g, int c, long s) _saldo_ini_avere = ZERO; _u_max = 0l; - TDate data_start = _dataini; +// TDate data_start = _dataini; // Calcolo progressivi precedenti: // e non è indicato l'anno esercizio, prende il primo giorno dell'anno indicato da _datada - if (_annoes == 0) + if (_annoes == 0 && !_dataini.ok()) { - data_start = _datada; - data_start.set_day(1); - data_start.set_month(1); + _dataini = _dal; + _dataini.set_day(1); + _dataini.set_month(1); } - - rmov.zero(); - rmov.put(RMV_GRUPPO,g); - if (c != 0) - { - rmov.put(RMV_CONTO,c); - if (s != 0) - rmov.put(RMV_SOTTOCONTO,s); - } - - TCursor cur(&rel, "", 2, &rmov, &rmov); + + TCursor cur(new TRelation(LF_RMOV), "", 2); + TRectype& rmov = cur.file().curr(); + + rmov.zero(); + rmov.put(RMV_GRUPPO, g); + if (c != 0) + { + rmov.put(RMV_CONTO, c); + if (s != 0) + rmov.put(RMV_SOTTOCONTO, s); + } + cur.setregion(rmov, rmov); + const long items = cur.items(); + cur.freeze(); - for (cur = 0L; cur.pos() < items; ++cur) { annoe = rmov.get_int(RMV_ANNOES); - data = rmov.get_date(RMV_DATAREG); - num_reg = rmov.get_long(RMV_NUMREG); - + const long numreg = rmov.get_long(RMV_NUMREG); + const TRectype& mov = cache().get(LF_MOV, numreg); + const TDate data = get_date_mov(mov, _tipo_data); const TString4 provvis = mov.get(MOV_PROVVIS); - const TDate datacomp = mov.get_date(MOV_DATACOMP); const TString& codcaus = mov.get(MOV_CODCAUS); const char causap = causali.decode(codcaus)[0]; @@ -1768,20 +1530,14 @@ bool TStampa_bilanci::calcola(int g, int c, long s) const char sezione = rmov.get_char(RMV_SEZIONE); const real importo = rmov.get_real(RMV_IMPORTO); - if (_annoes == 0) - data_reg = data; - else - data_reg = datacomp; - if (importo.is_zero()) continue; //calcolo i movimenti del periodo - if ( data_reg >= _datada && data_reg <= _dataa) - if ((causap == 'A' && _dataini.ok() && _dataini != _datada) || (causap != 'A')) - if (((_stampa_mov_prov & 0x1) && provvis.blank()) || - ((_stampa_mov_prov & 0x2) && ((provvis == "P") || (provvis == "N"))) || - ((_stampa_mov_prov & 0x4) && (provvis == "B")) || ((_stampa_mov_prov & 0x8) && (provvis == "C"))) + if ( data >= _dal && data <= _al) + if ((causap == 'A' && _dataini.ok() && _dataini != _dal) || + (causap != 'A')) + if (check_mov(_stampa_mov_prov, provvis)) { conto_mov = true; if (sezione == 'D') @@ -1794,11 +1550,11 @@ bool TStampa_bilanci::calcola(int g, int c, long s) } //il saldo inizio es. e' dato dall'importo dare - importo avere di quei movimenti che hanno causale == apertura e data reg >= data inizio es. e <= data limite sup. - if (_datada == _dataini) //calcolo il saldo iniziale + if (_dal == _dataini) //calcolo il saldo iniziale { if ((_stampa_mov_prov & 0x1) && (causap == 'A')) { - if ( (data_reg >= _dataini) && (data_reg <= _dataa) ) + if ( (data >= _dataini) && (data <= _al) ) { if (sezione == 'D') _saldo_ini_dare += importo; @@ -1809,11 +1565,9 @@ bool TStampa_bilanci::calcola(int g, int c, long s) } } } - else if (_datada > _dataini) //calcolo i progressivi precedenti - if ( (data_reg >= data_start) && (data_reg < _datada) ) - if (((_stampa_mov_prov & 0x1) && provvis.blank()) || - ((_stampa_mov_prov & 0x2) && ((provvis == "P") || (provvis == "N"))) || - ((_stampa_mov_prov & 0x4) && (provvis == "B")) || ((_stampa_mov_prov & 0x8) && (provvis == "C"))) + else + if ( (data >= _dataini) && (data < _dal) ) //calcolo i progressivi precedenti + if (check_mov(_stampa_mov_prov, provvis)) { if (sezione == 'D') _prg_prec_dare += importo; @@ -1832,8 +1586,8 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin real& mov_conto_dare,real& mov_conto_avere,real& prg_conto_dare,real& prg_conto_avere,real& saldo_conto) { TSaldo sld; - bool esiste_sc = FALSE; - const int anno = _tipo_stampa1 == 1 ? _annoapp : _annoes; + bool esiste_sc = false; + const int anno = _tipo_stampa == 1 ? _annoapp : _annoes; _lista = new TSaldi_list(g, c, anno); const TRecnotype items = _lista->items(); @@ -1847,7 +1601,7 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin saldo_finale = saldo_iniziale = ZERO; //saldi relativi a ciascun sottoconto - if (_tipo_stampa1 == 1) //bil. di verifica per data limite + if (_tipo_stampa == 1) //bil. di verifica per data limite { //modifica del 21/11/1995 _mov_ap = false; @@ -1867,8 +1621,8 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin TLocalisamfile saldi(LF_SALDI); saldi.zero(); saldi.put(SLD_ANNOES,_annoes); - saldi.put(SLD_FLSCA, FALSE); // W96SALDI del 05-06-96 - saldi.put(SLD_GRUPPO,g); // Ho aggiunto in chiave saldi.put(SLD_FLSCA, FALSE); + saldi.put(SLD_FLSCA, false); // W96SALDI del 05-06-96 + saldi.put(SLD_GRUPPO,g); // Ho aggiunto in chiave saldi.put(SLD_FLSCA, false); saldi.put(SLD_CONTO,c); // in questa maniera reperisco il record dei saldi saldi.put(SLD_SOTTOCONTO,s); // contenente la somma degli scaricati e non scaricati if (saldi.read() == NOERR) @@ -1876,7 +1630,8 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin //se il saldo iniziale e' diverso da zero non lo devo considerare //perche' l'ho gia' considerato nella funzione calcola const real ss = saldi.get_real(SLD_SALDO); - if (ss.is_zero()) + + if (ss.is_zero()) { if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5)) { @@ -1945,17 +1700,18 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin _nuovo_tot_saldo_a += _saldo_ini_avere; //fine - if (_datada == _dataini) + if (_dal == _dataini) saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; - else if (_datada > _dataini) - { - if (saldo_iniziale > 0) - _prg_prec_dare += saldo_iniziale; - else - _prg_prec_avere -= saldo_iniziale; - saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare- - _mov_periodo_avere; - } + else + if (_dal > _dataini) + { + if (saldo_iniziale > 0) + _prg_prec_dare += saldo_iniziale; + else + _prg_prec_avere -= saldo_iniziale; + saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare- + _mov_periodo_avere; + } if (saldo_finale == ZERO) if (_stampav == 2) continue; @@ -1976,7 +1732,7 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin { //vado sui saldi con l'anno precedente e calcolo saldo_finale es.prec //se esiste tale record e almeno un valore e' significativo (indipendentemente dal valore - //del saldo iniziale calcolato, allora metto a TRUE il flag movimentato + //del saldo iniziale calcolato, allora metto a true il flag movimentato //solo se e' un conto patrimoniale if (ib == 1 || ib == 2 || ib == 5) { @@ -2006,8 +1762,10 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin _nuovo_tot_saldo_d += _mov_periodo_dare; _nuovo_tot_saldo_a += _mov_periodo_avere; - real nuovo = sld.saldoinisusaldi(); - if (nuovo > ZERO) + + real nuovo = sld.saldoinisusaldi(); + + if (nuovo > ZERO) _nuovo_tot_saldo_d += nuovo; else { @@ -2016,10 +1774,10 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin } } - esiste_sc = TRUE; + esiste_sc = true; //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _saldo_ini_conto_dare += _saldo_ini_dare; _saldo_ini_conto_avere += _saldo_ini_avere; @@ -2047,10 +1805,10 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin _tmp_saldi_att->put(SLD_CONTO,c); _tmp_saldi_att->put(SLD_SOTTOCONTO,s); _tmp_saldi_att->put(SLD_FLAGSALINI,tipocf); - if ( (_datada == _dataini) || (_tipo_stampa1 != 1) ) + if ( (_dal == _dataini) || (_tipo_stampa != 1) ) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _tmp_saldi_att->put(SLD_PDAREPRO,_saldo_ini_dare); // W96SALDI del 05-06-96 _tmp_saldi_att->put(SLD_PAVEREPRO,_saldo_ini_avere); @@ -2059,18 +1817,20 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin { if (saldo_iniziale > ZERO) //va stampato in Dare _tmp_saldi_att->put(SLD_PDAREPRO,saldo_iniziale); // W96SALDI del 05-06-96 - else if (saldo_iniziale < ZERO) - { - saldo_iniziale = -saldo_iniziale; - _tmp_saldi_att->put(SLD_PAVEREPRO,saldo_iniziale); // W96SALDI del 05-06-96 - } + else + if (saldo_iniziale < ZERO) + { + saldo_iniziale = -saldo_iniziale; + _tmp_saldi_att->put(SLD_PAVEREPRO,saldo_iniziale); // W96SALDI del 05-06-96 + } } } - else if (_datada > _dataini) - { - _tmp_saldi_att->put(SLD_PDAREPRO,_prg_prec_dare); // W96SALDI del 05-06-96 - _tmp_saldi_att->put(SLD_PAVEREPRO,_prg_prec_avere); - } + else + if (_dal > _dataini) + { + _tmp_saldi_att->put(SLD_PDAREPRO,_prg_prec_dare); // W96SALDI del 05-06-96 + _tmp_saldi_att->put(SLD_PAVEREPRO,_prg_prec_avere); + } _tmp_saldi_att->put(SLD_PDARE,_mov_periodo_dare); _tmp_saldi_att->put(SLD_PAVERE,_mov_periodo_avere); _tmp_saldi_att->put(SLD_SALDO,saldo_finale); @@ -2083,17 +1843,18 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin return esiste_sc; } -void TStampa_bilanci::scrivi_record_gruppo(const real& prg_da, - const real& prg_a,const real& mov_da,const real& mov_a,const real& s) +void TStampa_bilanci::scrivi_record_gruppo(const real& prg_da, const real& prg_a, + const real& mov_da, const real& mov_a, + const real& s) { _tmp_saldi_att->zero(); _tmp_saldi_att->put(SLD_GRUPPO,_gp); _tmp_saldi_att->put(SLD_CONTO,0); _tmp_saldi_att->put(SLD_SOTTOCONTO,0L); - if ( (_datada == _dataini) || (_tipo_stampa1 != 1) ) + if ( (_dal == _dataini) || (_tipo_stampa != 1) ) { //modifica del 21/11/1995 - if (_datada == _dataini && _tipo_stampa1 == 1) + if (_dal == _dataini && _tipo_stampa == 1) { _tmp_saldi_att->put(SLD_PDAREPRO,_saldo_ini_gruppo_dare); // W96SALDI del 05-06-96 _tmp_saldi_att->put(SLD_PAVEREPRO,_saldo_ini_gruppo_avere); @@ -2101,20 +1862,23 @@ void TStampa_bilanci::scrivi_record_gruppo(const real& prg_da, else { real app = _saldo_ini_gruppo_dare + _saldo_ini_gruppo_avere; + if (app > ZERO) //va stampato in Dare _tmp_saldi_att->put(SLD_PDAREPRO,app); // W96SALDI del 05-06-96 - else if (app < ZERO) - { - app = -app; - _tmp_saldi_att->put(SLD_PAVEREPRO,app); // W96SALDI del 05-06-96 - } + else + if (app < ZERO) + { + app = -app; + _tmp_saldi_att->put(SLD_PAVEREPRO,app); // W96SALDI del 05-06-96 + } } } - else if (_datada > _dataini) - { - _tmp_saldi_att->put(SLD_PDAREPRO,prg_da); // W96SALDI del 05-06-96 - _tmp_saldi_att->put(SLD_PAVEREPRO,prg_a); - } + else + if (_dal > _dataini) + { + _tmp_saldi_att->put(SLD_PDAREPRO,prg_da); // W96SALDI del 05-06-96 + _tmp_saldi_att->put(SLD_PAVEREPRO,prg_a); + } _tmp_saldi_att->put(SLD_PDARE,mov_da); _tmp_saldi_att->put(SLD_PAVERE,mov_a); _tmp_saldi_att->put(SLD_SALDO,s); @@ -2128,10 +1892,10 @@ void TStampa_bilanci::scrivi_record_conto(const real& prg_da, const real& prg_a, _tmp_saldi_att->put(SLD_GRUPPO,_gp); _tmp_saldi_att->put(SLD_CONTO,_cp); _tmp_saldi_att->put(SLD_SOTTOCONTO,0L); - if ( (_datada == _dataini) || (_tipo_stampa1 != 1) ) + if ( (_dal == _dataini) || (_tipo_stampa != 1) ) { //modifica del 21/11/1995 - if (_datada == _dataini && _tipo_stampa1 == 1) + if (_dal == _dataini && _tipo_stampa == 1) { _tmp_saldi_att->put(SLD_PDAREPRO,_saldo_ini_conto_dare); // W96SALDI del 05-06-96 _tmp_saldi_att->put(SLD_PAVEREPRO,_saldo_ini_conto_avere); @@ -2139,20 +1903,23 @@ void TStampa_bilanci::scrivi_record_conto(const real& prg_da, const real& prg_a, else { real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; + if (app > ZERO) //va stampato in Dare _tmp_saldi_att->put(SLD_PDAREPRO,app); // W96SALDI del 05-06-96 - else if (app < ZERO) - { - app = -app; - _tmp_saldi_att->put(SLD_PAVEREPRO,app); // W96SALDI del 05-06-96 - } + else + if (app < ZERO) + { + app = -app; + _tmp_saldi_att->put(SLD_PAVEREPRO,app); // W96SALDI del 05-06-96 + } } } - else if (_datada > _dataini) - { - _tmp_saldi_att->put(SLD_PDAREPRO,prg_da); // W96SALDI del 05-06-96 - _tmp_saldi_att->put(SLD_PAVEREPRO,prg_a); - } + else + if (_dal > _dataini) + { + _tmp_saldi_att->put(SLD_PDAREPRO,prg_da); // W96SALDI del 05-06-96 + _tmp_saldi_att->put(SLD_PAVEREPRO,prg_a); + } _tmp_saldi_att->put(SLD_PDARE,mov_da); _tmp_saldi_att->put(SLD_PAVERE,mov_a); _tmp_saldi_att->put(SLD_SALDO,s); @@ -2169,8 +1936,9 @@ void TStampa_bilanci::init_sort() _sort->addsortkey ((char*)&(cf.conto)-(char*)&(cf.tipocf),3); if (_ordinamento == 1) _sort->addsortkey ((char*)&(cf.codcf)-(char*)&(cf.tipocf),6); - else if (_ordinamento == 2) - _sort->addsortkey ((char*)&(cf.ragsoc)-(char*)&(cf.tipocf),50); + else + if (_ordinamento == 2) + _sort->addsortkey ((char*)&(cf.ragsoc)-(char*)&(cf.tipocf),50); _sort->init(); } @@ -2187,10 +1955,10 @@ void TStampa_bilanci::riempi_record(char t,int g,int c,long s, sprintf_s(cf.ragsoc, "%s", rs); if ( s == 999999L ) { - if ( (_datada == _dataini)||(_tipo_stampa1 != 1) ) + if ((_dal == _dataini) || (_tipo_stampa != 1)) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { cf.saldodare = _saldo_ini_conto_dare; cf.saldoavere = _saldo_ini_conto_avere; @@ -2199,24 +1967,27 @@ void TStampa_bilanci::riempi_record(char t,int g,int c,long s, //fine { real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; + if (app > ZERO) //va stampato in Dare { cf.saldoavere = ZERO; cf.saldodare = app; } - else if (app < ZERO) - { - app = -app; - cf.saldodare = ZERO; - cf.saldoavere = app; - } + else + if (app < ZERO) + { + app = -app; + cf.saldodare = ZERO; + cf.saldoavere = app; + } } } - else if (_datada > _dataini) - { - cf.saldodare = sd; - cf.saldoavere = sa; - } + else + if (_dal > _dataini) + { + cf.saldodare = sd; + cf.saldoavere = sa; + } } else { @@ -2243,13 +2014,13 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) real saldo_finale, saldo_conto, saldo_iniziale, saldodare, saldoavere, movdare, movavere; real mov_conto_dare, mov_conto_avere, prg_conto_dare, prg_conto_avere; - bool esiste_sc = FALSE, movimentato = FALSE; + bool esiste_sc = false, movimentato = false; TRecnotype items = _cur->items(); + TProgress_monitor p(_pcn->eod(), "Elaborazione saldi clienti/fornitori"); _gp=-1; _cp=-1; tipocfp = ' '; - _saldo_ini_conto_dare = ZERO; _saldo_ini_conto_avere = ZERO; saldo_conto = ZERO; @@ -2259,16 +2030,16 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) prg_conto_avere = ZERO; _u_max = 0l; - const int anno = _tipo_stampa1 == 1 ? _annoapp : _annoes; + const int anno = _tipo_stampa == 1 ? _annoapp : _annoes; + for (int i=0; i < gccf.items(); i++) { int g = ((TToken_string&)gccf[i]).get_int(0); int c = ((TToken_string&)gccf[i]).get_int(1); *_cur = 0l; - for (int i = 0; i < items; i++,++(*_cur)) + for (int i = 0; i < items && p.addstatus(1L); i++,++(*_cur)) { - _prog->addstatus(1); codcf = _cur->curr().get_long(CLI_CODCF); tipocf = _cur->curr().get(CLI_TIPOCF)[0]; ragsoc = _cur->curr().get(CLI_RAGSOC); @@ -2286,7 +2057,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) int aprec = ese.pred(anno); saldi.zero(); saldi.put(SLD_ANNOES, anno); // W96SALDI del 05-06-96 - saldi.put(SLD_FLSCA, FALSE); + saldi.put(SLD_FLSCA, false); saldi.put(SLD_GRUPPO, g); saldi.put(SLD_CONTO, c); saldi.put(SLD_SOTTOCONTO, codcf); @@ -2302,7 +2073,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) { saldi.zero(); saldi.put(SLD_ANNOES, aprec); // W96SALDI del 05-06-96 - saldi.put(SLD_FLSCA, FALSE); + saldi.put(SLD_FLSCA, false); saldi.put(SLD_GRUPPO, g); saldi.put(SLD_CONTO, c); saldi.put(SLD_SOTTOCONTO, codcf); @@ -2319,7 +2090,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) prg_conto_avere,mov_conto_dare,mov_conto_avere,saldo_conto); tipocfp = tipocf; _cp = c; - esiste_sc = FALSE; + esiste_sc = false; _saldo_ini_conto_dare = ZERO; _saldo_ini_conto_avere = ZERO; saldo_conto = ZERO; @@ -2336,10 +2107,10 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) movavere = ZERO; saldo_iniziale = ZERO; - if (_tipo_stampa1 == 1) //bilancio di verifica per data limite + if (_tipo_stampa == 1) //bilancio di verifica per data limite { //modifica del 21/11/1995 - _mov_ap = FALSE; + _mov_ap = false; //modifica del 19/06/95 _indbil = cerca_indbil(g,c); @@ -2365,13 +2136,14 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) TLocalisamfile saldi(LF_SALDI); saldi.zero(); saldi.put(SLD_ANNOES, _annoes); // W96SALDI del 05-06-96 - saldi.put(SLD_FLSCA, FALSE); + saldi.put(SLD_FLSCA, false); saldi.put(SLD_GRUPPO, g); saldi.put(SLD_CONTO, c); saldi.put(SLD_SOTTOCONTO, codcf); if (saldi.read() == NOERR) { const real s = saldi.get_real(SLD_SALDO); + if (_stampa_mov_prov & 0x1) if (_indbil == 1 || _indbil == 2 || _indbil == 5) if (s.is_zero() && _annoes != 0) //competenza!!! @@ -2390,18 +2162,19 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) //movimentato = calcola(g,c,codcf); if (movimentato || _stampac != 1 || saldo_iniziale != ZERO) { - if (_datada == _dataini) + if (_dal == _dataini) saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; - else if (_datada > _dataini) - { - //modifica del 19/06 - if (saldo_iniziale > 0) - _prg_prec_dare += saldo_iniziale; - else _prg_prec_avere -= saldo_iniziale; - //fine modifica - saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare - -_mov_periodo_avere; - } + else + if (_dal > _dataini) + { + //modifica del 19/06 + if (saldo_iniziale > 0) + _prg_prec_dare += saldo_iniziale; + else _prg_prec_avere -= saldo_iniziale; + //fine modifica + saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare + -_mov_periodo_avere; + } } //se saldo_finale < 0 verra' stampato con una A, se no con una D @@ -2437,10 +2210,10 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) if (movimentato || _stampac != 1 || saldo_iniziale != ZERO) if (!(saldo_finale.is_zero() && _stampac == 2)) { - esiste_sc = TRUE; + esiste_sc = true; //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { _saldo_ini_conto_dare += _saldo_ini_dare; _saldo_ini_conto_avere += _saldo_ini_avere; @@ -2460,10 +2233,10 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) prg_conto_avere += _prg_prec_avere; saldo_conto += saldo_finale; // somma algebrica!!! - if ( (_datada == _dataini)||(_tipo_stampa1 != 1) ) + if ((_dal == _dataini) || (_tipo_stampa != 1)) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) { saldodare = _saldo_ini_dare; saldoavere = _saldo_ini_avere; @@ -2473,18 +2246,20 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf) { if (saldo_iniziale > ZERO) //va stampato in Dare saldodare = saldo_iniziale; - else if (saldo_iniziale < ZERO) - { - saldo_iniziale = -saldo_iniziale; - saldoavere = saldo_iniziale; - } + else + if (saldo_iniziale < ZERO) + { + saldo_iniziale = -saldo_iniziale; + saldoavere = saldo_iniziale; + } } } - else if (_datada > _dataini) - { - saldodare = _prg_prec_dare; - saldoavere = _prg_prec_avere; - } + else + if (_dal > _dataini) + { + saldodare = _prg_prec_dare; + saldoavere = _prg_prec_avere; + } movdare = _mov_periodo_dare; movavere = _mov_periodo_avere; @@ -2508,11 +2283,12 @@ void TStampa_bilanci::crea_sort_clifo() //serve solo per la progind: stima alla meno peggio if (_situazione.empty()) ncur /= 2; long nitems = ncur*(_clienti.items()+_fornitori.items()); - _prog = new TProgress_monitor(nitems,TR("Elaborazione clienti/fornitori"),false); - _prog->addstatus(1); - init_sort(); + + init_sort(); if (_situazione == "C") leggi_clifo(_clienti); - else if (_situazione == "F") leggi_clifo(_fornitori); + else + if (_situazione == "F") + leggi_clifo(_fornitori); else { _cur->setfilter("TIPOCF = \"C\""); @@ -2548,18 +2324,18 @@ void TStampa_bilanci::leggi_files_dare(TIsamtempfile* file) _conto_dare = file->get_int(SLD_CONTO); _sottoconto_dare = file->get_long(SLD_SOTTOCONTO); _saldo_dare = file->get_real(SLD_PDARE); - - _descr_dare = DescrizioneConto(_gruppo_dare,_conto_dare,_sottoconto_dare,' '); + _descr_dare = TBill(_gruppo_dare, _conto_dare, _sottoconto_dare, ' ').descrizione(); _gc_corr_dare = format("%3d%3d", _gruppo_dare, _conto_dare); if (_gc_corr_dare != _gc_prec_dare) { - _cambiato_conto_1 = TRUE; + _cambiato_conto_1 = true; _gc_prec_dare = _gc_corr_dare; } - else if (_sottoconto_dare != 0l) - _cambiato_conto_1 = FALSE; + else + if (_sottoconto_dare != 0l) + _cambiato_conto_1 = false; } void TStampa_bilanci::leggi_files_avere(TIsamtempfile* file) @@ -2568,18 +2344,17 @@ void TStampa_bilanci::leggi_files_avere(TIsamtempfile* file) _conto_avere = file->get_int(SLD_CONTO); _sottoconto_avere = file->get_long(SLD_SOTTOCONTO); _saldo_avere = file->get_real(SLD_PAVERE); - - _descr_avere = DescrizioneConto(_gruppo_avere,_conto_avere,_sottoconto_avere, - ' '); + _descr_avere = TBill(_gruppo_avere, _conto_avere, _sottoconto_avere, ' ').descrizione(); _gc_corr_avere = format("%3d%3d", _gruppo_avere, _conto_avere); if (_gc_corr_avere != _gc_prec_avere) { - _cambiato_conto_2 = TRUE; + _cambiato_conto_2 = true; _gc_prec_avere = _gc_corr_avere; } - else if (_sottoconto_avere != 0l) - _cambiato_conto_2 = FALSE; + else + if (_sottoconto_avere != 0l) + _cambiato_conto_2 = false; } #define TOTAL_PICTURE "###.###.###.###.###" @@ -2587,7 +2362,7 @@ void TStampa_bilanci::leggi_files_avere(TIsamtempfile* file) HIDDEN void total2string(const real& tot, TString& str) { TCurrency cur(tot); - str = cur.string(TRUE); + str = cur.string(true); str.right_just(strlen(TOTAL_PICTURE)); } @@ -2604,11 +2379,11 @@ bool TStampa_bilanci::preprocess_print(int file, int counter) _tmp_saldi_conti_uno->setkey(2); _tmp_saldi_conti_due->setkey(2); _gc_prec_avere = ""; - _prima_volta = _seconda_volta = TRUE; - _flag = _controlla = FALSE; - _salto_pagina = _salto_pagina1 = _stampato = FALSE; - _cambiato_conto_1 = TRUE; - _cambiato_conto_2 = TRUE; + _prima_volta = _seconda_volta = true; + _flag = _controlla = false; + _salto_pagina = _salto_pagina1 = _stampato = false; + _cambiato_conto_1 = true; + _cambiato_conto_2 = true; _tot_dare = ZERO; _tot_avere = ZERO; } @@ -2619,28 +2394,28 @@ bool TStampa_bilanci::preprocess_print(int file, int counter) else set_real_picture ("####.###.###.###"); - set_print_zero(FALSE); - _cambiato_conto_1 = FALSE; - _livello_conto = TRUE; + set_print_zero(false); + _cambiato_conto_1 = false; + _livello_conto = true; _saldo_dare_tot = ZERO; _saldo_avere_tot = ZERO; _mov_dare_tot = ZERO; _mov_avere_tot = ZERO; _saldo_finale_tot = ZERO; } - set_magic_currency(TRUE); - return TRUE; + set_magic_currency(true); + return true; } void TStampa_bilanci::leggi_file_tmp() { - if (_livello_conto) // era meglio chiamarla _livello_conto_oppure_gruppo, perche' nel caso dei saldi di mastro _livello_conto==TRUE <=> si tratta di un gruppo, mentre nel caso del bilancio _livello_conto==TRUE <=> si tratta di un conto + if (_livello_conto) // era meglio chiamarla _livello_conto_oppure_gruppo, perche' nel caso dei saldi di mastro _livello_conto==true <=> si tratta di un gruppo, mentre nel caso del bilancio _livello_conto==true <=> si tratta di un conto { _gruppo = _tmp_saldi_att->get_int(SLD_GRUPPO); _conto = _tmp_saldi_att->get_int(SLD_CONTO); _sottoconto = _tmp_saldi_att->get_long(SLD_SOTTOCONTO); _tipo_conto = _tmp_saldi_att->get_char(SLD_FLAGSALINI); - _descr = DescrizioneConto(_gruppo,_conto,_sottoconto,_tipo_conto); + _descr = TBill(_gruppo,_conto,_sottoconto,_tipo_conto).descrizione(); _saldoini_dare = _tmp_saldi_att->get_real(SLD_PDAREPRO); // W96SALDI del 05-06-96 _saldoini_avere = _tmp_saldi_att->get_real(SLD_PAVEREPRO); _mov_dare = _tmp_saldi_att->get_real(SLD_PDARE); @@ -2656,23 +2431,22 @@ void TStampa_bilanci::leggi_file_tmp() _tipoc_succ = _tmp_saldi_att->get_char(SLD_FLAGSALINI); if ( (_verifica != 2) && (_sottoconto_succ != 0) ) { - if (_tipo_stampa1 == 2) + if (_tipo_stampa == 2) _ultima_data = UltimaData(_gruppo_succ,_conto_succ, _sottoconto_succ,_annoes); else _ultima_data = _tmp_saldi_att->get_date(SLD_DATAULMOV); } - _descr_succ = DescrizioneConto(_gruppo_succ,_conto_succ, - _sottoconto_succ,_tipoc_succ); + _descr_succ = TBill(_gruppo_succ,_conto_succ, _sottoconto_succ,_tipoc_succ).descrizione(); _saldoini_dare_succ = _tmp_saldi_att->get_real(SLD_PDAREPRO); // W96SALDI del 05-06-96 _saldoini_avere_succ = _tmp_saldi_att->get_real(SLD_PAVEREPRO); _mov_dare_succ = _tmp_saldi_att->get_real(SLD_PDARE); _mov_avere_succ = _tmp_saldi_att->get_real(SLD_PAVERE); _saldofinale_succ = _tmp_saldi_att->get_real(SLD_SALDO); - _livello_conto = FALSE; + _livello_conto = false; if ( ((_verifica != 2)&&(_sottoconto_succ == 0)) || ((_verifica == 2)&&(_conto_succ == 0)) ) { - _livello_conto = TRUE; + _livello_conto = true; _gruppo_succ = _gruppo; _conto_succ = _conto; _sottoconto_succ = _sottoconto; @@ -2710,7 +2484,7 @@ bool TStampa_bilanci::preprocess_page(int file, int counter) } else { - _controlla = TRUE; + _controlla = true; if (_salto_pagina) { @@ -2738,7 +2512,7 @@ bool TStampa_bilanci::preprocess_page(int file, int counter) } else { - _flag = TRUE; + _flag = true; if (_salto_pagina1) { @@ -2786,13 +2560,13 @@ bool TStampa_bilanci::preprocess_page(int file, int counter) { _eof1 = _tmp_saldi_att->first(); if (_eof1) - return FALSE; + return false; else leggi_file_tmp(); } } } - return TRUE; + return true; } void TStampa_bilanci::leggi_sort() @@ -2808,7 +2582,7 @@ void TStampa_bilanci::leggi_sort() _descr = cf->ragsoc; if ( (_ordinamento == 2 && _descr != "zzzz") || (_ordinamento == 1 && _sottoconto != 999999L) ) { - if (_tipo_stampa1 == 2) + if (_tipo_stampa == 2) _ultima_data = UltimaData(_gruppo,_conto,_sottoconto,_annoes); else _ultima_data = cf->udata; @@ -2827,13 +2601,13 @@ void TStampa_bilanci::controlla_conto(int file1,int file2) if (_cambiato_conto_1) { set_row(_i,"@67g*"); - _cambiato_conto_1 = FALSE; + _cambiato_conto_1 = false; } else { stampa_prima_colonna(_gruppo_dare, _conto_dare, _sottoconto_dare, _descr_dare,_saldo_dare); - _cambiato_conto_1 = TRUE; + _cambiato_conto_1 = true; if (!_totali) if ( (_conto_dare == 0) && (_sottoconto_dare == 0) ) _tot_dare += _saldo_dare; @@ -2846,13 +2620,13 @@ void TStampa_bilanci::controlla_conto(int file1,int file2) if (_cambiato_conto_2) { set_row(_i,"@67g*"); - _cambiato_conto_2 = FALSE; + _cambiato_conto_2 = false; } else { stampa_seconda_colonna(_gruppo_avere, _conto_avere, _sottoconto_avere, _descr_avere, _saldo_avere); - _cambiato_conto_2 = TRUE; + _cambiato_conto_2 = true; if (!_totali) if ( (_conto_avere == 0) && (_sottoconto_avere == 0) ) _tot_avere += _saldo_avere; @@ -2910,7 +2684,7 @@ void TStampa_bilanci::set_page(int file, int counter) set_row(_i++,FR("@29gCOSTI@98gRICAVI")); set_row(_i++,"@29g-----@98g------"); set_row(_i++, dep); - _salto_pagina = TRUE; + _salto_pagina = true; } @@ -2929,11 +2703,11 @@ void TStampa_bilanci::set_page(int file, int counter) set_row(_i++, dep); if (_eof5 && _eof6) { - _stampato = TRUE; + _stampato = true; stampa_totali_uno(_prg_inidare_ord,_prg_iniavere_ord); } } - _salto_pagina1 = TRUE; + _salto_pagina1 = true; } if (_eof3 && _eof4 && _flag) @@ -2961,15 +2735,16 @@ void TStampa_bilanci::set_page(int file, int counter) *_d = (const char*) _descr; if (_saldofinale > 0) app = 'D'; - else if (_saldofinale < 0) - { - _saldofinale = -_saldofinale; - app = 'A'; - } + else + if (_saldofinale < 0) + { + _saldofinale = -_saldofinale; + app = 'A'; + } if ( (_ordinamento == 2 && _descr == "zzzz") || (_ordinamento == 1 && _sottoconto == 999999L) ) //devo stampare il conto { - _descr = DescrizioneConto(_gruppo,_conto,0L,' '); + _descr = TBill(_gruppo, _conto, 0L, ' ').descrizione(); stampa_record_conto(_gruppo,_conto,_descr,_saldo_dare,_saldo_avere, _mov_dare,_mov_avere,_saldofinale,app); } @@ -2988,28 +2763,29 @@ void TStampa_bilanci::set_page(int file, int counter) if (_descr.len() > 30) set_row(++r, "@46g!@80g!@114g!"); } - else if (app == 'D') - { - set_row(r,"@1g%6ld", _sottoconto); - if ((_saldo_dare != ZERO) || (_saldo_avere != ZERO) || (_mov_dare != ZERO) || - (_mov_avere != ZERO) || (_saldofinale != ZERO)) - set_row(r," %s",(const char*)udata); - set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",_d, - &_saldo_dare,&_saldo_avere,&_mov_dare,&_mov_avere,&_saldofinale); - if (_descr.len() > 30) - set_row(++r, "@46g!@80g!@114g!@148g!"); - } else - { - set_row(r,"@1g%6ld", _sottoconto); - if ((_saldo_dare != ZERO) || (_saldo_avere != ZERO) || (_mov_dare != ZERO) || - (_mov_avere != ZERO) || (_saldofinale != ZERO)) - set_row(r," %s",(const char*)udata); - set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!", - _d,&_saldo_dare,&_saldo_avere,&_mov_dare,&_mov_avere,&_saldofinale); - if (_descr.len() > 30) - set_row(++r, "@46g!@80g!@114g!@148g!"); - } + if (app == 'D') + { + set_row(r,"@1g%6ld", _sottoconto); + if ((_saldo_dare != ZERO) || (_saldo_avere != ZERO) || (_mov_dare != ZERO) || + (_mov_avere != ZERO) || (_saldofinale != ZERO)) + set_row(r," %s",(const char*)udata); + set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",_d, + &_saldo_dare,&_saldo_avere,&_mov_dare,&_mov_avere,&_saldofinale); + if (_descr.len() > 30) + set_row(++r, "@46g!@80g!@114g!@148g!"); + } + else + { + set_row(r,"@1g%6ld", _sottoconto); + if ((_saldo_dare != ZERO) || (_saldo_avere != ZERO) || (_mov_dare != ZERO) || + (_mov_avere != ZERO) || (_saldofinale != ZERO)) + set_row(r," %s",(const char*)udata); + set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!", + _d,&_saldo_dare,&_saldo_avere,&_mov_dare,&_mov_avere,&_saldofinale); + if (_descr.len() > 30) + set_row(++r, "@46g!@80g!@114g!@148g!"); + } } } } @@ -3043,13 +2819,14 @@ void TStampa_bilanci::set_page(int file, int counter) if (_saldofinale_succ != ZERO) set_row(r,"@131g%c", app); } - else if (app == 'D') - { - set_row(r,"%3d",_conto_succ); - set_row(r," @8g%-.40s@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!", - (const char*)_descr_succ,&_saldoini_dare_succ,&_saldoini_avere_succ, - &_mov_dare_succ,&_mov_avere_succ,&_saldofinale_succ); - } + else + if (app == 'D') + { + set_row(r,"%3d",_conto_succ); + set_row(r," @8g%-.40s@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!", + (const char*)_descr_succ,&_saldoini_dare_succ,&_saldoini_avere_succ, + &_mov_dare_succ,&_mov_avere_succ,&_saldofinale_succ); + } else { set_row(r,"%3d",_conto_succ); @@ -3182,24 +2959,25 @@ int TStampa_bilanci::stampa_record_conto(int g,int c,const TString& d, if (d.len() > 30) set_row(r+1, "@46g!@80g!@114g!"); } - else if (app == 'D') - { - set_row(r,"%3d-",g); - set_row(r,"%3d ********",c); - set_row(r,"@17g#a",_d); - set_row(r++,"@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",&r1,&r2,&r3,&r4,&r5); - if (d.len() > 30) - set_row(r+1, "@46g!@80g!@114g!@148g!"); - } else - { - set_row(r,"%3d-",g); - set_row(r,"%3d ********",c); - set_row(r,"@17g#a",_d); - set_row(r++,"@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&r1,&r2,&r3,&r4,&r5); - if (d.len() > 30) - set_row(r+1, "@46g!@80g!@114g!@148g!"); - } + if (app == 'D') + { + set_row(r,"%3d-",g); + set_row(r,"%3d ********",c); + set_row(r,"@17g#a",_d); + set_row(r++,"@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",&r1,&r2,&r3,&r4,&r5); + if (d.len() > 30) + set_row(r+1, "@46g!@80g!@114g!@148g!"); + } + else + { + set_row(r,"%3d-",g); + set_row(r,"%3d ********",c); + set_row(r,"@17g#a",_d); + set_row(r++,"@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&r1,&r2,&r3,&r4,&r5); + if (d.len() > 30) + set_row(r+1, "@46g!@80g!@114g!@148g!"); + } } set_row(r,"@46g!@80g!@114g!"); @@ -3231,16 +3009,18 @@ void TStampa_bilanci::stampa_riga_totali(int r) if (_saldo_finale_tot > 0) app = 'D'; - else if (_saldo_finale_tot < 0) - { - _saldo_finale_tot = -_saldo_finale_tot; - app = 'A'; - } + else + if (_saldo_finale_tot < 0) + { + _saldo_finale_tot = -_saldo_finale_tot; + app = 'A'; + } //modifica del 21/11/1995 - if (_tipo_stampa1 == 2) + if (_tipo_stampa == 2) { real r = _saldo_dare_tot - _saldo_avere_tot; + if (r > ZERO) { _saldo_dare_tot = r; @@ -3287,10 +3067,10 @@ void TStampa_bilanci::stampa_riga_totali(int r) set_row(r,"@131g%c", app); r++; - if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2) + if ((_tipo_stampa == 1 && _dal == _dataini) || _tipo_stampa == 2) { //modifica del 21/11/1995 - if (_tipo_stampa1 == 2) + if (_tipo_stampa == 2) set_row(r,FR("@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!"),&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); else set_row(r,FR("@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!"),&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); @@ -3310,9 +3090,9 @@ void TStampa_bilanci::stampa_riga_totali(int r) &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot); } - if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2) + if ((_tipo_stampa == 1 && _dal == _dataini) || _tipo_stampa == 2) { - if (_tipo_stampa1 == 2) + if (_tipo_stampa == 2) set_row(r,FR("@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!@148g!"),&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); else set_row(r,FR("@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!@148g!"),&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); @@ -3326,6 +3106,7 @@ void TStampa_bilanci::stampa_totali() const TString16 dep = ""; real pareggio; real sbilancio = _tot_dare - _tot_avere; + if (sbilancio > ZERO) //_tot_dare > _tot_avere pareggio = _tot_avere + sbilancio; else @@ -3334,13 +3115,13 @@ void TStampa_bilanci::stampa_totali() pareggio = _tot_dare + sbilancio; } if (_prima_volta) //ho finito di stampare le attivita'/passivita' - _prima_volta = FALSE; + _prima_volta = false; else - _seconda_volta = FALSE; + _seconda_volta = false; const bool stato_patrimoniale = _seconda_volta; // cosa mi tocca fare _gc_prec_dare = _gc_corr_avere = ""; - _cambiato_conto_1 = TRUE; - _cambiato_conto_2 = TRUE; + _cambiato_conto_1 = true; + _cambiato_conto_2 = true; set_row(_i++, (const char*)dep); set_row(_i++, (const char*)dep); @@ -3380,13 +3161,13 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2) real sbilprec = r2 - r1; if (_prima_volta) //ho finito di stampare le attivita'/passivita' - _prima_volta = FALSE; + _prima_volta = false; else - _seconda_volta = FALSE; + _seconda_volta = false; const bool stato_patrimoniale = _seconda_volta; // cosa mi tocca fare _gc_prec_dare = _gc_corr_avere = ""; - _cambiato_conto_1 = TRUE; - _cambiato_conto_2 = TRUE; + _cambiato_conto_1 = true; + _cambiato_conto_2 = true; const char* dep = ""; set_row(_i++, (const char*)dep); @@ -3415,47 +3196,49 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2) set_row(_i++, FR("@77gPERDITA DELL'ESERCIZIO IN CORSO@113g%s"), (const char*)pal); set_row(_i++, FR("@91gTOTALE A PAREGGIO@113g%s"),(const char*)bal); } - else if (sbilancio < ZERO) //ho una perdita => va stampato tra le attivita' - { - sbilancio = -sbilancio; - pareggio = _tot_dare + sbilancio + sbilprec; - if (sbilprec != ZERO) - { - TString sb; total2string(sbilprec, sb); - set_row(_i++, FR("@15gSBILANCIO ESERCIZIO PRECEDENTE@48g%s"), - (const char*)sb); - } + else + if (sbilancio < ZERO) //ho una perdita => va stampato tra le attivita' + { + sbilancio = -sbilancio; + pareggio = _tot_dare + sbilancio + sbilprec; + if (sbilprec != ZERO) + { + TString sb; total2string(sbilprec, sb); + set_row(_i++, FR("@15gSBILANCIO ESERCIZIO PRECEDENTE@48g%s"), + (const char*)sb); + } - TString pal; total2string(sbilancio, pal); - TString bal; total2string(pareggio, bal); - if (stato_patrimoniale) - set_row(_i++, FR("@14gPERDITA DELL'ESERCIZIO IN CORSO@48g%s"), (const char*)pal); - else - set_row(_i++, FR("@16gUTILE DELL'ESERCIZIO IN CORSO@48g%s"), (const char*)pal); - set_row(_i++, FR("@28gTOTALE A PAREGGIO@48g%s"),(const char*)bal); - } - else //sbilancio es. in corso == 0 - { - sbilprec = -sbilprec; - if (sbilprec > ZERO) //va stampato sotto le passivita' - { - TString pal; total2string(sbilprec, pal); - pareggio = _tot_avere + sbilprec; - TString bal; total2string(pareggio, bal); - set_row(_i++, FR("@83gSBILANCIO ESERCIZIO PRECEDENTE@113g%s"), - (const char*)pal); - set_row(_i++, FR("@96gTOTALE A PAREGGIO@113g%s"), (const char*)bal); - } - else if (sbilprec < ZERO) - { - sbilprec = -sbilprec; - pareggio = _tot_dare + sbilprec; - TString pal; total2string(sbilprec, pal); - TString bal; total2string(pareggio, bal); - set_row(_i++, FR("@15gSBILANCIO ESERCIZIO PRECEDENTE@48g%s"), (const char*)pal); - set_row(_i++, FR("@28gTOTALE A PAREGGIO@48g%s"), (const char*)bal); - } - } + TString pal; total2string(sbilancio, pal); + TString bal; total2string(pareggio, bal); + if (stato_patrimoniale) + set_row(_i++, FR("@14gPERDITA DELL'ESERCIZIO IN CORSO@48g%s"), (const char*)pal); + else + set_row(_i++, FR("@16gUTILE DELL'ESERCIZIO IN CORSO@48g%s"), (const char*)pal); + set_row(_i++, FR("@28gTOTALE A PAREGGIO@48g%s"),(const char*)bal); + } + else //sbilancio es. in corso == 0 + { + sbilprec = -sbilprec; + if (sbilprec > ZERO) //va stampato sotto le passivita' + { + TString pal; total2string(sbilprec, pal); + pareggio = _tot_avere + sbilprec; + TString bal; total2string(pareggio, bal); + set_row(_i++, FR("@83gSBILANCIO ESERCIZIO PRECEDENTE@113g%s"), + (const char*)pal); + set_row(_i++, FR("@96gTOTALE A PAREGGIO@113g%s"), (const char*)bal); + } + else + if (sbilprec < ZERO) + { + sbilprec = -sbilprec; + pareggio = _tot_dare + sbilprec; + TString pal; total2string(sbilprec, pal); + TString bal; total2string(pareggio, bal); + set_row(_i++, FR("@15gSBILANCIO ESERCIZIO PRECEDENTE@48g%s"), (const char*)pal); + set_row(_i++, FR("@28gTOTALE A PAREGGIO@48g%s"), (const char*)bal); + } + } _tot_dare = ZERO; _tot_avere = ZERO; } @@ -3473,13 +3256,14 @@ void TStampa_bilanci::stampa_prima_colonna(int g, int c, long s, else set_row(_i, "%-.48s @48g%r", desc, &saldo); } - else if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo - { - if (s == 0) //se e' un conto - set_row(_i, "%-.44s @44g @48g%r", desc, &saldo); - else - set_row(_i, "%-.48s @48g%r", desc, &saldo); - } + else + if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo + { + if (s == 0) //se e' un conto + set_row(_i, "%-.44s @44g @48g%r", desc, &saldo); + else + set_row(_i, "%-.48s @48g%r", desc, &saldo); + } } else { @@ -3544,8 +3328,9 @@ print_action TStampa_bilanci::postprocess_page(int file, int counter) if (_buff == NULL) return NEXT_PAGE; } - else if (_eof1) - return NEXT_PAGE; + else + if (_eof1) + return NEXT_PAGE; } return REPEAT_PAGE; } @@ -3558,7 +3343,7 @@ TDate TStampa_bilanci::UltimaData(int g, int c, long s, int anno) saldi.zero(); if (_annoes != 0) saldi.put(SLD_ANNOES, anno); - saldi.put(SLD_FLSCA, FALSE); // W96SALDI del 05-06-96 + saldi.put(SLD_FLSCA, false); // W96SALDI del 05-06-96 saldi.put(SLD_GRUPPO,g); if (c != 0) saldi.put(SLD_CONTO, c); @@ -3572,58 +3357,6 @@ TDate TStampa_bilanci::UltimaData(int g, int c, long s, int anno) return uldata; } -// Non ho potuto usare quella di TConto!!! Chiedere a me! -// Guy: E tu chi sei? -const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf) -{ -/* - static TString80 ragsoc; - const char* desc = NULL; - - TString80 key; key << g; - if (c != 0) - { - key << "|" << c ; - if (s != 0) - key << "|" << s; - } - const TRectype & pconti = cache().get(LF_PCON, key); - if (!pconti.empty()) - _tmp = pconti.get(PCN_DESCR); - else - { - key.format("%c|%ld", tipocf, s); - const TRectype & clifo = cache().get(LF_CLIFO, key); - - if (!clifo.empty()) - { - char tipoa = clifo.get_char(CLI_TIPOAPER); - if (tipoa == 'F') //persona fisica - { - TString80 cognome, nome; - ragsoc = clifo.get(CLI_RAGSOC); - cognome = ragsoc.mid(0,30); - nome = ragsoc.mid(30,20); - cognome.trim(); nome.trim(); - ragsoc = cognome; - ragsoc << " " << nome; - desc = ragsoc; - } - else - desc = clifo.get(CLI_RAGSOC); - _tmp = desc; - } - else - _tmp = ""; - - } - return _tmp; -*/ - const TBill bill(g, c, s, tipocf); - _tmp = bill.descrizione(); - return _tmp; -} - bool TStampa_bilanci::user_create() { open_files(LF_TAB, 0); @@ -3648,7 +3381,7 @@ bool TStampa_bilanci::user_create() _tmp_saldi_ricavi = NULL; _tmp_saldi_conti_uno = NULL; _tmp_saldi_conti_due = NULL; - return TRUE; + return true; } bool TStampa_bilanci::user_destroy() @@ -3672,7 +3405,7 @@ bool TStampa_bilanci::user_destroy() if (_tmp_saldi_ricavi) delete _tmp_saldi_ricavi; if (_tmp_saldi_conti_uno) delete _tmp_saldi_conti_uno; if (_tmp_saldi_conti_due) delete _tmp_saldi_conti_due; - return TRUE; + return true; } void TStampa_bilanci::leggi_pcon() @@ -3699,43 +3432,32 @@ void TStampa_bilanci::leggi_pcon() gc.add(conto,1); _clienti.add(gc); } - else if ( tipocf == 'F' && (_situazione.empty() || _situazione == "F")) - { - gc.add(gruppo,0); - gc.add(conto,1); - _fornitori.add(gc); - } + else + if ( tipocf == 'F' && (_situazione.empty() || _situazione == "F")) + { + gc.add(gruppo,0); + gc.add(conto,1); + _fornitori.add(gc); + } } } } void TStampa_bilanci::stampa_un_bilancio(const TMask& m) { - _prog = NULL; if (_bilancio == 1) //bilancio a sezioni contrapposte { printer().footerlen(3); - _prog = new TProgress_monitor(_pcn->items(),TR("Elaborazione conti"), false); _totali = m.get_bool(F_TOTALI); _codici = m.get_bool(F_CODICI); _saldo = m.get_bool(F_SALDO); _tipo_stampa = m.get_int(F_STAMPA); - - if (_tipo_stampa == 1) - { - _datalim = m.get(F_DATALIM); - _print_exercise = TRUE; - if (_annoes == 0) - { - _print_exercise = FALSE; - _annoes = date2esc(_datalim); - } - - if (_annoes != 0) - _dataini = InizioEsercizio(_annoes); - else - _dataini = _inizioEs; - } + _annoes = m.get_int(F_ANNO); + _al = m.get(F_DATALIM); + if (_annoes == 0) + _annoes = esercizi().exist(_al) ? esercizio(_al).codice() : esercizio(TDate(TODAY)).codice(); + _dataini = esercizio(_annoes).inizio(); + _print_exercise = (_tipo_stampa == 1); bil_sez_contr(); } else //bilancio di verifica (tipo 1,2,3) @@ -3745,19 +3467,13 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m) _verifica = m.get_int(F_VERIFICA); //tipo di bilancio di verifica da stampare _print_full_code = _verifica == 1 && m.get_bool(F_PRINT_FULL_CODE); - if ( (_verifica == 1)||(_verifica == 2) ) - _prog = new TProgress_monitor(_pcn->items(),TR("Elaborazione conti"),false); - _tipo_stampa1 = m.get_int(F_STAMPA1); - if (_tipo_stampa1 == 1) + _tipo_stampa = m.get_int(F_STAMPA); + if (_tipo_stampa == 1) { - if (_annoes != 0) - _dataini = InizioEsercizio(_annoes); - else - _dataini = _inizioEs; - _datada = m.get(F_DATADA); - _dataa = m.get(F_DATAA); + _dal = m.get_date(F_DATAINI); + _al = m.get_date(F_DATALIM); } - if ((_verifica == 1)||(_verifica == 2)) //bilancio di verifica:1bilancio,2saldi mastro + if ((_verifica == 1) || (_verifica == 2)) //bilancio di verifica:1bilancio,2saldi mastro { _stampav = atoi(m.get(F_STAMPAV)); bil_verifica(); @@ -3780,8 +3496,6 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m) _sort->endsort(); } } - if (_prog) - delete _prog; print(); } @@ -3795,11 +3509,9 @@ bool TStampa_bilanci::set_print(int) m.set_handler (F_VERIFICA, verifica_handler); m.set_handler (F_BILANCIO, mask_bilancio); - m.set_handler (F_STAMPA1, mask_bilancio); m.set_handler (F_STAMPA, mask_bilancio); m.set_handler (F_DATALIM, mask_datalim); - m.set_handler (F_DATADA, mask_date); - m.set_handler (F_DATAA, mask_date); + m.set_handler (F_DATAINI, mask_dataini); m.set_handler (F_ANNO, mask_anno); m.set(F_NORMALI, "X"); @@ -3815,6 +3527,7 @@ bool TStampa_bilanci::set_print(int) _quadratura = m.get_bool(F_QUADRATURA); _hide_clifo = m.get_bool(F_HIDE_CLIFO); _noseparator = m.get_bool(F_SEPARATOR); + _tipo_data = (_annoes == 0 ? Registrazione : (m.get_bool(F_COMPCR) ? CostiRicavi : Competenza)); #ifdef CONT_SEP _cont_sep = m.get(F_CONTSEP); #endif @@ -3839,7 +3552,7 @@ bool TStampa_bilanci::set_print(int) stampa_un_bilancio(m); } - return FALSE; + return false; } TRectype& look_com (const char* cod, TLocalisamfile *comuni) @@ -3960,27 +3673,26 @@ void TStampa_bilanci::preprocess_header() if (_bilancio == 1) //bilancio a sezioni contrapposte { TString riga (132); - TDate data_da; - TString data; - TString data_lim = _datalim.string(); - - set_header(r, TR("STAMPA BILANCIO A SEZIONI CONTRAPPOSTE")); - if (_tipo_stampa == 1) - { - data_da = _dataini.string(); - data = _datalim.string(); - set_header(r,"@41g%s %s %s %s", TR("dalla data"), (const char*) data_da, TR("alla data"), - (const char*) data); - } - else if (_tipo_stampa == 2) - set_header(r,FR("@41gall'ultima immissione Es. %d"), _annoes); - - //modifica del 20/04/1995 + TString intestazione(TR("STAMPA BILANCIO A SEZIONI CONTRAPPOSTE")); + + if (_tipo_data == Registrazione) + intestazione << ' ' << TR("PER CASSA"); + else + if (_tipo_data == CostiRicavi) + intestazione << ' ' << TR("PER COMPETENZA COSTI/RICAVI"); + set_header(r, intestazione); + if (_tipo_stampa == 1) + set_header(r,"@90g%s %s %s %s", TR("dalla data"), (const char*) _dataini.string(), TR("alla data"), + (const char*) _al.string()); + else + if (_tipo_stampa == 2) + set_header(r,FR("@102gall'ultima immissione Es. %d"), _annoes); + //modifica del 20/04/1995 if (_print_exercise) { - const TString16 d1(InizioEsercizio(_annoes).string()); - const TString16 d2(FineEsercizio(_annoes).string()); - set_header(r, "@84g%s %s %s", TR("Esercizio"), (const char*)d1, (const char*)d2); /**/ + const TEsercizio & es = esercizio(_annoes); + + set_header(++r, "@101g%s %s %s", TR("Esercizio"), (const char*)es.inizio().string(), (const char*)es.fine().string()); /**/ } riga.fill('_'); set_header(++r, (const char*)riga); @@ -3990,59 +3702,66 @@ void TStampa_bilanci::preprocess_header() else // bilancio di verifica { TString riga (_stampa_width); - TString16 datada = _datada.string(); - TString16 dataa = _dataa.string(); + TString intestazione; + if (_verifica == 1) - set_header(r, TR("STAMPA BILANCIO DI VERIFICA")); - else if (_verifica == 2) - set_header(r, TR("STAMPA SALDI DI MASTRO")); + intestazione = TR("STAMPA BILANCIO DI VERIFICA"); + else + if (_verifica == 2) + intestazione = TR("STAMPA SALDI DI MASTRO"); else { if (_situazione == "C") - set_header(r, TR("SITUAZIONE CONTABILE CLIENTI")); - else if (_situazione == "F") - set_header(r, TR("SITUAZIONE CONTABILE FORNITORI")); - else set_header(r,TR("SITUAZIONE CLIENTI/FORNITORI")); + intestazione = TR("SITUAZIONE CONTABILE CLIENTI"); + else + if (_situazione == "F") + intestazione = TR("SITUAZIONE CONTABILE FORNITORI"); + else + intestazione = TR("SITUAZIONE CLIENTI/FORNITORI"); } - - if (_tipo_stampa1 == 1) + if (_tipo_data == Registrazione) + intestazione << ' ' << TR("PER CASSA"); + else + if (_tipo_data == CostiRicavi) + intestazione << ' ' << TR("PER COMPETENZA COSTI/RICAVI"); + set_header(r, intestazione); + if (_tipo_stampa == 1) { - set_header(r,"@30g%s %s %s %s", TR("dalla data"), (const char*) datada, TR("alla data"), - (const char*) dataa); + set_header(r,"@90g%s %s %s %s", TR("dalla data"), (const char*) _dal.string(), TR("alla data"), + (const char*) _al.string()); //modifica del 20/04/1995 if (_annoes != 0) //se l'anno e' 0 non si considera la competenza { - TString16 d1(InizioEsercizio(_annoes).string()); - TString16 d2(FineEsercizio(_annoes).string()); + const TEsercizio & es = esercizio(_annoes); - set_header(r,"@74g%s %s %s", TR("Esercizio"), (const char*)d1, (const char*)d2); /**/ + set_header(++r, "@101g%s %s %s", TR("Esercizio"), (const char*)es.inizio().string(), (const char*)es.fine().string()); /**/ } } - else if (_tipo_stampa1 == 2) - { - set_header(r,FR("@36gall'ultima immissione Es. %d"), _annoes); - //modifica del 20/04/1995 - TString16 d1(InizioEsercizio(_annoes).string()); - TString16 d2(FineEsercizio(_annoes).string()); + else + if (_tipo_stampa == 2) + { + const TEsercizio & es = esercizio(_annoes); - set_header(r,"@72g%s %s %s", TR("Esercizio"), (const char*)d1, (const char*)d2); /**/ - } + set_header(r,FR("@102gall'ultima immissione Es. %d"), _annoes); + set_header(++r, "@101g%s %s %s", TR("Esercizio"), (const char*)es.inizio().string(), (const char*)es.fine().string()); /**/ + } - if ( (_verifica == 1)||(_verifica == 2) ) + if ((_verifica == 1) || (_verifica == 2)) { if (_stampav == 1) - set_header(r, "@107g%s", TR("Tutti i conti movimentati")); - else if (_stampav == 2) - set_header(r, "@107g%s", TR("Conti con saldo <> 0")); + set_header(++r, "@107g%s", TR("Tutti i conti movimentati")); + else + if (_stampav == 2) + set_header(++r, "@112g%s", TR("Conti con saldo <> 0")); else - set_header(r, "@107g%s", TR("Tutti i conti")); + set_header(++r, "@119g%s", TR("Tutti i conti")); } else { if (_stampac == 1) - set_header(r, "@107g%s", TR("Tutti i conti movimentati")); + set_header(++r, "@107g%s", TR("Tutti i conti movimentati")); else - set_header(r, "@107g%s", TR("Conti con saldo <> 0")); + set_header(++r, "@112g%s", TR("Conti con saldo <> 0")); } riga.fill('_'); set_header(++r, (const char*)riga); @@ -4055,15 +3774,15 @@ void TStampa_bilanci::preprocess_header() else h << "@7g!@46g!@55g"; - if ( ((_datada == _dataini)&&(_tipo_stampa1 == 1))||(_tipo_stampa1 != 1) ) + if ( ((_dal == _dataini) && (_tipo_stampa == 1)) || (_tipo_stampa != 1)) { - if (_tipo_stampa1 == 1 && _datada == _dataini) + if (_tipo_stampa == 1 && _dal == _dataini) h << TR("MOVIMENTI DI APERTURA"); else h << TR(" SALDO INIZIALE"); } else - if (_tipo_stampa1 == 1) + if (_tipo_stampa == 1) h << TR("PROGRESSIVI PRECEDENTI"); h << "@80g!@88g"; h << TR("MOVIMENTI DEL PERIODO"); diff --git a/src/cg/cg1500.h b/src/cg/cg1500.h index f20520d5d..aaa7a3557 100755 --- a/src/cg/cg1500.h +++ b/src/cg/cg1500.h @@ -7,15 +7,13 @@ #define F_BILANCIO 105 #define F_ANNO 106 #define F_STAMPA 107 -#define F_STAMPA1 108 #define F_DATALIM 109 #define F_TOTALI 110 #define F_CODICI 111 #define F_SALDO 112 #define F_VERIFICA 113 #define F_STAMPAV 114 -#define F_DATADA 115 -#define F_DATAA 116 +#define F_DATAINI 115 #define F_SITUAZIONE 118 #define F_STAMPAC 119 #define F_ORDINAMENTO 120 @@ -38,8 +36,9 @@ #define F_PROVVB 142 #define F_PROVVC 143 #ifdef CONT_SEP -#define F_CONTSEP 144 +#define F_CONTSEP 144 #endif +#define F_COMPCR 145 #endif // __CG1500_H diff --git a/src/cg/cg1500a.uml b/src/cg/cg1500a.uml index a479a37c0..5e74050f8 100755 --- a/src/cg/cg1500a.uml +++ b/src/cg/cg1500a.uml @@ -50,157 +50,106 @@ BEGIN CHECKTYPE NORMAL WARNING "L'esercizio non esiste" ADD RUN cg0 -5 esc - MESSAGE EMPTY CLEAR,4@ - MESSAGE ENABLE,4@ END RADIOBUTTON F_BILANCIO 37 BEGIN - PROMPT 2 5 "@bTipo bilancio" + PROMPT 1 5 "@bTipo bilancio" HELP "Indicare il tipo di bilancio da stampare" ITEM "1|Bilancio a sezioni contrapposte" - //MESSAGE HIDE,F_STAMPA1|RESET,F_STAMPA1|HIDE,F_VERIFICA|RESET,F_VERIFICA - //MESSAGE HIDE,F_STAMPAV|RESET,F_STAMPAV|HIDE,F_DATADA|RESET,F_DATADA - //MESSAGE HIDE,F_DATAA|RESET,F_DATAA|HIDE,F_SITUAZIONE|RESET,F_SITUAZIONE - //MESSAGE HIDE,F_ORDINAMENTO|RESET,F_ORDINAMENTO|HIDE,F_STAMPAC|RESET,F_STAMPAC MESSAGE SHOW,1@ MESSAGE HIDE,2@|RESET,2@ - MESSAGE HIDE,96|HIDE,97|HIDE,98|HIDE,99 MESSAGE CLEAR,F_MODULO - //MESSAGE SHOW,F_STAMPA|K_SPACE,F_STAMPA + MESSAGE CLEAR,F_QUADRATURA ITEM "2|Bilancio di verifica" - //MESSAGE HIDE,F_STAMPA|RESET,F_STAMPA - //MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM|HIDE,F_TOTALI|RESET,F_TOTALI - //MESSAGE HIDE,F_CODICI|RESET,F_CODICI|HIDE,F_SALDO|RESET,F_SALDO - //MESSAGE HIDE,F_STAMPAV|RESET,F_STAMPAV MESSAGE HIDE,1@|RESET,1@ MESSAGE SHOW,2@ - //MESSAGE SHOW,F_VERIFICA|K_SPACE,F_VERIFICA|SHOW,F_STAMPA1|K_SPACE,F_STAMPA1 MESSAGE ENABLE,F_MODULO - MESSAGE SHOW,96|SHOW,97|SHOW,98|SHOW,99 END RADIOBUTTON F_STAMPA 28 BEGIN PROMPT 41 5 "@bTipo stampa" HELP "Indicare il tipo di stampa" - GROUP 1 ITEM "1|Per date limite" - MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO + MESSAGE SHOW,F_DATALIM + MESSAGE ENABLE,F_COMPCR #ifdef CONT_SEP MESSAGE SHOW,F_CONTSEP #endif ITEM "2|All'ultima immissione" MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM - MESSAGE SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO + MESSAGE CLEAR,F_COMPCR + MESSAGE CLEAR,F_QUADRATURA #ifdef CONT_SEP MESSAGE HIDE,F_CONTSEP #endif END -RADIOBUTTON F_STAMPA1 28 +DATE F_DATAINI BEGIN - PROMPT 40 5 "@bTipo stampa" - //FLAGS "G" - HELP "Indicare il tipo di stampa" - GROUP 2 - ITEM "1|Per date limite" - MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO -#ifdef CONT_SEP - MESSAGE SHOW,F_CONTSEP -#endif - ITEM "2|All'ultima immissione" - MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO - MESSAGE COPY,F_STAMPA -#ifdef CONT_SEP - MESSAGE HIDE,F_CONTSEP -#endif + PROMPT 2 9 "Data iniziale " + HELP "Data dall quale iniziare la stampa" + END DATE F_DATALIM BEGIN - PROMPT 2 9 "Data limite " + PROMPT 42 9 "Data limite " HELP "Data fino alla quale si vuole la stampa" - GROUP 1 END BOOLEAN F_TOTALI BEGIN - PROMPT 33 9 "Non stampare totali per gruppo " + PROMPT 33 10 "Non stampare totali per gruppo " HELP "Indicare se non si devono stampare i totali dei gruppi" GROUP 1 END +BOOLEAN F_COMPCR +BEGIN + PROMPT 66 10 "Bilancio per competenza costi/ricavi " + HELP "Bilancio per competenza costi/ricavi" + FLAGS "D" +END + BOOLEAN F_CODICI BEGIN - PROMPT 2 10 "Non stampare codici conti " + PROMPT 2 11 "Non stampare codici conti " HELP "Indicare se non si devono stampare i codici dei conti" GROUP 1 END BOOLEAN F_SALDO BEGIN - PROMPT 33 10 "Non stampare movimenti con saldo a zero " + PROMPT 33 11 "Non stampare movimenti con saldo a zero " HELP "Indicare se non si devono stampare i movimenti con saldo nullo" GROUP 1 END -TEXT 96 -BEGIN - PROMPT 2 9 "Dalla data competenza " -END - -TEXT 97 -BEGIN - PROMPT 38 9 "Alla data competenza " -END - -TEXT 98 -BEGIN - PROMPT 2 10 "Dalla data operazione " -END - -TEXT 99 -BEGIN - PROMPT 38 10 "Alla data operazione " -END - -DATE F_DATADA -BEGIN - PROMPT 24 10 "" - HELP "Data dall quale iniziare la stampa" - GROUP 2 -END - -DATE F_DATAA -BEGIN - PROMPT 60 10 "" - GROUP 2 -END - BOOLEAN F_NORMALI BEGIN - PROMPT 2 11 "Movimenti : Normali" + PROMPT 2 12 "Movimenti : Normali" END BOOLEAN F_PROVVM BEGIN - PROMPT 29 11 "Provvisori : Manuali" + PROMPT 29 12 "Provvisori : Manuali" END BOOLEAN F_PROVVB BEGIN - PROMPT 52 11 "Comp. costi/ricavi" + PROMPT 52 12 "Comp. costi/ricavi" END BOOLEAN F_PROVVC BEGIN - PROMPT 73 11 "Cespiti" + PROMPT 73 12 "Cespiti" END LIST F_MODULO 1 12 BEGIN - PROMPT 2 12 "Larghezza modulo di stampa " + PROMPT 2 13 "Larghezza modulo di stampa " HELP "Indicare il numero di caratteri del foglio (larghezza)" ITEM "1|132 colonne" @@ -209,13 +158,13 @@ END BOOLEAN F_QUADRATURA BEGIN - PROMPT 2 13 "Quadratura con Libro Giornale" + PROMPT 2 14 "Quadratura con Libro Giornale" END #ifdef CONT_SEP STRING F_CONTSEP 6 BEGIN - PROMPT 2 14 "Contabilità separata " + PROMPT 2 15 "Contabilità separata " USE &NPENT INPUT CODTAB F_CONTSEP DISPLAY "Codice@6" CODTAB @@ -234,13 +183,9 @@ RADIOBUTTON F_VERIFICA 27 BEGIN PROMPT 2 1 "@bStampa bilancio di verifica " HELP "Tipo di bilancio di verifica" - GROUP 2 - ITEM "1|Bilancio" - MESSAGE SHOW,4@|HIDE,5@|HIDE,6@ - ITEM "2|Saldi di mastro" - MESSAGE SHOW,4@|HIDE,5@|HIDE,6@ - ITEM "3|Situazione C/F" - MESSAGE HIDE,4@|SHOW,5@|SHOW,6@ + ITEM "1|Bilancio" MESSAGE SHOW,4@|HIDE,6@ + ITEM "2|Saldi di mastro" MESSAGE SHOW,4@|HIDE,6@ + ITEM "3|Situazione C/F" MESSAGE HIDE,4@|SHOW,6@ END RADIOBUTTON F_STAMPAC 36 @@ -248,7 +193,8 @@ BEGIN PROMPT 34 1 "@bTipo stampa" ITEM "1|Conti movimentati" ITEM "2|Conti con saldo diverso da zero" - GROUP 4 + GROUP 6 + FLAGS "H" END RADIOBUTTON F_STAMPAV 36 @@ -257,8 +203,7 @@ BEGIN ITEM "1|Conti movimentati" ITEM "2|Conti con saldo diverso da zero" ITEM "3|Tutti i conti" - FLAGS "H" - GROUP 6 + GROUP 4 END BOOLEAN F_SEPARATOR diff --git a/src/cg/cg1600.cpp b/src/cg/cg1600.cpp index f49dc1633..951ee849b 100755 --- a/src/cg/cg1600.cpp +++ b/src/cg/cg1600.cpp @@ -19,8 +19,7 @@ #include "cg1.h" #include "cg1600.h" -#include "cglib01.h" -#include "cglib02.h" +#include "cglib.h" class TRiga_sez_opp : public TObject @@ -35,8 +34,8 @@ public: const char * lettera () { return _str->get(4); } const char * num_rom () { return _str->get(5); } const char * numero () const { return _str->get(6); } - real saldo_conto () const; - real saldo_conto_raf() const; + real saldo_conto () const { return _str->get_real(7); } + real saldo_conto_raf() const { return _str->get_real(8); } void incrementa_saldo(real& nuovo_saldo,real& nuovo_saldo_raf); TRiga_sez_opp(int g, int c, long s, const char * sezione, const char * lettera, @@ -44,23 +43,12 @@ public: virtual ~TRiga_sez_opp(); }; -real TRiga_sez_opp::saldo_conto () const -{ - real r(_str->get(7)); - return r; -} - -real TRiga_sez_opp::saldo_conto_raf () const -{ - real r(_str->get(8)); - return r; -} - void TRiga_sez_opp::incrementa_saldo(real& sld,real& sld_raf) { real sld_prec = saldo_conto(); real sld_prec_raf = saldo_conto_raf(); - sld_prec += sld; + + sld_prec += sld; sld_prec_raf += sld_raf; _str->add(sld_prec.string(), 7); _str->add(sld_prec_raf.string(), 8); @@ -126,13 +114,12 @@ void Righe_sez_opp::add(int g, int c, long s, class TStampa_IVdirettiva : public TPrintapp { - static bool data_limite (TMask_field & f,KEY k); - static bool tipo_stampa (TMask_field & f,KEY k); - static bool data_bil_raff (TMask_field & f,KEY k); - static bool tipo_bilancio (TMask_field & f,KEY k); - static bool data_inizio (TMask_field & f,KEY k); - static bool data_fine (TMask_field & f,KEY k); - static bool anno_esercizio (TMask_field & f,KEY k); + static bool data_limite(TMask_field & f,KEY k); + static bool tipo_stampa(TMask_field & f,KEY k); + static bool data_bil_raff(TMask_field & f,KEY k); + static bool tipo_bilancio(TMask_field & f,KEY k); + static bool data_inizio(TMask_field & f,KEY k); + static bool anno_esercizio(TMask_field & f,KEY k); struct bil_ivd { @@ -162,10 +149,11 @@ class TStampa_IVdirettiva : public TPrintapp TParagraph_string* _descr,*_d; TSaldo* _sld; bool _noseparator; + TTipo_data _tipo_data; - TDate _data_fine_ese,_data_fine_ese_prec,_data_fine_raf,_data_fine_raf_prec; + TDate _data_fine_es,_data_fine_ese_prec,_data_fine_raf,_data_fine_raf_prec; TDate _datastampa,_datalimite,_databilrafr,_datai,_datairaf; - TDate _dataini,_datafine,_data_ini_ese,_data_ini_raf; + TDate _datainizio,_data_inizio_es,_data_inizio_raf; int _annoese,_annoeserafr,_anno_esercizio,_anno_esercizio_raf; bool _competenza,_intera_struttura,_stampamov,_stampacod,_stampa_modulo; bool _sbilancio_patr_gia_stampato,_attivo_o_passivo; @@ -206,15 +194,11 @@ class TStampa_IVdirettiva : public TPrintapp TString tmp; // Stringa per porcate galattiche protected: - void aggiungi_anno(int anno, TDate& inizio, TDate& fine); - virtual void on_config_change(); + virtual void on_config_change() { _prima_dopo = ini_get_bool(CONFIG_DITTA, "cg1600", "PrimaDopoImposte"); } public: - - TDate _inizioEs, _fineEs; - int date2esc(const TDate& d); - void esc2date(const int anno, TDate& d1, TDate& d2); + // void esc2date(const int anno, TDate& d1, TDate& d2); bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; } virtual bool user_create() ; @@ -223,8 +207,8 @@ public: virtual bool preprocess_page (int,int); virtual print_action postprocess_page (int,int); - virtual void postclose_print (); - + virtual void postclose_print() { safe_delete(_sort); } + virtual void set_page(int,int); bool preprocess_stampa_scalare(int); @@ -250,7 +234,7 @@ public: void stampa_totali_con_raffronto(); void stampa_totali_verifica(); bool calcola_saldo(real&, real&,int,int,long,int); - bool calcola(int,int,long,const TDate&,const TDate&); + bool calcola(int g, int c, long s, const TDate& fine_es, const TDate& fine_es_prec, const char * filter = ""); bool sottoc_clifo_scalare (int,int,int,int,real&,real&); void sottoc_clifo_verifica(int,int,int,char,TString&,TString&,TString&, TString&,int,bool); void stampa_saldo_132(const real&); @@ -268,35 +252,7 @@ public: TStampa_IVdirettiva() {} }; -HIDDEN inline TStampa_IVdirettiva & a() {return (TStampa_IVdirettiva&) main_app(); } - -void TStampa_IVdirettiva::postclose_print() -{ - delete _sort; -} - -void TStampa_IVdirettiva::aggiungi_anno(int anno, TDate& inizio, TDate& fine) -{ - TEsercizi_contabili ese; - if (ese.exist(anno)) - { - inizio = ese[anno].inizio(); - fine = ese[anno].fine(); - } - else - inizio = fine = botime; -} - -int TStampa_IVdirettiva::date2esc(const TDate& d) -{ - TEsercizi_contabili ese; - return ese.date2esc(d); -} - -void TStampa_IVdirettiva::on_config_change() -{ - _prima_dopo = ini_get_bool(CONFIG_DITTA, "cg1600", "PrimaDopoImposte"); -} +HIDDEN inline TStampa_IVdirettiva & app() {return (TStampa_IVdirettiva&) main_app(); } void TStampa_IVdirettiva::set_bil_key(bil_ivd* b, char sezione, char lettera, const char* numero_romano, const char * numero, @@ -358,147 +314,136 @@ bool TStampa_IVdirettiva::data_limite (TMask_field& f, KEY key) if (key == K_ENTER) { TMask& m = f.mask(); - int tipobil,tipostampa; - TDate datalim; - TDate in="", fin=""; - - tipobil = m.get_int(F_TIPOBIL); - tipostampa = m.get_int(F_TIPOSTAMPA); - int annoese = m.get_int(F_ANNOESE); + TDate datalim = m.get_date(F_DATALIM); + const int tipostampa = m.get_int(F_TIPOSTAMPA); + const int annoese = m.get_int(F_ANNOESE); - if ((tipobil == 1) && (tipostampa == 1)) + if (tipostampa == 1) { - datalim = m.get(F_DATALIM); - - if (annoese != 0) + if (esercizi().exist(annoese)) { - a().aggiungi_anno(annoese, in, fin); - a()._data_ini_ese = in; - a()._data_fine_ese = fin; - - a()._anno_esercizio = annoese; + const TEsercizio & es = esercizio(annoese); + app()._data_inizio_es = es.inizio(); + app()._data_fine_es = es.fine(); + app()._anno_esercizio = annoese; if (datalim == botime) - a()._datalimite = a()._data_fine_ese; + app()._datalimite = app()._data_fine_es; else - if ((datalim < in)||(datalim > fin)) + if (esercizio(datalim).codice() != annoese) return f.error_box(TR("La data limite non appartiene all'esercizio indicato")); else - a()._datalimite = datalim; + app()._datalimite = datalim; } else if (annoese == 0) { - if (datalim == botime) + const TDate dataini = m.get_date(F_DATAINI); + + if (dataini.ok() && esercizi().exist(dataini)) + f.set(datalim = esercizio(dataini).fine()); + if (!datalim.ok()) return f.error_box(TR("La data limite deve essere indicata obbligatoriamente")); - int anno = a().date2esc(datalim); - - if (anno == 0) + if (!esercizi().exist(datalim)) return f.error_box(TR("La data limite indicata non appartiene ad alcun esercizio attivo della ditta")); - a()._data_ini_ese = a()._inizioEs; - a()._data_fine_ese = a()._fineEs; - - a()._datalimite = datalim; - a()._anno_esercizio = anno; + + const TEsercizio & es = esercizio(datalim); + + app()._data_inizio_es = es.inizio(); + app()._data_fine_es = es.fine(); + app()._datalimite = datalim; + app()._anno_esercizio = es.codice(); } } } - TString data1 = a()._datalimite.string(); - TString data2 = a()._data_ini_ese.string(); - TString data3 = a()._data_fine_ese.string(); return true; } bool TStampa_IVdirettiva::data_bil_raff (TMask_field& f, KEY key) { - TMask& m = f.mask(); - int tipobil,tipostampa; - TDate datalim, dataraf; - TDate in = "", fin = "", in_raf = "", fin_raf = ""; - if (key == K_ENTER) { - tipobil = atoi(m.get(F_TIPOBIL)); - tipostampa = atoi(m.get(F_TIPOSTAMPA)); + TMask & m = f.mask(); + const int tipobil = atoi(m.get(F_TIPOBIL)); + const int tipostampa = atoi(m.get(F_TIPOSTAMPA)); int annoese = m.get_int(F_ANNOESE); - int annoraf = m.get_int(F_ANNORAFFR); + const int annoraf = m.get_int(F_ANNORAFFR); - if (tipobil == 1) + if (annoese == 0) + annoese = esercizio(TDate(TODAY)).codice(); + + const TEsercizio & es = esercizio(annoese); + + app()._data_inizio_es = es.inizio(); + app()._data_fine_es = es.fine(); + if (tipobil == 1) { - dataraf = m.get(F_DATABILRAF); + const TDate dataraf = m.get_date(F_DATABILRAF); + const TDate datalim = m.get_date(F_DATALIM); - datalim = m.get(F_DATALIM); - - if (annoraf == 0) + if (annoraf == 0) { - int anno; - - if (datalim != botime) - { - a().date2esc(datalim); - in = a()._inizioEs; - } - else - a().aggiungi_anno(annoese, in, fin); - - TString instr = in.string(); - if (dataraf != botime) - { - anno = a().date2esc(dataraf); - in_raf = a()._inizioEs; - fin_raf = a()._fineEs; - a()._anno_esercizio_raf = anno; - } - else - anno = 1; - if (dataraf > in) - return f.error_box(TR("La data bilancio da raffrontare non puo' essere maggiore o uguale alla data inizio esercizio in corso")); - if (anno == 0) - return f.error_box(TR("La data bilancio da raffrontare indicata non appartiene ad alcun esercizio attivo della ditta")); - + const TDate inizio = datalim != botime ? esercizio(datalim).inizio(): esercizio(annoese).inizio(); - a()._databilrafr = dataraf; - a()._data_ini_raf = in_raf; - a()._data_fine_raf = fin_raf; + if (dataraf > inizio) + return f.error_box(TR("La data bilancio da raffrontare non puo' essere maggiore o uguale alla data inizio esercizio in corso")); + if (dataraf.ok()) + { + const TEsercizio & esraf = esercizio(dataraf); + + app()._anno_esercizio_raf = esraf.codice(); + app()._databilrafr = dataraf; + app()._data_inizio_raf = esraf.inizio(); + app()._data_fine_raf = esraf.fine(); + } + else + { + app()._anno_esercizio_raf = 0; + app()._databilrafr = botime; + app()._data_inizio_raf = botime; + app()._data_fine_raf = eotime; + } } else - { - a().aggiungi_anno(annoraf, in_raf, fin_raf); - a()._data_ini_raf = in_raf; - a()._data_fine_raf = fin_raf; - a().aggiungi_anno(annoese,a()._data_ini_ese,a()._data_fine_ese); - - if (dataraf == botime) - a()._databilrafr = fin_raf; + { + if (esercizi().exist(annoraf)) + { + const TEsercizio & esraf = esercizio(annoraf); - else - if (dataraf < in_raf || dataraf > fin_raf) - return f.error_box(TR("La data bilancio da raffrontare deve appartenere all' esercizio da raffrontare")); - else - a()._databilrafr = dataraf; - a()._anno_esercizio_raf = annoraf; + app()._data_inizio_raf = esraf.inizio(); + app()._data_fine_raf = esraf.fine(); + + if (dataraf == botime) + app()._databilrafr = app()._data_fine_raf; + + else + if (dataraf < app()._data_inizio_raf || dataraf > app()._data_fine_raf) + return f.error_box(TR("La data bilancio da raffrontare deve appartenere all' esercizio da raffrontare")); + else + app()._databilrafr = dataraf; + app()._anno_esercizio_raf = annoraf; + } + else + { + app()._anno_esercizio_raf = 0; + app()._databilrafr = botime; + app()._data_inizio_raf = botime; + app()._data_fine_raf = eotime; + } } } } // IF (key == K_ENTER) - TString data1 = in.string(); - TString data2 = in_raf.string(); - TString data3 = fin_raf.string(); - TString data4 = a()._databilrafr.string(); - TString data5 = a()._data_ini_raf.string(); - TString data6 = a()._data_fine_raf.string(); return true; } bool anno_ese_raff (TMask_field& f, KEY key) { - int annoese, annoraf, anno; - TDate datalim; - if (key == K_ENTER) { - annoese = f.mask().get_int(F_ANNOESE); - annoraf = f.mask().get_int(F_ANNORAFFR); + TMask & m = f.mask(); + const int annoese = m.get_int(F_ANNOESE); + const int annoraf = m.get_int(F_ANNORAFFR); if (annoraf != 0) { @@ -511,15 +456,10 @@ bool anno_ese_raff (TMask_field& f, KEY key) else if (annoese == 0) { - datalim = f.mask().get(F_DATALIM); + const TDate datalim = m.get_date(F_DATALIM); - if (datalim != botime) - { - anno = a().date2esc(datalim); - - if (annoraf >= anno) + if (datalim.ok() && annoraf >= esercizio(datalim).codice()) return f.error_box(TR("L' anno esercizio da raffrontare deve essere inferiore all' anno di esercizio di appartenenza della data limite")); - } } } } @@ -528,141 +468,42 @@ bool anno_ese_raff (TMask_field& f, KEY key) bool TStampa_IVdirettiva::tipo_bilancio (TMask_field& f, KEY key) { - int tipo_bil, anno, tipo_stampa; - if (key == K_SPACE) { - tipo_bil = f.mask().get_int(F_TIPOBIL); - if (tipo_bil == 1) - tipo_stampa = f.mask().get_int(F_TIPOSTAMPA); - else - tipo_stampa = f.mask().get_int(F_TIPOSTAMPA1); - anno = f.mask().get_int(F_ANNOESE); - if (tipo_bil == 1) - { - f.mask().hide (98); - f.mask().hide (99); - f.mask().hide(96); - f.mask().hide(97); - } - else - if (tipo_bil == 2) - { - if (tipo_stampa == 1) - { - if (anno != 0) - { - f.mask().show (96); - f.mask().show (97); - f.mask().hide (98); - f.mask().hide (99); - } - else - if (anno == 0) - { - f.mask().show(98); - f.mask().show(99); - f.mask().hide(96); - f.mask().hide(97); - } - } - else - { - f.mask().hide (98); - f.mask().hide (99); - f.mask().hide(96); - f.mask().hide(97); - } - } - if (tipo_bil == 2 && tipo_stampa == 1 && f.mask().get_int(F_ANNOESE) == 0) - f.mask().show(F_QUADRATURA); - else - f.mask().hide(F_QUADRATURA); + TMask & m = f.mask(); + const int tipo_bil = m.get_int(F_TIPOBIL); + const int tipo_stampa = m.get_int(F_TIPOSTAMPA); + const int anno = m.get_int(F_ANNOESE); + + m.show(F_DATAINI, tipo_bil == 2 && tipo_stampa == 1); + m.show(F_QUADRATURA, tipo_bil == 2 && tipo_stampa == 1 && m.get_int(F_ANNOESE) == 0); } return true; } bool TStampa_IVdirettiva::anno_esercizio (TMask_field& f, KEY key) { - int tipo_bil, anno; - - if (key == K_TAB || f.focusdirty()) - { - int tipo_stp; - - tipo_bil = f.mask().get_int(F_TIPOBIL); - anno = f.mask().get_int(F_ANNOESE); - if (tipo_bil == 1) - tipo_stp = f.mask().get_int(F_TIPOSTAMPA); - else - tipo_stp = f.mask().get_int(F_TIPOSTAMPA1); - if (tipo_bil == 1) - { - f.mask().hide (98); - f.mask().hide (99); - f.mask().hide(96); - f.mask().hide(97); - } - else - if (tipo_bil == 2) - { - if (tipo_stp == 1) - { - if (anno != 0) - { - f.mask().show (96); - f.mask().show (97); - f.mask().hide (98); - f.mask().hide (99); - } - else - if (anno == 0) - { - f.mask().show(98); - f.mask().show(99); - f.mask().hide(96); - f.mask().hide(97); - } - } - else - { - f.mask().hide (98); - f.mask().hide (99); - f.mask().hide(96); - f.mask().hide(97); - } - } - } - - if (key == K_TAB) + if (f.running_check(key)) { - int tipo_bil, tipo_stp; - tipo_bil = f.mask().get_int(F_TIPOBIL); - if (tipo_bil == 1) - tipo_stp = f.mask().get_int(F_TIPOSTAMPA); - else - tipo_stp = f.mask().get_int(F_TIPOSTAMPA1); - if (tipo_bil == 2 && tipo_stp == 1 && f.mask().get_int(F_ANNOESE) == 0) - f.mask().show(F_QUADRATURA); - else - { - f.mask().set (F_QUADRATURA,""); - f.mask().hide(F_QUADRATURA); - } + TMask & m = f.mask(); + const int tipo_bil = m.get_int(F_TIPOBIL); + const int tipo_stampa = m.get_int(F_TIPOSTAMPA); + const int anno = m.get_int(F_ANNOESE); + + m.show(F_DATAINI, tipo_bil == 2 && tipo_stampa == 1); + m.show(F_QUADRATURA, tipo_bil == 2 && tipo_stampa == 1 && m.get_int(F_ANNOESE) == 0); } - + return true; } bool TStampa_IVdirettiva::tipo_stampa(TMask_field& f,KEY k) { - int tipo_bil, tipo_stampa; - if (k == K_ENTER) { - tipo_stampa = f.mask().get_int(F_TIPOSTAMPA); - - int anno = f.mask().get_int(F_ANNOESE); + TMask & m = f.mask(); + const int tipo_stampa = m.get_int(F_TIPOSTAMPA); + const int anno = m.get_int(F_ANNOESE); if (tipo_stampa == 2) if (anno == 0) @@ -672,178 +513,81 @@ bool TStampa_IVdirettiva::tipo_stampa(TMask_field& f,KEY k) } } if (k == K_SPACE) - { - int anno = f.mask().get_int(F_ANNOESE); - tipo_bil = f.mask().get_int(F_TIPOBIL); - if (tipo_bil == 1) - tipo_stampa = f.mask().get_int(F_TIPOSTAMPA); - else - tipo_stampa = f.mask().get_int(F_TIPOSTAMPA1); - - if (tipo_bil == 1) - { - f.mask().hide (98); - f.mask().hide (99); - f.mask().hide(96); - f.mask().hide(97); - } - else - if (tipo_bil == 2) - { - if (tipo_stampa == 1) - { - if (anno != 0) - { - f.mask().show (96); - f.mask().show (97); - f.mask().hide (98); - f.mask().hide (99); - } - else - if (anno == 0) - { - f.mask().show(98); - f.mask().show(99); - f.mask().hide(96); - f.mask().hide(97); - } - } - else - { - f.mask().hide (98); - f.mask().hide (99); - f.mask().hide(96); - f.mask().hide(97); - } - } - - if (tipo_bil == 2 && tipo_stampa == 1 && f.mask().get_int(F_ANNOESE) == 0) - f.mask().show(F_QUADRATURA); - else - f.mask().hide(F_QUADRATURA); + { + TMask & m = f.mask(); + const int anno = m.get_int(F_ANNOESE); + const int tipo_bil = m.get_int(F_TIPOBIL); + const int tipo_stampa = m.get_int(F_TIPOSTAMPA); + + m.show(F_DATAINI, tipo_bil == 2 && tipo_stampa == 1); + m.show(F_QUADRATURA, tipo_bil == 2 && tipo_stampa == 1 && m.get_int(F_ANNOESE) == 0); } - return true; } bool TStampa_IVdirettiva::data_inizio(TMask_field& f, KEY k) { - int anno; - TDate data; - TDate in="", fin=""; - anno = f.mask().get_int(F_ANNOESE); - data = f.mask().get (F_DATAINI); - //a()._anno_esercizio = anno; - if (k == K_ENTER) { - if (anno != 0) - { - a().aggiungi_anno(anno, in, fin); - a()._data_ini_ese = in; - a()._data_fine_ese = fin; - a()._anno_esercizio = anno; + TMask & m = f.mask(); + int anno = m.get_int(F_ANNOESE); + TDate data = f.get_date(); + const TDate datalim = m.get_date(F_DATALIM); - if (data == botime) - a()._dataini = in; + if (!data.ok() && datalim.ok() && esercizi().exist(datalim)) + { + f.set(data = esercizio(datalim).inizio()); + anno = esercizio(datalim).codice(); + } + if (esercizi().exist(anno)) + { + const TEsercizio & es = esercizio(anno); + + app()._data_inizio_es = es.inizio(); + app()._data_fine_es = es.fine(); + app()._anno_esercizio = anno; + + if (!data.ok()) + app()._datainizio = app()._data_inizio_es; else { - if (data < in || data > fin) + if (data < app()._data_inizio_es || data > app()._data_fine_es) return f.error_box(TR("La data non appartiene all' esercizio indicato")); else - a()._dataini = data; + app()._datainizio = data; } } else { - if (data == botime) - return f.error_box(TR("La data deve essere obbligatoriamente indicata")); + if (!data.ok()) + return f.error_box(TR("La data iniziale deve essere obbligatoriamente indicata")); + if (esercizi().exist(data)) + { + const TEsercizio & es = esercizio(data); - int anno = a().date2esc(data); - - if (anno == 0) - return f.error_box(TR("La data limite indicata non appartiene ad alcun esercizio attivo della ditta")); - a()._anno_esercizio = anno; - a()._dataini = data; - a()._data_ini_ese = a()._inizioEs; - a()._data_fine_ese = a()._fineEs; + app()._anno_esercizio = es.codice(); + app()._datainizio = data; + app()._data_inizio_es = es.inizio(); + app()._data_fine_es = es.fine(); + } + else + return f.error_box(TR("La data limite indicata non appartiene ad alcun esercizio attivo della ditta")); } } return true; } -bool TStampa_IVdirettiva::data_fine(TMask_field& f, KEY k) -{ - TMask& m = f.mask(); - int annoes; - TDate data, data_ini; - TDate in="", fin=""; - - annoes = m.get_int(F_ANNOESE); - data = m.get (F_DATAFINE); - data_ini = m.get (F_DATAINI); - - if (k == K_TAB) - { - TDate data (f.get()); - int bil = m.get_int(F_TIPOBIL); - int anno = a().date2esc(data); - - TDate dataini, datafin; - a().aggiungi_anno(anno, dataini, datafin); - - if (data == datafin && bil == 2 && annoes == 0) - m.show(F_QUADRATURA); - else - m.hide(F_QUADRATURA); - } - - if (k == K_ENTER) - { - if (annoes != 0) - { - a().aggiungi_anno(annoes, in, fin); - a()._data_ini_ese = in; - a()._data_fine_ese = fin; - - if (data == botime) - a()._datafine = fin; - else - if (data < in || data > fin) - return f.error_box(TR("La data non appartiene all' esercizio indicato")); - else - a()._datafine = data; - } - else - { - if (data == botime) - return f.error_box(TR("La data deve essere obbligatoriamente indicata")); - a().date2esc(data_ini); - if (data < a()._inizioEs || data > a()._fineEs) - return f.error_box(TR("La data non appartiene all' esercizio indicato")); - a()._datafine = data; - } - if (data < data_ini) - return f.error_box(TR("La data finale non puo' essere inferiore alla data di partenza")); - } - - return true; -} - void TStampa_IVdirettiva::scrivi_record(const TString& sez, const TString& let, const TString& numerorom,const TString & numero, int g,int c,long s,const real& saldo,const real& saldorafr, const real& sld_dare,const real& sld_avere, const real& mov_dare,const real& mov_avere,char tipocf,bool conto_dettagliato) { - //Se esiste solamente la sezione,significa che e' un conto d'ordine //Forzo la lettera della classe a Z, per ottenere, grazie //all'ordinamento del sort, i record dei conti d'ordine per ultimi - if (sez == "9" && let == "E") - int i = 1; set_bil_key(_bil, sez[0], let[0], numerorom, numero, true, g, c, s, tipocf); set_bil_val(_bil, saldo, saldorafr, sld_dare, sld_avere, mov_dare, mov_avere,conto_dettagliato); _sort->sort ((const char*) _bil); @@ -855,10 +599,8 @@ void TStampa_IVdirettiva::riempi_record(const TString& sez, const real& sld_dare,const real& sld_avere, const real& mov_dare,const real& mov_avere,char tipocf,bool conto_dettagliato) { - if (!(_stampamov && saldo.is_zero() && saldorafr.is_zero())) + if (_stampamov || saldo != ZERO || saldorafr != ZERO) { - if (sez == "9" && let == "E") - int i = 1; set_bil_key(_bil, sez[0], let[0], numerorom, numero, false, g, c, s, tipocf); set_bil_val(_bil, saldo, saldorafr, sld_dare, sld_avere, mov_dare, mov_avere,conto_dettagliato); _sort->sort ((const char*) _bil); @@ -1343,9 +1085,7 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_verifica() sld_prg_avere_conto = ZERO; mov_dare_conto = ZERO; mov_avere_conto = ZERO; - _nuovo_tot_saldo_d = ZERO; - _nuovo_tot_saldo_a = ZERO; - + indbil = 0; gruppo_prec = -1; conto_prec = -1; @@ -1455,57 +1195,56 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_verifica() if (_tipo_stampa == 1) { - if(!calcola(g,c,s,_data_fine_ese,_data_fine_ese_prec)) - continue; - - if (_dataini == _data_ini_ese) - { - sld_prg_dare = _saldo_ini_dare; - sld_prg_avere = _saldo_ini_avere; - mov_dare = _mov_periodo_dare; - mov_avere = _mov_periodo_avere; - saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere; - - } - else - if (_dataini > _data_ini_ese) - { - sld_prg_dare = _prg_prec_dare; - sld_prg_avere = _prg_prec_avere; - mov_dare = _mov_periodo_dare; - mov_avere = _mov_periodo_avere; - saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere; + if (calcola(g, c, s, _data_fine_es, _data_fine_ese_prec)) + { + if (_datainizio == _data_inizio_es) + { + sld_prg_dare = _saldo_ini_dare; + sld_prg_avere = _saldo_ini_avere; + mov_dare = _mov_periodo_dare; + mov_avere = _mov_periodo_avere; + saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere; } + else + if (_datainizio > _data_inizio_es) + { + sld_prg_dare = _prg_prec_dare; + sld_prg_avere = _prg_prec_avere; + mov_dare = _mov_periodo_dare; + mov_avere = _mov_periodo_avere; + saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere; + } + } } else - if (_tipo_stampa == 2) + if (_tipo_stampa == 2) { - if (!_sld->ultima_immissione_verifica(_anno_esercizio, g, c, s, indbil, _stampa_mov_prov) && (!_intera_struttura || (_stampamov))) - continue; - real saldoini = _sld->saldoini(); - //fine modifica 11/11/1997 + if (_sld->ultima_immissione_verifica(_anno_esercizio, g, c, s, indbil, _stampa_mov_prov) && (!_intera_struttura || (_stampamov))) + { + real saldoini = _sld->saldoini(); - if (saldoini > ZERO) - { - sld_prg_dare = saldoini; - sld_prg_avere = ZERO; + //fine modifica 11/11/1997 + if (saldoini > ZERO) + { + sld_prg_dare = saldoini; + sld_prg_avere = ZERO; + } + else + { + sld_prg_dare = ZERO; + sld_prg_avere = -saldoini; + } + mov_dare = _sld->prgdare(); + mov_avere = _sld->prgavere(); + saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere; } - else - { - sld_prg_dare = ZERO; - sld_prg_avere = -saldoini; - } - mov_dare = _sld->prgdare(); - mov_avere = _sld->prgavere(); - saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere; } - if (classe_conto) { if (conto_dettagliato) riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tmcf); - if (!(saldo.is_zero() && _stampamov))//Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto + if (saldo != ZERO || _stampamov) //Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto { saldo_conto += saldo; sld_prg_dare_conto += sld_prg_dare; @@ -1588,26 +1327,27 @@ void TStampa_IVdirettiva::sottoc_clifo_verifica(int g,int c,int anno,char tipocf if (_tipo_stampa == 1) { - if (!calcola(g,c,s,_data_fine_ese,_data_fine_ese_prec)) - continue; + if (calcola(g, c, s, _data_fine_es, _data_fine_ese_prec)) + { + if (_datainizio == _data_inizio_es) + { + sld_prg_dare = _saldo_ini_dare; + sld_prg_avere = _saldo_ini_avere; + mov_dare = _mov_periodo_dare; + mov_avere = _mov_periodo_avere; + saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere; - if (_dataini == _data_ini_ese) - { - sld_prg_dare = _saldo_ini_dare; - sld_prg_avere = _saldo_ini_avere; - mov_dare = _mov_periodo_dare; - mov_avere = _mov_periodo_avere; - saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere; - - } - else if (_dataini > _data_ini_ese) - { - sld_prg_dare = _prg_prec_dare; - sld_prg_avere = _prg_prec_avere; - mov_dare = _mov_periodo_dare; - mov_avere = _mov_periodo_avere; - saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere; - } + } + else + if (_datainizio > _data_inizio_es) + { + sld_prg_dare = _prg_prec_dare; + sld_prg_avere = _prg_prec_avere; + mov_dare = _mov_periodo_dare; + mov_avere = _mov_periodo_avere; + saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere; + } + } } else if (_tipo_stampa == 2) @@ -1635,12 +1375,11 @@ void TStampa_IVdirettiva::sottoc_clifo_verifica(int g,int c,int anno,char tipocf mov_dare = _sld->prgdare(); mov_avere = _sld->prgavere(); saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere; - } if (stsottbil) riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tipocf); - if (!(saldo == ZERO && _stampamov)) //Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto + if (saldo != ZERO || _stampamov) //Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto { saldo_conto += saldo; sld_prg_dare_conto += sld_prg_dare; @@ -1664,12 +1403,14 @@ bool TStampa_IVdirettiva::sottoc_clifo_scalare(int g,int c,int anno,int indbil,r { long s; int aep = 0; + if (anno > 0) { TEsercizi_contabili ec; aep = ec.pred(anno); } _listasld = new TSaldi_list (g,c,anno,aep); + real saldo,saldo_raf; bool trovato = false; @@ -1706,14 +1447,13 @@ bool TStampa_IVdirettiva::calcola_saldo(real& saldo, real& saldo_raf,int g,int c bool no_movimentato_raf = true; bool esiste = false; TString saldostr,saldo_rafstr; - + _sld->set_annoes(_anno_esercizio); - if (_tipo_bilancio == 1) { if (_tipo_stampa == 1) //bilancio per data limite { - esiste = _sld->data_limite_bilancio(_tipo_stampa,g,c,s,_datai,_datalimite,indbil,_stampa_mov_prov); + esiste = _sld->data_limite_bilancio(_tipo_data, g, c, s, _datai, _datalimite, indbil, _stampa_mov_prov); saldo = _sld->saldo(); if (!esiste && (!_sld->esiste_saldo() || !_sld->significativo())) @@ -1739,20 +1479,21 @@ bool TStampa_IVdirettiva::calcola_saldo(real& saldo, real& saldo_raf,int g,int c no_movimentato = false; } } - else if (_tipo_stampa == 2) - { - if (!_sld->ultima_immissione_bilancio(_anno_esercizio,g,c,s,indbil,_stampa_mov_prov)) - { - if (!_sld->esiste_saldo() || !_sld->significativo()) - no_movimentato = true; - else - no_movimentato = false; - } - else - no_movimentato = false; + else + if (_tipo_stampa == 2) + { + if (!_sld->ultima_immissione_bilancio(_anno_esercizio,g,c,s,indbil,_stampa_mov_prov)) + { + if (!_sld->esiste_saldo() || !_sld->significativo()) + no_movimentato = true; + else + no_movimentato = false; + } + else + no_movimentato = false; - saldo = _sld->saldo(); - } + saldo = _sld->saldo(); + } saldostr = saldo.string(); if (_annoeserafr != 0 || _databilrafr != botime) @@ -1761,7 +1502,7 @@ bool TStampa_IVdirettiva::calcola_saldo(real& saldo, real& saldo_raf,int g,int c if (_databilrafr != _data_fine_raf) //(_tipo_stampa == 1) bilancio per data limite { - esiste = _sld->data_limite_bilancio(DataLimite,g,c,s,_datairaf,_databilrafr,indbil,_stampa_mov_prov); + esiste = _sld->data_limite_bilancio(_tipo_data, g, c, s, _datairaf, _databilrafr, indbil, _stampa_mov_prov); saldo_raf = _sld->saldo(); if (!esiste && (!_sld->esiste_saldo() || !_sld->significativo())) @@ -1787,24 +1528,24 @@ bool TStampa_IVdirettiva::calcola_saldo(real& saldo, real& saldo_raf,int g,int c no_movimentato_raf = false; } } - else if (_databilrafr == _data_fine_raf) - { - if (!_sld->ultima_immissione_bilancio(_anno_esercizio_raf,g,c,s,indbil,_stampa_mov_prov, false)) // W96SALDI : ho aggiunto il parametro false - { // per dire che nel calcola del saldo non deve - if (!_sld->esiste_saldo() || !_sld->significativo()) // includere il saldo di chiusura - no_movimentato_raf = true; - else - no_movimentato_raf = false; - } - else - no_movimentato_raf = false; + else + if (_databilrafr == _data_fine_raf) + { + if (!_sld->ultima_immissione_bilancio(_anno_esercizio_raf,g,c,s,indbil,_stampa_mov_prov, false)) // W96SALDI : ho aggiunto il parametro false + { // per dire che nel calcola del saldo non deve + if (!_sld->esiste_saldo() || !_sld->significativo()) // includere il saldo di chiusura + no_movimentato_raf = true; + else + no_movimentato_raf = false; + } + else + no_movimentato_raf = false; - saldo_raf = _sld->saldo(); - } + saldo_raf = _sld->saldo(); + } saldo_rafstr = saldo_raf.string(); } } - if ((no_movimentato) && (no_movimentato_raf)) return false; else @@ -1812,18 +1553,9 @@ bool TStampa_IVdirettiva::calcola_saldo(real& saldo, real& saldo_raf,int g,int c } bool TStampa_IVdirettiva::calcola(int g, int c, long s, - const TDate& fine_es, const TDate& fine_es_prec) + const TDate& fine_es, const TDate& fine_es_prec, const char * filter) { - TLocalisamfile rmov(LF_RMOV); - TLocalisamfile mov(LF_MOV); TDecoder causali(LF_CAUSALI, CAU_MOVAP); - - TString sezione; - real importo; - int annoe; - long num_reg; - TString4 provvis; - TDate datareg, datacomp, data; bool conto_mov = false; _mov_periodo_dare = ZERO; @@ -1833,89 +1565,75 @@ bool TStampa_IVdirettiva::calcola(int g, int c, long s, _saldo_ini_dare = ZERO; _saldo_ini_avere = ZERO; - rmov.setkey(2); - rmov.zero(); + TCursor cur(new TRelation(LF_RMOV), filter, 2); + TRectype& rmov = cur.file().curr(); + rmov.put(RMV_GRUPPO, g); - if (c != 0) - rmov.put(RMV_CONTO, c); - if (s != 0) - rmov.put(RMV_SOTTOCONTO, s); - TRectype rec(rmov.curr()); + rmov.put(RMV_CONTO, c); + rmov.put(RMV_SOTTOCONTO, s); + cur.setregion(rmov, rmov); - rmov.read(_isgteq); - for (; !rmov.eof(); rmov.next()) + const TRecnotype items = cur.items(); + + cur.freeze(); + + for (cur = 0L; cur.pos() < items; ++cur) { - if (rmov.curr() != rec) break; - - annoe = rmov.get_int(RMV_ANNOES); - datareg = rmov.get_date(RMV_DATAREG); - num_reg = rmov.get_long(RMV_NUMREG); - sezione = rmov.get(RMV_SEZIONE); - importo = rmov.get_real(RMV_IMPORTO); - - mov.setkey(1); - mov.zero(); - mov.put(MOV_NUMREG, num_reg); - mov.read(); - if (mov.bad()) mov.zero(); - provvis = mov.get(MOV_PROVVIS); - datacomp = mov.get_date(MOV_DATACOMP); - + const int annoe = rmov.get_int(RMV_ANNOES); + const long numreg = rmov.get_long(RMV_NUMREG); + const TRectype& mov = cache().get(LF_MOV, numreg); + const TString4 sezione = rmov.get(RMV_SEZIONE); + const real importo = rmov.get_real(RMV_IMPORTO); + const TString4 provvis = mov.get(MOV_PROVVIS); const TString& codcaus = mov.get(MOV_CODCAUS); - char movap = causali.decode(codcaus)[0]; - movap = toupper(movap); + const char movap = toupper(causali.decode(codcaus)[0]); if (movap == 'C' && // la causale e' di chiusura !_quadratura) // Non e' richiesta la quadratura con il Libro Giornale (Modifica continue; // del 18-06-96 richiesta da Patrizia in seguito alla modifica dei SALDI - - if (_annoese == 0) - data = datareg; - if (_annoese != 0) - data = datacomp; - if (importo == ZERO) continue; //calcolo i movimenti del periodo - if ((data >= _dataini) && (data <= _datafine)) - if ((movap == 'A' && _data_ini_ese != _dataini) || (movap != 'A')) - if (((_stampa_mov_prov & 0x1) && provvis.blank()) || - ((_stampa_mov_prov & 0x2) && ((provvis == "P") || (provvis == "N"))) || - ((_stampa_mov_prov & 0x4) && (provvis == "B")) || ((_stampa_mov_prov & 0x8) && (provvis == "C"))) + const TDate data = get_date_mov(mov, _tipo_data); + + if (data.ok() && (data >= _datainizio) && (data <= _datalimite)) + if ((movap == 'A' && _data_inizio_es != _datainizio) || (movap != 'A')) + if (check_mov(_stampa_mov_prov, provvis)) { conto_mov = true; if (sezione == "D") _mov_periodo_dare += importo; - else _mov_periodo_avere += importo; + else + _mov_periodo_avere += importo; } //il saldo inizio es. e' dato dall'importo dare - importo avere di quei movimenti che hanno causale == apertura e data reg >= data inizio es. e <= data limite sup. - if (_dataini == _data_ini_ese) //calcolo il saldo iniziale + if (_datainizio == _data_inizio_es) //calcolo il saldo iniziale { if ((_stampa_mov_prov & 0x1) && (movap == 'A')) { - if (data >= _data_ini_ese && data <= _datafine) + if (data >= _data_inizio_es && data <= _datalimite) { if (sezione == "D") _saldo_ini_dare += importo; - else _saldo_ini_avere += importo; + else + _saldo_ini_avere += importo; conto_mov = true; } } } else - if (_dataini > _data_ini_ese) //calcolo i progressivi precedenti - if ((data >= _data_ini_ese) && (data < _dataini)) - if (((_stampa_mov_prov & 0x1) && provvis.blank()) || - ((_stampa_mov_prov & 0x2) && ((provvis == "P") || (provvis == "N"))) || - ((_stampa_mov_prov & 0x4) && (provvis == "B")) || ((_stampa_mov_prov & 0x8) && (provvis == "C"))) + if (_datainizio > _data_inizio_es) //calcolo i progressivi precedenti + if ((data >= _data_inizio_es) && (data < _datainizio)) + if (check_mov(_stampa_mov_prov, provvis)) { if (sezione == "D") _prg_prec_dare += importo; - else _prg_prec_avere += importo; + else + _prg_prec_avere += importo; conto_mov = true; } @@ -1924,13 +1642,10 @@ bool TStampa_IVdirettiva::calcola(int g, int c, long s, TBill conto(g, c, s); int indbil = conto.indicatore_bilancio(); - if (g == 20 && c == 22 && s == 22) - int i = 1; if ((indbil == 1) || (indbil == 2) || (indbil == 5)) { TSaldo saldo; const int annoes = esercizi().date2esc(fine_es); - real si = saldo.saldofin_esprec(annoes, g, c, s); if (si > ZERO) @@ -1969,24 +1684,18 @@ bool TStampa_IVdirettiva::set_print(int) _stampa_mov_prov |= _msk->get_bool(F_PROVVC) ? 0x8 : 0; // qui _quadratura = _msk->get_bool(F_QUADRATURA); _noseparator = _msk->get_bool(F_SEPARATOR); - - if (_tipo_bilancio == 1) - _tipo_stampa = _msk->get_int(F_TIPOSTAMPA); - else - _tipo_stampa = _msk->get_int(F_TIPOSTAMPA1); - + _tipo_data = (_annoese == 0 ? Registrazione : (_msk->get_bool(F_COMPCR) ? CostiRicavi : Competenza)); + _tipo_stampa = _msk->get_int(F_TIPOSTAMPA); if (_tipo_stampa == 2) { _anno_esercizio = _annoese; _anno_esercizio_raf = _annoeserafr; } - _cont_let = 0; _cont_numr = 0; _cont_num = 0; _cont_gcs = 0; _reset_righe_stampa = true; - if (_tipo_bilancio == 1) set_real_picture("###.###.###.###.###"); else @@ -2041,10 +1750,9 @@ bool TStampa_IVdirettiva::set_print(int) _tot_parz_sld_a = _tot_parz_prg_d = _tot_parz_prg_a = ZERO; _tot_parz_mov_d = _tot_parz_mov_a = ZERO; - _datai = _data_ini_ese; - _datairaf = _data_ini_raf; - TString data1 = _data_ini_ese.string(); - TString data2 = _data_ini_raf.string(); + _datai = _data_inizio_es; + _datairaf = _data_inizio_raf; + // Se si tratta di stampa intera struttura allora passo al sort anche tutte // le classi presenti sulla tabella IV dir. CEE, altrimenti passo solamente @@ -2332,7 +2040,8 @@ void TStampa_IVdirettiva::stampa_totali() if (!_attivo_o_passivo) { real totale = _totale_ordine_attivo - _totale_ordine_passivo; - if (totale != ZERO) + + if (totale != ZERO) { set_row (_i++,TR("SALDO CONTI D'ORDINE")); set_row (_i,TR("SBILANCIO")); @@ -2451,7 +2160,8 @@ void TStampa_IVdirettiva::stampa_totali() if (!_sbilancio_ordine) { real totale = _totale_ordine_attivo - _totale_ordine_passivo; - if (totale != ZERO) + + if (totale != ZERO) { set_row (_i++,"@0g%c", app); set_row (_i++,TR("SALDO CONTI D'ORDINE")); @@ -2484,7 +2194,8 @@ void TStampa_IVdirettiva::stampa_totali() if (!_sbilancio_ordine) { real totale = _totale_ordine_attivo - _totale_ordine_passivo; - if (totale != ZERO && !_sbilancio_ordine) + + if (totale != ZERO && !_sbilancio_ordine) { set_row (_i++,"@0g%c", app); set_row (_i++,TR("SALDO CONTI D'ORDINE")); @@ -2773,7 +2484,8 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() { real totale = _totale_ordine_attivo - _totale_ordine_passivo; real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf; - if (totale != ZERO || tot_raf != ZERO) + + if (totale != ZERO || tot_raf != ZERO) { set_row (_i++,TR("SALDO CONTI D'ORDINE")); set_row (_i,TR("SBILANCIO")); @@ -2923,7 +2635,8 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() { real totale = _totale_ordine_attivo - _totale_ordine_passivo; real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf; - if (totale != ZERO || tot_raf != ZERO) + + if (totale != ZERO || tot_raf != ZERO) { set_row (_i++,"@0g%c", app); set_row (_i++,TR("SALDO CONTI D'ORDINE")); @@ -2963,7 +2676,8 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() { real totale = _totale_ordine_attivo - _totale_ordine_passivo; real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf; - if ((totale != ZERO || tot_raf != ZERO) && !_sbilancio_ordine) + + if ((totale != ZERO || tot_raf != ZERO) && !_sbilancio_ordine) { set_row (_i++,"@0g%c", app); set_row (_i++,TR("SALDO CONTI D'ORDINE")); @@ -3663,7 +3377,6 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) reset_print(); _i = 1; } - if (_reset_righe_stampa) { reset_print(); @@ -3671,7 +3384,6 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) } else _reset_righe_stampa = true; - if (counter) { if (!_intera_struttura) @@ -3709,9 +3421,7 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) _num_tot.trim(); } } - _buff = _sort->retrieve(); - if (_buff == NULL) { stampa_totali_verifica(); @@ -3731,13 +3441,13 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) stampa_saldo_198(_tot_gen_saldo_d,_tot_gen_saldo_a); //modifica 05/04/1995 - if ((_tipo_stampa == 1 && _dataini == _data_ini_ese) || _tipo_stampa == 2) + if ((_tipo_stampa == 1 && _datainizio == _data_inizio_es) || _tipo_stampa == 2) { const real tot_d = _tot_gen_prg_d + _tot_gen_mov_d; const real tot_a = _tot_gen_prg_a + _tot_gen_mov_a; _i++; - if (_tipo_stampa == 1 && _dataini == _data_ini_ese) + if (_tipo_stampa == 1 && _datainizio == _data_inizio_es) set_row(_i,FR("****** ******** TOTALE CON MOVIM. DI APERTURA@46g!@80g!@81g%r@98g%r@114g!"),&tot_d, &tot_a); else set_row(_i,FR("****** ******** TOTALE CON SALDI INIZIALI@46g!@80g!@81g%r@98g%r@114g!"),&tot_d, &tot_a); @@ -3748,7 +3458,6 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) _sez_stamp = ' '; return true; } - if (_buff != NULL) { bil = (struct bil_ivd*) _buff; @@ -3852,13 +3561,14 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) } } - if (_dataini == _data_ini_ese) + if (_datainizio == _data_inizio_es) { //modifica del 27/11/1995 if (_tipo_stampa == 2) { real saldo_num = _sld_prg_dare - _sld_prg_avere; - if (saldo_num > ZERO) + + if (saldo_num > ZERO) _tot_num_prg_d += saldo_num; else { @@ -3866,23 +3576,28 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) _tot_num_prg_a += saldo_num; } real saldo_numr = _sld_prg_dare - _sld_prg_avere; - if (saldo_numr > ZERO) + + if (saldo_numr > ZERO) _tot_numr_prg_d += saldo_numr; else { saldo_numr = -saldo_numr; _tot_numr_prg_a += saldo_numr; } - real saldo_let = _sld_prg_dare - _sld_prg_avere; - if (saldo_let > ZERO) + + real saldo_let = _sld_prg_dare - _sld_prg_avere; + + if (saldo_let > ZERO) _tot_let_prg_d += saldo_let; else { saldo_let = -saldo_let; _tot_let_prg_a += saldo_let; } - real saldo_gen = _sld_prg_dare - _sld_prg_avere; - if (saldo_gen > ZERO) + + real saldo_gen = _sld_prg_dare - _sld_prg_avere; + + if (saldo_gen > ZERO) _tot_gen_prg_d += saldo_gen; else { @@ -3890,18 +3605,18 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) _tot_gen_prg_a += saldo_gen; } } - else if (_tipo_stampa == 1) - { - _tot_num_prg_d += _sld_prg_dare; - _tot_num_prg_a += _sld_prg_avere; - _tot_numr_prg_d += _sld_prg_dare; - _tot_numr_prg_a += _sld_prg_avere; - _tot_let_prg_d += _sld_prg_dare; - _tot_let_prg_a += _sld_prg_avere; - _tot_gen_prg_d += _sld_prg_dare; - _tot_gen_prg_a += _sld_prg_avere; - } - //fine + else + if (_tipo_stampa == 1) + { + _tot_num_prg_d += _sld_prg_dare; + _tot_num_prg_a += _sld_prg_avere; + _tot_numr_prg_d += _sld_prg_dare; + _tot_numr_prg_a += _sld_prg_avere; + _tot_let_prg_d += _sld_prg_dare; + _tot_let_prg_a += _sld_prg_avere; + _tot_gen_prg_d += _sld_prg_dare; + _tot_gen_prg_a += _sld_prg_avere; + } } else { @@ -4350,28 +4065,30 @@ void TStampa_IVdirettiva::setta_righe_verifica() *_d = tc.descrizione(); setta_righe_descr_verifica(*_d, "@15g%s"); _i--; - if (_dataini == _data_ini_ese) + if (_datainizio == _data_inizio_es) { //modifica del 27/11/1995 if (_tipo_stampa == 2) //all'ultima immissione { - real saldoini = _sld_prg_dare - _sld_prg_avere; - if (saldoini > ZERO) - set_row(_i,"@47g%r", &saldoini); - else if (saldoini < ZERO) // Non stampare il saldo iniziale se == 0.0 - { - saldoini = -saldoini; - set_row(_i,"@64g%r", &saldoini); - } + real saldoini = _sld_prg_dare - _sld_prg_avere; + + if (saldoini > ZERO) + set_row(_i,"@47g%r", &saldoini); + else + if (saldoini < ZERO) // Non stampare il saldo iniziale se == 0.0 + { + saldoini = -saldoini; + set_row(_i,"@64g%r", &saldoini); + } } - else if (_tipo_stampa == 1) //per date limiti - { - if (_sld_prg_dare != ZERO) - set_row(_i,"@47g%r", &_sld_prg_dare); - if (_sld_prg_avere != ZERO) - set_row(_i,"@64g%r", &_sld_prg_avere); - } - //fine + else + if (_tipo_stampa == 1) //per date limiti + { + if (_sld_prg_dare != ZERO) + set_row(_i,"@47g%r", &_sld_prg_dare); + if (_sld_prg_avere != ZERO) + set_row(_i,"@64g%r", &_sld_prg_avere); + } } else { @@ -4410,28 +4127,30 @@ void TStampa_IVdirettiva::setta_righe_verifica() *_d = tc.descrizione(); set_row (_i,"@2g#a", _d); - if (_dataini == _data_ini_ese) + if (_datainizio == _data_inizio_es) { //modifica del 27/11/1995 if (_tipo_stampa == 2) { - real saldoini = _sld_prg_dare - _sld_prg_avere; - if (saldoini > ZERO) - set_row(_i,"@47g%r", &saldoini); - else if (saldoini < ZERO) // non stampare il saldo iniziale se == 0.0 - { - saldoini = -saldoini; - set_row(_i,"@64g%r", &saldoini); - } + real saldoini = _sld_prg_dare - _sld_prg_avere; + + if (saldoini > ZERO) + set_row(_i,"@47g%r", &saldoini); + else + if (saldoini < ZERO) // non stampare il saldo iniziale se == 0.0 + { + saldoini = -saldoini; + set_row(_i,"@64g%r", &saldoini); + } } - else if (_tipo_stampa == 1) - { - if (_sld_prg_dare != ZERO) - set_row(_i,"@47g%r", &_sld_prg_dare); - if (_sld_prg_avere != ZERO) - set_row(_i,"@64g%r", &_sld_prg_avere); - } - //fine + else + if (_tipo_stampa == 1) + { + if (_sld_prg_dare != ZERO) + set_row(_i,"@47g%r", &_sld_prg_dare); + if (_sld_prg_avere != ZERO) + set_row(_i,"@64g%r", &_sld_prg_avere); + } } else { @@ -4569,14 +4288,15 @@ void TStampa_IVdirettiva::intesta_verifica_fissa() if (_tipo_stampa == 1) { - if (_dataini == _data_ini_ese) + if (_datainizio == _data_inizio_es) set_header(6,FR("@54gMOVIMENTI DI APERTURA@87gMOVIMENTI DEL PERIODO")); - else if (_dataini > _data_ini_ese) - set_header(6,FR("@54gPROGRESSIVI PRECEDENTI@87gMOVIMENTI DEL PERIODO")); + else + if (_datainizio > _data_inizio_es) + set_header(6,FR("@54gPROGRESSIVI PRECEDENTI@87gMOVIMENTI DEL PERIODO")); } - else if (_tipo_stampa == 2) - set_header(6,FR("@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO")); - + else + if (_tipo_stampa == 2) + set_header(6,FR("@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO")); if (_stampa_modulo) set_header(6,FR("@129gSALDO")); @@ -4608,29 +4328,26 @@ void TStampa_IVdirettiva::intesta_verifica_fissa() void TStampa_IVdirettiva::intesta_scalare() { - TString datalimitestr,databilrafrstr; TString sep(132); - - TString16 d1e(_data_ini_ese.string()); - TString16 d2e(_data_fine_ese.string()); - TString16 d1r(_data_ini_raf.string()); - TString16 d2r(_data_fine_raf.string()); - - set_header (4,TR("STAMPA BILANCIO CONFORME ALLA IV DIRETTIVA")); - set_header (4,FR("@80gEs. %s/%s"), (const char*)d1e, (const char*)d2e); /**/ + TString intestazione(TR("STAMPA BILANCIO CONFORME ALLA IV DIRETTIVA")); + + if (_tipo_data == Registrazione) + intestazione << " " << TR("PER CASSA"); + else + if (_tipo_data == CostiRicavi) + intestazione << " " << TR("PER COMPETENZA COSTI/RICAVI"); + set_header(4, intestazione); + set_header (4,FR("@80gEs. %s/%s"), (const char*)_data_inizio_es.string(), (const char*)_data_fine_es.string()); /**/ if (_annoeserafr != 0 || _databilrafr != botime) { - set_header (4,FR("@107gEs. %s/%s"), (const char*)d1r, (const char*)d2r); /**/ - databilrafrstr = _databilrafr.string(); - set_header (5,FR("@112galla data@122g%s"), (const char*) databilrafrstr); + set_header (4,FR("@107gEs. %s/%s"), (const char*)_data_inizio_raf.string(), (const char*)_data_fine_raf.string()); /**/ + set_header (5,FR("@112galla data@122g%s"), (const char*)_databilrafr.string()); } if (_tipo_stampa == 1) - { - datalimitestr = _datalimite.string(); - set_header (5,FR("@86galla data@96g%s"), (const char*) datalimitestr); - } - else if (_tipo_stampa == 2) - set_header (5,FR("@90gall'ultima immissione")); + set_header (5,FR("@112galla data@122g%s"), (const char*)_datalimite.string()); + else + if (_tipo_stampa == 2) + set_header (5,FR("@110gall'ultima immissione")); sep.fill('-'); //Stampa 132 - (sep(132)) set_header (6, (const char *) sep); @@ -4638,18 +4355,20 @@ void TStampa_IVdirettiva::intesta_scalare() void TStampa_IVdirettiva::intesta_verifica() { - set_header (4,TR("@0gBILANCIO DI VERIFICA IV DIRETTIVA")); + TString intestazione(TR("BILANCIO DI VERIFICA IV DIRETTIVA")); - if (_tipo_stampa == 1) - { - TString datainistr = _dataini.string(); - TString datafinestr = _datafine.string(); - set_header (4,FR("@43gdalla data@54g%s alla data %s"), - - (const char*)datainistr, (const char*) datafinestr); - } - else if (_tipo_stampa == 2) - set_header (4,FR("@42gall'ultima immissione")); + if (_tipo_data == Registrazione) + intestazione << " " << TR("PER CASSA"); + else + if (_tipo_data == CostiRicavi) + intestazione << " " << TR("PER COMPETENZA COSTI/RICAVI"); + set_header(4, intestazione); + if (_tipo_stampa == 1) + set_header (4,FR("@90gdalla data@101g%s alla data %s"), + (const char*)_datainizio.string(), (const char*)_datalimite.string()); + else + if (_tipo_stampa == 2) + set_header (4,FR("@111gall'ultima immissione")); TString sep; sep.fill('-', _stampa_modulo ? 147 : 132); @@ -4686,11 +4405,9 @@ bool TStampa_IVdirettiva::user_create() _msk->set_handler(F_DATALIM, data_limite); _msk->set_handler(F_TIPOSTAMPA, tipo_stampa); - _msk->set_handler(F_TIPOSTAMPA1, tipo_stampa); _msk->set_handler(F_TIPOBIL, tipo_bilancio); _msk->set_handler(F_ANNOESE, anno_esercizio); _msk->set_handler(F_DATAINI, data_inizio); - _msk->set_handler(F_DATAFINE, data_fine); _msk->set_handler(F_DATABILRAF, data_bil_raff); _msk->set_handler(F_ANNORAFFR, anno_ese_raff); _msk->set(F_NORMALI, "X"); diff --git a/src/cg/cg1600.h b/src/cg/cg1600.h index d96abfdeb..ef25a93a3 100755 --- a/src/cg/cg1600.h +++ b/src/cg/cg1600.h @@ -9,7 +9,6 @@ #define F_DATASTAMPA 103 #define F_TIPOBIL 104 #define F_TIPOSTAMPA 105 -#define F_TIPOSTAMPA1 106 #define F_DATALIM 107 #define F_DATABILRAF 108 #define F_STAMPAINT 109 @@ -18,7 +17,6 @@ #define F_COMPETENZA 112 #define F_STAMPAMODULO 113 #define F_DATAINI 114 -#define F_DATAFINE 115 #define F_ANNOESE 116 #define F_ANNORAFFR 117 #define F_NORMALI 118 @@ -28,6 +26,7 @@ #define F_PROVVM 122 #define F_PROVVB 123 #define F_PROVVC 124 +#define F_COMPCR 125 #endif // __CG1600_H diff --git a/src/cg/cg1600a.uml b/src/cg/cg1600a.uml index 80a43dfc5..b4e3bffbd 100755 --- a/src/cg/cg1600a.uml +++ b/src/cg/cg1600a.uml @@ -54,6 +54,8 @@ BEGIN OUTPUT F_ANNOESE CODTAB FLAGS "RZ" CHECKTYPE NORMAL + MESSAGE EMPTY DISABLE,F_COMPCR + MESSAGE ENABLE,F_COMPCR ADD RUN cg0 -5 esc END @@ -75,10 +77,9 @@ BEGIN PROMPT 4 6 "Tipo bilancio " HELP "Indicare il tipo di bilancio da stampare" ITEM "1|Bilancio scalare" - MESSAGE HIDE,F_TIPOSTAMPA1|RESET,F_TIPOSTAMPA1|SHOW,F_TIPOSTAMPA|K_SPACE,F_TIPOSTAMPA - MESSAGE SHOW,F_ANNORAFFR|SHOW,F_DATABILRAF|HIDE,F_SEPARATOR + MESSAGE SHOW,F_ANNORAFFR|SHOW,F_DATABILRAF|HIDE,F_SEPARATOR + MESSAGE CLEAR,F_QUADRATURA ITEM "2|Bilancio di verifica" - MESSAGE HIDE,F_TIPOSTAMPA|RESET,F_TIPOSTAMPA|SHOW,F_TIPOSTAMPA1|K_SPACE,F_TIPOSTAMPA1 MESSAGE HIDE,F_ANNORAFFR|HIDE,F_DATABILRAF|SHOW,F_SEPARATOR END @@ -87,79 +88,38 @@ BEGIN PROMPT 4 7 "Tipo stampa " HELP "Indicare il tipo di stampa che si vuole avere" ITEM "1|Per data limite" - MESSAGE HIDE,F_STAMPAMODULO|HIDE,F_DATAINI|HIDE,F_DATAFINE - MESSAGE RESET,F_STAMPAMODULO|RESET,F_DATAINI|RESET,F_DATAFINE MESSAGE SHOW,F_DATALIM|SHOW,F_STAMPAINT|SHOW,F_STAMPAMOV + MESSAGE ENABLE,F_COMPCR ITEM "2|All'ultima immissione" - MESSAGE HIDE,F_DATALIM|HIDE,F_STAMPAMODULO|HIDE,F_DATAINI|HIDE,F_DATAFINE - MESSAGE RESET,F_STAMPAMODULO|RESET,F_DATAINI|RESET,F_DATALIM|RESET,F_DATAFINE| + MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM MESSAGE SHOW,F_STAMPAINT|SHOW,F_STAMPACOD|SHOW,F_STAMPAMOV -END - -LIST F_TIPOSTAMPA1 23 -BEGIN - PROMPT 4 7 "Tipo stampa " - ITEM "1|Per data limite" - MESSAGE HIDE,F_DATALIM - MESSAGE RESET,F_DATALIM - MESSAGE SHOW,F_STAMPAINT|SHOW,F_STAMPACOD|SHOW,F_STAMPAMOV - MESSAGE SHOW,F_DATAINI|SHOW,F_DATAFINE|SHOW,F_STAMPAMODULO - ITEM "2|All'ultima immissione" - MESSAGE HIDE,F_DATALIM|HIDE,F_DATAINI|HIDE,F_DATAFINE - MESSAGE RESET,F_DATAINI|RESET,F_DATALIM|RESET,F_DATAFINE - MESSAGE SHOW,F_STAMPAINT|SHOW,F_STAMPACOD|SHOW,F_STAMPAMOV|SHOW,F_STAMPAMODULO - MESSAGE COPY,F_TIPOSTAMPA -END - -TEXT 96 -BEGIN - PROMPT 4 9 "Dalla data competenza " -END - -TEXT 97 -BEGIN - PROMPT 40 9 "Alla data competenza " -END - -TEXT 98 -BEGIN - PROMPT 4 9 "Dalla data operazione " -END - -TEXT 99 -BEGIN - PROMPT 40 9 "Alla data operazione " -END -DATE F_DATALIM -BEGIN - PROMPT 4 9 "Data limite " - HELP "Data fin alla quale si vuole la stampa" - FLAGS "G" -// VALIDATE NOT_EMPTY_FUNC -END - -DATE F_DATABILRAF -BEGIN - PROMPT 36 9 "Data bil. da raffrontare " - HELP "Data d'esercizio da raffrontare con data limite" - FLAGS "G" -// VALIDATE NOT_EMPTY_FUNC + MESSAGE CLEAR,F_COMPCR END DATE F_DATAINI BEGIN - PROMPT 26 9 "" - HELP "Data di inizio calcolo" - FLAGS "G" -// VALIDATE NOT_EMPTY_FUNC + PROMPT 4 8 "Data iniziale " + HELP "Data dalla quale si vuole iniziare la stampa" END -DATE F_DATAFINE +DATE F_DATALIM BEGIN - PROMPT 62 9 "" - HELP "Data di fine calcolo" - FLAGS "G" -// VALIDATE NOT_EMPTY_FUNC + PROMPT 41 8 "Data limite " + HELP "Data fin alla quale si vuole la stampa" +END + +DATE F_DATABILRAF +BEGIN + PROMPT 28 9 "Data bil. da raffrontare " + HELP "Data d'esercizio da raffrontare con data limite" +END + +BOOLEAN F_COMPCR +BEGIN + PROMPT 4 10 "Bilancio per competenza costi/ricavi " + HELP "Bilancio per competenza costi/ricavi" + FLAGS "D" + GROUP 4 END BOOLEAN F_STAMPAINT @@ -172,49 +132,49 @@ END BOOLEAN F_STAMPACOD BEGIN - PROMPT 41 11 "Non stampare cod. conti" + PROMPT 4 12 "Non stampare cod. conti" HELP "Indicare se non stampare i codici dei conti" END BOOLEAN F_STAMPAMOV BEGIN - PROMPT 4 12 "Non stampare mov. con saldo a 0" + PROMPT 4 13 "Non stampare mov. con saldo a 0" HELP "Indicare se non stampare i movimenti con saldo nullo" END BOOLEAN F_NORMALI BEGIN - PROMPT 4 13 "Movimenti : Normali" + PROMPT 4 14 "Movimenti : Normali" END BOOLEAN F_PROVVM BEGIN - PROMPT 30 13 "Provvisori : Manuali" + PROMPT 30 14 "Provvisori : Manuali" END BOOLEAN F_PROVVB BEGIN - PROMPT 53 13 "Comp. costi/ricavi" + PROMPT 53 14 "Comp. costi/ricavi" END BOOLEAN F_PROVVC BEGIN - PROMPT 75 13 "Cespiti" + PROMPT 75 14 "Cespiti" END BOOLEAN F_STAMPAMODULO BEGIN - PROMPT 4 14 "Stampa su modulo 198" + PROMPT 4 15 "Stampa su modulo 198" END BOOLEAN F_QUADRATURA BEGIN - PROMPT 4 15 "Quadratura con Libro Giornale" + PROMPT 4 16 "Quadratura con Libro Giornale" END BOOLEAN F_SEPARATOR BEGIN - PROMPT 4 16 "Non stampare il separatre delle migliaia" + PROMPT 4 17 "Non stampare il separatre delle migliaia" END ENDPAGE diff --git a/src/cg/cg2101.cpp b/src/cg/cg2101.cpp index 4526a8b83..84f11c4e8 100755 --- a/src/cg/cg2101.cpp +++ b/src/cg/cg2101.cpp @@ -1,5 +1,4 @@ #include "cg2101.h" -#include "cg2103.h" #include "cgsaldac.h" #include diff --git a/src/cg/cg2101.h b/src/cg/cg2101.h index 142993e11..6becd2c59 100755 --- a/src/cg/cg2101.h +++ b/src/cg/cg2101.h @@ -1,12 +1,8 @@ #ifndef __CG2101_H #define __CG2101_H -#ifndef __CG2103_H -#include "cg2103.h" -#endif - -#ifndef __CGLIB03_H -#include "cglib03.h" +#ifndef __CGLIB_H +#include "cglib.h" #endif #ifndef __RECARRAY_H diff --git a/src/cg/cg2102.h b/src/cg/cg2102.h index d1705bf38..b9c2195ba 100755 --- a/src/cg/cg2102.h +++ b/src/cg/cg2102.h @@ -17,12 +17,8 @@ #include "cgsaldac.h" #endif -#ifndef __CGLIB02_H -#include "cglib02.h" -#endif - -#ifndef __CG2101_H -#include "cg2101.h" +#ifndef __CGLIB_H +#include "cglib.h" #endif #ifndef __CG2101_H diff --git a/src/cg/cg2103.cpp b/src/cg/cg2103.cpp index fb044c96c..a24c3ba56 100755 --- a/src/cg/cg2103.cpp +++ b/src/cg/cg2103.cpp @@ -1,4 +1,4 @@ -#include "cg2103.h" +#include "cglib.h" #include #include diff --git a/src/cg/cg2103.h b/src/cg/cg2103.h index aebeca499..176719c93 100755 --- a/src/cg/cg2103.h +++ b/src/cg/cg2103.h @@ -2,8 +2,8 @@ #define __CG2103_H // Registri ed esercizi -#ifndef __CGLIB01_H -#include "cglib01.h" +#ifndef __CGLIB_H +#include "cglib.h" #endif class TCausale : public TArray diff --git a/src/cg/cg2200.cpp b/src/cg/cg2200.cpp index 684eb0a71..0362bf9c9 100755 --- a/src/cg/cg2200.cpp +++ b/src/cg/cg2200.cpp @@ -13,9 +13,10 @@ #include "../ca/calib02.h" #include "cg2200.h" -#include "cg2101.h" -#include "cglib01.h" -#include "cglib02.h" +//#include "cg2101.h" +//#include "cglib01.h" +//#include "cglib02.h" +#include "cglib.h" class TProvvisori_msk : public TAutomask { diff --git a/src/cg/cg2300.cpp b/src/cg/cg2300.cpp index 3ed788090..f772a5f6c 100644 --- a/src/cg/cg2300.cpp +++ b/src/cg/cg2300.cpp @@ -2,7 +2,7 @@ #include "applicat.h" #include "automask.h" #include "cg2300a.h" -#include "cg2103.h" +#include "cglib.h" #include "lffiles.h" #include "isam.h" #include "mov.h" diff --git a/src/cg/cglib01.cpp b/src/cg/cglib01.cpp index 8f3a0e91b..48917ccfc 100755 --- a/src/cg/cglib01.cpp +++ b/src/cg/cglib01.cpp @@ -1,13 +1,13 @@ // Esercizi contabili e registri IVA -#include "cglib01.h" +#include "cglib.h" +#include #include #include -#include -#include #include #include +#include #include #include @@ -18,7 +18,457 @@ #include #include -#include "comuni.h" +#include + +/////////////////////////////////////////////////////////// +// Causale +/////////////////////////////////////////////////////////// + +TCausale::TCausale(const char* cod, int year) + : TArray(12), _rec(LF_CAUSALI), + _iva(iva_errata), _corrisp(false), + _sezione_clifo(' '), _provvisorio(' '), + _sezione_ritsoc(' '), _sezione_ritfis(' '), _sezione_revcharge(' '), + _regolarizzazione(false) + + +{ + if (cod && *cod) + read(cod, year); + if (soloiva()) + { + TCursor c(new TRelation(LF_CAUSALI)); + int items = c.items(); + + for (c = 0L; c.pos() < items && !_regolarizzazione; ++c) + _regolarizzazione = c.curr().get(CAU_CODCAUREG) == codice(); + } +} + +bool TCausale::reread() +{ + const TString4 cod = codice(); + + if (cod.full()) + { + const int year = _reg.year(); + + if (year > 0) + return read(cod, year); + } + return false; +} + +// Legge le righe della causale attualmente selezionata sulla maschera +bool TCausale::read(const char* cod, int year) +{ + _rec.zero(); // Delete header + destroy(); // Delete all rows + _iva = iva_errata; // Delete misc info + _sezione_clifo = _sezione_ritsoc = _provvisorio = ' '; + _corrisp = false; + + if (cod && *cod > ' ') + { + _rec = cache().get(LF_CAUSALI, cod); + if (_rec.empty()) + return false; + + _provvisorio = _rec.get_char(CAU_PROVV); + TLocalisamfile rcaus(LF_RCAUSALI); + rcaus.put(CAU_CODCAUS, cod); + rcaus.put(CAU_NRIGA, 0); + + int err; + for (err = rcaus.read(_isgteq); // Find first line + err == NOERR && rcaus.get(CAU_CODCAUS) == cod; + err = rcaus.next()) // Read next line + { + const int riga = rcaus.get_int(CAU_NRIGA); + add(rcaus.curr(), riga); + } + + const TString4 codreg(_rec.get(CAU_REG)); + const bool ok = _reg.read(codreg, year); // Read register + if (!ok && codreg.not_empty()) + return error_box(FR("Non esiste il registro '%s' del %d"), + (const char*)codreg, year); + calcIVA(); + } + else + { + _iva = nessuna_iva; // Clear IVA data + _corrisp = false; + _reg.read("", year); + } + + return true; +} + +TBill& TCausale::bill(int num, TBill& conto) const +{ + const TRectype* rec = row(num); + + if (rec != nullptr) + conto.set(rec->get_int(RCA_GRUPPO), rec->get_int(RCA_CONTO), + rec->get_long(RCA_SOTTOCONTO), rec->get_char(RCA_TIPOCF)); + return conto; +} + +const char* TCausale::cod_desc_agg(int num) const +{ + const TRectype* rec = row(num); + if (rec) + return rec->get(RCA_CODDESC); + return ""; // ho problemi con ? : +} + +const char* TCausale::desc_agg(int num) const +{ + const char* cod = cod_desc_agg(num); + if (cod && *cod) + return cache().get("%DPN", cod, "S0"); + return ""; // ho problemi con ? : +} + +const char* TCausale::descrizione() const +{ + return _rec.get(CAU_DESCR); +} + +const char* TCausale::codice() const +{ + return _rec.get(CAU_CODCAUS); +} + +bool TCausale::data_doc() const +{ + return _rec.get_bool(CAU_DATADOC); +} + +bool TCausale::num_doc() const +{ + return _rec.get_bool(CAU_NUMDOC); +} + +bool TCausale::apertura() const +{ + return _rec.get_char(CAU_MOVAP) == 'A'; +} + +bool TCausale::chiusura() const +{ + return _rec.get_char(CAU_MOVAP) == 'C'; +} + +bool TCausale::sezionale() const +{ + return _rec.get_bool(CAU_MOVSEZ); +} + +bool TCausale::valuta() const +{ + return _rec.get_bool(CAU_MOVVAL); +} + +bool TCausale::intra() const +{ + return _rec.get_bool(CAU_INTRACOM); +} + +bool TCausale::valintra() const +{ + return _rec.get_bool(CAU_VALINTRA); +} + +bool TCausale::soloiva() const +{ + return _rec.get_bool(CAU_SOLOIVA); +} + +int TCausale::regime_speciale() const +{ + return _rec.get_int(CAU_REGSPIVA); +} + +bool TCausale::regolarizzazione() const +{ + return _regolarizzazione; +} + +bool TCausale::ril_fat_em_ric() const +{ + return _rec.get_bool(CAU_RILFTEMRI); +} + +bool TCausale::datareg_prec() const +{ + return _rec.get_bool(CAU_DATAREGPR); +} + +bool TCausale::reverse_charge() const +{ + const int rsi = regime_speciale(); + return (rsi >= 13 && rsi <= 18) || rsi == 50 || rsi == 51; // Reverse charge! +} + +bool TCausale::reverse_charge_pubb() const +{ + const int rsi = regime_speciale(); + return (rsi >= 13 && rsi <= 19) || rsi == 50 || rsi == 51; // Reverse charge! +} + +bool TCausale::esclusione_allegati() const +{ + return _rec.get_bool(CAU_ALLEG); +} + +const TString& TCausale::causale_collegata() const +{ + return _rec.get(CAU_CODCAUSIM); +} + +const TString& TCausale::causale_reg_iva() const +{ + return _rec.get(CAU_CODCAUREG); +} + +const TString& TCausale::tipo_doc() const +{ + return _rec.get(CAU_TIPODOC); +} + +tipo_movimento TCausale::tipomov() const +{ + return tipo_movimento(_rec.get_int(CAU_TIPOMOV)); +} + +const TString& TCausale::tipodoc() const +{ + return _rec.get(CAU_TIPODOC); +} + +bool TCausale::saldaconto(const TDate& datareg) const +{ + bool yes = tipomov() > 0; + if (yes && datareg.ok()) + { + static TDate _data_sal = ini_get_string(CONFIG_DITTA, "cg", "DatSal"); + yes = datareg >= _data_sal; + } + return yes; +} + +int TCausale::link_m770() const +{ + return _rec.get_int(CAU_M770); +} + +char TCausale::link_cespiti() const +{ + return _rec.get_char(CAU_COLLCESP); +} + +bool TCausale::link_analitica() const +{ + return _rec.get_bool(CAU_MOVIND); +} + +bool TCausale::link_industriale() const +{ + return _rec.exist(CAU_MOVCGIND) && _rec.get_bool(CAU_MOVCGIND); +} + +bool TCausale::ok() const +{ + return iva() != iva_errata; +} + +char TCausale::sezione(int riga, bool low_level) const +{ + const TRectype* rec = row(riga); + char sez = rec ? toupper(rec->get_char(RCA_SEZIONE)) : ' '; + if (sez <= ' ' && !low_level) // Guess section on tipocf + { + const TRectype* uno = row(1); + char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' '; + if (tipocf <= ' ') + tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA + sez = (tipocf == 'C') ? 'D' : 'A'; + } + return sez; +} + +char TCausale::sezione_clifo() const +{ + if (_sezione_clifo <= ' ') + (char&)_sezione_clifo = sezione(1); + return _sezione_clifo; +} + +char TCausale::sezione_ritsoc() const +{ + if (_sezione_ritsoc <= ' ') + { + const tipo_movimento tm = tipomov(); + (char&)_sezione_ritsoc = sezione(tm <= tm_nota_credito ? RIGA_RITENUTE_SOCIALI : RIGA_PAG_RITSOC, true); + if (_sezione_ritsoc < 'A') + (char&)_sezione_ritsoc = (tm <= tm_nota_credito ? sezione_clifo() : (sezione_clifo() == 'D' ? 'A' : 'D')); + } + return _sezione_ritsoc; +} + +char TCausale::sezione_ritfis() const +{ + if (_sezione_ritfis == ' ') + { + const tipo_movimento tm = tipomov(); + (char&)_sezione_ritfis = sezione(tm <= tm_nota_credito ? RIGA_RITENUTE_FISCALI : RIGA_PAG_RITFIS, true); // Fatture o Pagamenti + if (_sezione_ritfis < 'A') + (char&)_sezione_ritfis = (tm <= tm_nota_credito ? sezione_clifo() : (sezione_clifo() == 'D' ? 'A' : 'D')); + } + return _sezione_ritfis; +} + +char TCausale::sezione_revcharge() const +{ + if (_sezione_revcharge <= ' ') + { + (char&)_sezione_revcharge = sezione(RIGA_REVERSE_CHARGE); + if (_sezione_revcharge < 'A') + (char&)_sezione_revcharge = sezione_clifo(); + } + return _sezione_revcharge; +} + +bool TCausale::fattura_in_ritardo() const +{ + return _rec.get_bool(CAU_RITFATT); +} + + +void TCausale::calcIVA() +{ + TipoIVA i = nessuna_iva; // Tipo IVA di default + bool c = false; // Corrispettivi di default + + const TString& td = tipo_doc(); + if (td.full()) + { + const TRectype& tpd = cache().get("%TPD", td); + if (!tpd.empty()) + { + i = (TipoIVA)tpd.get_int("I0"); // IVA acquisti, vendite, generica + const TipoIVA ri = _reg.iva(); + if (i == iva_generica) + i = ri; + if (i != ri) + { + error_box(FR("Tipo documento '%s' incompatibile con tipo registro"), (const char*)td); + i = iva_errata; + } + c = tpd.get_bool("B0"); // B0 flag corrispettivi + } + else + error_box(FR("Tipo documento sconosciuto: '%s'"), (const char*)td); + } + _iva = i; + _corrisp = c; +} + +const TString& TCausale::compatible(const TCausale& c) const +{ + const char* err = nullptr; + + if (sezionale() != c.sezionale()) + err = TR("il segnale di sezionale"); + if (intra() != c.intra()) + err = TR("la gestione dei movimenti intra"); + if (valuta() != c.valuta()) + err = TR("la gestione valuta"); + if (valintra() != c.valintra()) + err = TR("la gestione valuta intracomunitaria"); + if (corrispettivi() != c.corrispettivi()) + err = TR("la gestione dei corrispettivi"); + if (iva() != c.iva()) + err = TR("il tipo di IVA"); + if (tipomov() != c.tipomov()) + err = TR("il tipo di movimento"); + + if (err != nullptr) + { + TString& msg = get_tmp_string(); + + msg.format(FR("Causale incompatibile per %s"), err); + return msg; + } + + return EMPTY_STRING; +} + +bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const +{ + const TString& tipo = iva.tipo(); + + if (tipo.not_empty()) + { + if (tipo == "ES") bill(5, c); else + if (tipo == "NI") bill(6, c); else + if (tipo == "NS") bill(7, c); + } + + if (!c.ok()) + bill(2, c); + + const int spric = c.tipo_cr(); + if (spric == 2 || spric == 3) + { + const TString& td = tipo_doc(); + if (td == "FV" || td == "NC") + c.tipo_cr(4); + } + + return c.ok(); +} + +/////////////////////////////////////////////////////////// +// TCache_causali +/////////////////////////////////////////////////////////// +class TCache_causale : public TCache +{ +protected: + virtual TObject* key2obj(const char* key); + +public: + const TCausale & caus(const char* key, const int anno = 0); + + TCache_causale() : TCache() { } + virtual ~TCache_causale() { } +}; + +TObject* TCache_causale::key2obj(const char* key) +{ + TToken_string k(key); + TString4 cod; + k.get(0, cod); + cod.trim(); + int year; k.get(1, year); + return new TCausale(cod, year); +} + +const TCausale & TCache_causale::caus(const char* key, const int anno) +{ + TToken_string k(key); + k.add(anno); + return (const TCausale &)*objptr(k); +} + +const TCausale & cached_causale(const char * codcaus, int year) +{ + HIDDEN TCache_causale __cache_causale; + + return __cache_causale.caus(codcaus, year); +} /////////////////////////////////////////////////////////// // Gestione Tabella esercizi diff --git a/src/cg/cglib01.h b/src/cg/cglib01.h index 0482823cc..d57323cd1 100755 --- a/src/cg/cglib01.h +++ b/src/cg/cglib01.h @@ -16,6 +16,7 @@ protected: // TSortable virtual int compare(const TSortable& s) const; public: + bool ok() const { return _codice != 0; } int codice() const { return _codice; } const TDate& inizio() const { return _inizio; } const TDate& fine() const { return _fine; } @@ -58,6 +59,7 @@ public: int last() const; int last_mag() const; bool exist(int codice) const; + bool exist(const TDate & data) const { return exist(date2esc(data)); } bool code2range(int codice, TDate& dal, TDate& al) const; TEsercizi_contabili(); @@ -65,6 +67,8 @@ public: }; TEsercizi_contabili& esercizi(); +inline const TEsercizio & esercizio(const TDate & data) { return esercizi().esercizio(data); } +inline const TEsercizio& esercizio(int codice) { return esercizi().esercizio(codice); }; enum TipoIVA { diff --git a/src/cg/cglib02.cpp b/src/cg/cglib02.cpp index 137ce44ba..6df08c9f5 100755 --- a/src/cg/cglib02.cpp +++ b/src/cg/cglib02.cpp @@ -5,15 +5,13 @@ // ///////////////////////////////////////////////////////////////////////////// -#include "cglib01.h" -#include "cglib02.h" +#include "cglib.h" #include #include #include #include -#include #include #include #include @@ -26,12 +24,28 @@ // Cerca l'esercizio precedente di EseCorr // Se EseCorr e' già il primo ritorna 0 // + HIDDEN int EsePre(const int EseCorr) { TEsercizi_contabili esc; return esc.pred(EseCorr); } +HIDDEN const char * date_field_name(TTipo_data tipo) { return __date_field_name[tipo]; } + +const TDate get_date_mov(const TRectype & mov, TTipo_data tipo_data) +{ + TDate data = mov.get_date(date_field_name(tipo_data)); + + if (tipo_data == CostiRicavi && !data.ok()) + data = mov.get_date(date_field_name(Competenza)); +#ifdef DBG + else + int i = 1; +#endif + return data; +} + // aep e' l'esercizio precedente TSaldi_list::TSaldi_list(int gr, int co, int aec, int aep_par) { @@ -183,24 +197,10 @@ real TSaldo::calcola_saldo_iniziale(int g,int c,long s,int indbil, int provv) return _saldo_iniziale; } -bool TSaldo::leggi_mov(long nr) -{ - const TRectype& mov = cache().get(LF_MOV, nr); - const bool ok = !mov.empty(); - if (ok) - { - _codcaus = mov.get(MOV_CODCAUS); - _datareg = mov.get(MOV_DATAREG); - _provv = mov.get(MOV_PROVVIS); // _provv.trim(); - _datacomp = mov.get(MOV_DATACOMP); - } - else - NFCHECK("Testata assente: %ld", nr); - return ok; -} + //per bilancio scalare (ovvero a sezioni contrapposte) per data limite -bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate& data_inf, +bool TSaldo::data_limite_bilancio(TTipo_data tipo_data, int g, int c, long s, const TDate& data_inf, const TDate& data_sup, int indbil, int provv, const char* filter) { _saldo_iniziale = ZERO; @@ -225,55 +225,44 @@ bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDat if ((provv & 0x1) && (filter == nullptr || *filter == '\0')) _saldo = calcola_saldo_iniziale(g,c,s,indbil,provv); - for (cur = 0L; cur.pos() < items; ++cur) - { - const long num_reg = rmov.get_long(RMV_NUMREG); - - if (!leggi_mov(num_reg)) // Leggo la testata - continue; // Evita righe orfane! + for (cur = 0L; cur.pos() < items; ++cur) + { + const long numreg = rmov.get_long(RMV_NUMREG); + const TRectype& mov = cache().get(LF_MOV, numreg); + const TDate data = get_date_mov(mov, tipo_data); - TDate data_mov; - if (bilancio == DataLimite) - data_mov = _datacomp; - else - { - if (_annoes == 0) - data_mov = _datareg; - else - data_mov = _datacomp; - } - - if (data_mov < data_inf || data_mov > data_sup) - continue; - - // "Se la causale del movimento e' di chiusura, - // o di apertura il movimento non va considerato" - if (_codcaus.full()) - { - const TString& movap = _causali_apertura.decode(_codcaus); - if (movap == "C") - continue; - } - - if (((provv & 0x1) && _provv.blank()) || - ((provv & 0x2) && ((_provv == "P") || (_provv == "N"))) || - ((provv & 0x4) && (_provv == "B")) || ((provv & 0x8) && (_provv == "C"))) + if (data.ok() && data >= data_inf && data <= data_sup) { - const char sezione = rmov.get_char(RMV_SEZIONE); - const real importo = rmov.get_real(RMV_IMPORTO); + const TString8 codcaus = mov.get(MOV_CODCAUS); - // I mov. di puro riferimento (= con importo = 0) vanno scartati - if (importo != ZERO) + // "Se la causale del movimento e' di chiusura, + // o di apertura il movimento non va considerato" + if (codcaus.full()) { - _movimentato = true; - if (sezione == 'D') - _saldo += importo; - else - _saldo -= importo; + const TString& movap = _causali_apertura.decode(codcaus); + if (movap == "C") + continue; + } + + const TString4 tipoprovv = mov.get(MOV_PROVVIS); + + if (check_mov(provv, tipoprovv)) + { + const char sezione = rmov.get_char(RMV_SEZIONE); + const real importo = rmov.get_real(RMV_IMPORTO); + + // I mov. di puro riferimento (= con importo = 0) vanno scartati + if (importo != ZERO) + { + _movimentato = true; + if (sezione == 'D') + _saldo += importo; + else + _saldo -= importo; + } } } - } - + } #ifdef DBG xvtil_statbar_refresh(); #endif @@ -465,7 +454,7 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil return _movimentato; } -const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const TDate& al, +const real& TSaldo::saldo_periodo(TTipo_data tipo_data, int g, int c, long s, const TDate& dal, const TDate& al, int indbil, int provv) { @@ -522,27 +511,29 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const for (cur = 0L; cur.pos() < items; ++cur) { - p.addstatus(1L); - - const long num_reg = rmov.get_long(RMV_NUMREG); - const real importo = rmov.get_real(RMV_IMPORTO); - - if (!importo.is_zero()) + p.addstatus(1L); + + const real importo = rmov.get_real(RMV_IMPORTO); + + if (importo != ZERO) { - const char sezione = rmov.get_char(RMV_SEZIONE); - // "Se la causale del movimento e' di chiusura, - // o di apertura il movimento non va considerato" - leggi_mov(num_reg); - const TString& movap = _causali_apertura.decode(_codcaus); + const long numreg = rmov.get_long(RMV_NUMREG); + const TRectype& mov = cache().get(LF_MOV, numreg); + const TDate data = get_date_mov(mov, tipo_data); + const TString8 codcaus = mov.get(MOV_CODCAUS); + const TString4 tipoprovv = mov.get(MOV_PROVVIS); + const TString& movap = _causali_apertura.decode(codcaus); - if (!((provv & 0x1) || _provv.empty()) && movap.blank()) // ???? + if (!((provv & 0x1) || tipoprovv.empty()) && movap.blank()) // ???? { - if (_datacomp >= dal && _datacomp <= al) + const char sezione = rmov.get_char(RMV_SEZIONE); + + if (data.ok() && data >= dal && data <= al) { - _movimentato = true; - const int m = _datacomp.month() - 1; + const int m = data.month() - 1; - if (sezione == 'D') + _movimentato = true; + if (sezione == 'D') { _prg_dare += importo; _prg_dare_mese[m] += importo; @@ -554,7 +545,7 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const } } else - if (_datacomp >= inizio && _datacomp < dal) + if (data >= inizio && data < dal) { if (sezione == 'D') _saldo_iniziale += importo; @@ -616,7 +607,7 @@ bool TSaldo::prg_saldo(int annoes, TConto& conto, real& prgdare, real& prgavere, return ok; } -bool TSaldo::saldo_cont_sep(int g, int c, long s, const int codes, TDate al, +bool TSaldo::saldo_cont_sep(TTipo_data tipo_data, int g, int c, long s, const int codes, TDate al, int indbil, const char * cont_sep, int provv, bool chiusura, bool first) { @@ -679,17 +670,14 @@ bool TSaldo::saldo_cont_sep(int g, int c, long s, const int codes, TDate al, { if (( cont_sep != nullptr && *cont_sep == '\0') || mov.get(MOV_CONTSEP) == cont_sep) { - _codcaus = mov.get(MOV_CODCAUS); - _datareg = mov.get(MOV_DATAREG); - _provv = mov.get(MOV_PROVVIS); - _datacomp = mov.get(MOV_DATACOMP); - const TString& movap = _causali_apertura.decode(_codcaus); + const TString8 codcaus = mov.get(MOV_CODCAUS); + const TString4 tipoprovv = mov.get(MOV_PROVVIS); + const TDate data = get_date_mov(mov, tipo_data); + const TString& movap = _causali_apertura.decode(codcaus); - if (((provv & 0x1) && _provv.empty()) || - ((provv & 0x2) && (_provv == "P" || _provv == "N")) || - (provv & 0x4) && (_provv == "B") || (provv & 0x8) && (_provv == "C")) + if (check_mov(provv, tipoprovv)) { - if (_datacomp >= inizio && _datacomp <= al) + if (data.ok() && data >= inizio && data <= al) { if (movap.blank()) { diff --git a/src/cg/cglib02.h b/src/cg/cglib02.h index 26a90f457..98f8d81b7 100755 --- a/src/cg/cglib02.h +++ b/src/cg/cglib02.h @@ -9,8 +9,25 @@ #ifndef __CGLIB01_H #include "../cg/cglib01.h" -#endif +#endif +#ifndef __MOV_H +#include +#endif + +#define PROVV "P" +#define PROVV_NON_CANC "N" +#define PROVV_BIL "B" +#define PROVV_CESP "C" + +static const char * __date_field_name[] = { MOV_DATAREG, MOV_DATACOMP, MOV_DATACOMPCR }; +inline bool check_mov(const int tipomovprovv, const TString & provvis) +{ + return ((tipomovprovv & 0x1) && provvis.blank()) || + ((tipomovprovv & 0x2) && ((provvis == PROVV) || (provvis == PROVV_NON_CANC))) || + ((tipomovprovv & 0x4) && (provvis == PROVV_BIL)) || + ((tipomovprovv & 0x8) && (provvis == PROVV_CESP)); +} #ifndef __CG2103_H class TCausale; #endif @@ -71,8 +88,11 @@ public: TRectype* saldi() const; }; -enum tipobil { DataLimite=1, UltimaImmissione }; +enum tipobil { DataLimite = 1, UltimaImmissione }; enum tiposal { normale, apertura, chiusura }; +enum TTipo_data { Registrazione, Competenza, CostiRicavi}; + +const TDate get_date_mov(const TRectype & mov, TTipo_data tipo_data); class TSaldo : public TObject { @@ -90,10 +110,6 @@ class TSaldo : public TObject int _annoes; int _indbil; TDate _inizioEs, _fineEs; - TString4 _codcaus; - TDate _datareg; - TDate _datacomp; - TString _provv; bool _prec; bool _movimentato; @@ -129,9 +145,9 @@ public: bool ultima_immissione_bilancio(int annoes, int g,int c,long s,int indbil,int provv = 0x1,bool saldo_chiusura = true); bool ultima_immissione_verifica(int annoes, int g,int c,long s,int indbil,int provv = 0x1); - bool data_limite_bilancio(int annoes,int g,int c,long s,const TDate& data_inf,const TDate& data_suo,int indbil, int provv = 0x1, const char* filter = nullptr); - const real& saldo_periodo(int g, int c, long s, const TDate& dal, const TDate& al, int indbil, int provv = 0x1); - bool saldo_cont_sep(int g, int c, long s, const int codes, TDate al, int indbil, const char * cont_sep, int provv = 0x1, bool chiusura = false, bool first = true); + bool data_limite_bilancio(TTipo_data tipo_data, int g, int c, long s, const TDate& data_inf, const TDate& data_suo, int indbil, int provv = 0x1, const char* filter = nullptr); + const real& saldo_periodo(TTipo_data tipo_data, int g, int c, long s, const TDate& dal, const TDate& al, int indbil, int provv = 0x1); + bool saldo_cont_sep(TTipo_data tipo_data, int g, int c, long s, const int codes, TDate al, int indbil, const char * cont_sep, int provv = 0x1, bool chiusura = false, bool first = true); bool ricerca_progr_prec(int, int, int, long); real saldofin_esprec(int,int,int,long,bool saldo_chiusura = FALSE, int provv = 0x1); diff --git a/src/cg/cglib03.cpp b/src/cg/cglib03.cpp index ce6ce4b2c..e86ba13c1 100755 --- a/src/cg/cglib03.cpp +++ b/src/cg/cglib03.cpp @@ -1,5 +1,4 @@ -#include "cg2103.h" -#include "cglib03.h" +#include "cglib.h" #include #include @@ -108,7 +107,6 @@ int analizza_IVA(const real& imptot, const real& ivatot, const real perc_ind, iva_ind = ZERO; } } - return flag; } @@ -458,6 +456,13 @@ bool TDociva_array::add_riga(const char* _descrdociva, const real& _importo,cons return found; } +/** + * \brief + * \param tipodoc + * \param descrdoc + * \param totdoc + * \return + */ bool TTipodoc_array::add_riga(const char* tipodoc, const char* descrdoc, const real& totdoc) { bool found = false; diff --git a/src/cg/cglib03.h b/src/cg/cglib03.h index 1104c9b35..8ace80c8b 100755 --- a/src/cg/cglib03.h +++ b/src/cg/cglib03.h @@ -3,8 +3,8 @@ #ifndef __CGLIB03_H #define __CGLIB03_H -#ifndef __CG2103_H -#include "cg2103.h" +#ifndef __CGLIB_H +#include "cglib.h" #endif #ifndef __TABUTIL_H diff --git a/src/cg/cglib04.cpp b/src/cg/cglib04.cpp index ca966b8b3..79732fcea 100755 --- a/src/cg/cglib04.cpp +++ b/src/cg/cglib04.cpp @@ -1,5 +1,5 @@ #define _CRT_SECURE_NO_WARNINGS -#include "cglib04.h" +#include "cglib.h" #include "cgsaldac.h" #include // RED ALERT! diff --git a/src/cg/cglib06.cpp b/src/cg/cglib06.cpp index ac9684576..569ec0417 100644 --- a/src/cg/cglib06.cpp +++ b/src/cg/cglib06.cpp @@ -1,5 +1,4 @@ #include "cglib.h" -#include "cg2101.h" #include "cgsaldac.h" @@ -375,6 +374,23 @@ real TMovimento_contabile::imposta(const char * codiva) const // Aggiustamento movimenti rovinati o convertiti male /////////////////////////////////////////////////////////// +class TConti_array : private TAssoc_array +{ +public: // TObject + virtual bool ok() const { return items() != 0; } + +public: + bool add(const TBill& conto, const real& importo); + real importo(const TBill& conto); + bool remove(const TBill& conto); + + bool add_iva(bool det, const real& importo); + real importo_iva(bool det); + bool remove_iva(bool det); + + TConti_array() {} + virtual ~TConti_array() {} +}; bool TConti_array::add(const TBill& conto, const real& importo) { diff --git a/src/cg/cgsaldac.cpp b/src/cg/cgsaldac.cpp index b89b7f8cf..5521cdc27 100755 --- a/src/cg/cgsaldac.cpp +++ b/src/cg/cgsaldac.cpp @@ -4,7 +4,7 @@ #include #include "cgsaldac.h" -#include "cg2103.h" +#include "cglib.h" #include #include @@ -462,9 +462,9 @@ char TRiga_scadenze::calcola_abbuono(int p, TImporto& abbuono, bool update) if (sign != 0) { if (sign > 0) - ap = abbuono.sezione() == 'D' ? 'A' : 'P'; + ap = abbuono.sezione() == 'D' ? cgrowtype_abbattivo : cgrowtype_abbpassivo; else - ap = abbuono.sezione() == 'D' ? 'P' : 'A'; + ap = abbuono.sezione() == 'D' ? cgrowtype_abbpassivo : cgrowtype_abbattivo; } } else diff --git a/src/cg/cgsaldac.h b/src/cg/cgsaldac.h index 840bb72eb..9d1170389 100755 --- a/src/cg/cgsaldac.h +++ b/src/cg/cgsaldac.h @@ -5,8 +5,8 @@ #include #endif -#ifndef __CGLIB01_H -#include "../cg/cglib01.h" +#ifndef __CGLIB_H +#include "cglib.h" #endif #ifndef __PARTITE_H diff --git a/src/f1/f1lib.cpp b/src/f1/f1lib.cpp index 1bf331f72..562c1f162 100644 --- a/src/f1/f1lib.cpp +++ b/src/f1/f1lib.cpp @@ -1,7 +1,6 @@ #include "f1lib.h" #include "config.h" -#include "cg2103.h" -#include "cg2102.h" +#include "cglib.h" #include "execp.h" #include "cfven.h" #include "reputils.h" diff --git a/src/fe/felib.cpp b/src/fe/felib.cpp index 15382739f..401a5a02b 100644 --- a/src/fe/felib.cpp +++ b/src/fe/felib.cpp @@ -6,7 +6,7 @@ #include "fe0100a.h" #include "felib.h" -#include "../cg/cg2103.h" +#include "cglib.h" #include #include diff --git a/src/fp/fplib.h b/src/fp/fplib.h index 8b6a48a69..70e5e3589 100644 --- a/src/fp/fplib.h +++ b/src/fp/fplib.h @@ -10,7 +10,7 @@ #include #include #include -#include "cg2103.h" +#include "cglib.h" #include #define SQL_FLD "sql/" diff --git a/src/mg/mag.h b/src/mg/mag.h index 9a38a3cc9..fbb11455d 100755 --- a/src/mg/mag.h +++ b/src/mg/mag.h @@ -48,5 +48,6 @@ #define MAG_LOTTORIOR "LOTTORIOR" // lotto minimo #define MAG_LOTTOIRIOR "LOTTOIRIOR" // lotto incrementale di riordino #define MAG_GIORNIRIOR "GIORNIRIOR" +#define MAG_UBICAZ "UBICAZ" #endif diff --git a/src/mg/mglib02.cpp b/src/mg/mglib02.cpp index 509734cf6..b2c75cdb5 100755 --- a/src/mg/mglib02.cpp +++ b/src/mg/mglib02.cpp @@ -1927,8 +1927,8 @@ TArticolo_conai::TArticolo_conai(const TString& codart) TString msg; msg.format("Errore nome campo: Articolo %s - Sottocategoria %s", (const char *)_codart, (const char *)con); message_box(msg); -#endif } +#endif } } } diff --git a/src/tp/tp0900.cpp b/src/tp/tp0900.cpp index a34f5a8e1..a10731ea9 100755 --- a/src/tp/tp0900.cpp +++ b/src/tp/tp0900.cpp @@ -98,13 +98,13 @@ protected: void elabora(const TMask& mask) const; bool scrivi_csv(const TRectype& prima_riga, TDichiarazione_CONAI_csv_recordset& csv, const TCONAI_class conai_specie, const TString & sottoclass, - const TString& conai_codart, TLog_report &log) const; + const TString& conai_codsp, TLog_report &log) const; void scrivi_csv_doc_con_riga_generata(const TDocumento& doc, const int n_riga_generata, TDichiarazione_CONAI_csv_recordset& csv, const TCONAI_class conai_specie, - const TString & sottoclass, TLog_report &log) const; - void scrivi_csv_doc_speciale(const TDocumento& doc, TDichiarazione_CONAI_csv_recordset& csv, - const TCONAI_class conai_specie, const TString & sottoclass, - const TString& conai_codart) const; + const TString & sottoclass, const TString& conai_codsp, TLog_report &log) const; + void scrivi_csv_doc_rettifiche(const TDocumento& doc, TDichiarazione_CONAI_csv_recordset& csv, + const TCONAI_class conai_specie, const TString & sottoclass, + const TString& conai_codsp) const; public: virtual bool create(); @@ -150,7 +150,7 @@ real TDichiarazione_CONAI::clifo_conai(const TCli_for& clifo, const TCONAI_class void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& doc, const int n_riga_generata, TDichiarazione_CONAI_csv_recordset& csv, const TCONAI_class conai_specie, const TString & sottoclass, - TLog_report &log) const + const TString& conai_codsp, TLog_report &log) const { //prende dalla riga i dati che gli servono per fare vari calcoli const TRiga_documento& riga_generata = doc[n_riga_generata]; @@ -181,14 +181,20 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do FOR_EACH_PHYSICAL_RDOC(doc, j, rdoc) { //quantita' totale conai (A + B) sul report + for (int k = 1; k <= FR_CMAX; k++) { const TString4 sottocat = rdoc->get(conai_sottocat_name(k)); if (sottocat == sottoclass) { - const real n = rdoc->calc_conai_qta(k); + real n; + if (rdoc->is_merce()) + n = rdoc->calc_conai_qta(k); + else + if (rdoc->is_spese() && !rdoc->is_generata() && rdoc->get(RDOC_CODART) == conai_codsp) + n = rdoc->get_real(RDOC_QTA); if (!n.is_zero()) { real * q = (real *)qta_AB_conai.objptr(j); @@ -287,6 +293,7 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do csv.set(12, qta_esente_conai); //valore totale contributo (BxC) sul report + const real totale_contrib_conai = qta_assoggettata_conai * prezzo; csv.set(14, TVariant(totale_contrib_conai)); @@ -309,9 +316,9 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do //riempie recordset con le righe CONAI del documento che NON ha una riga generata CONAI; trattasi di documenti.. //..farlocchi costruiti ad arte per correggere le vaccate dei rompiscatolifici -void TDichiarazione_CONAI::scrivi_csv_doc_speciale(const TDocumento& doc, TDichiarazione_CONAI_csv_recordset& csv, - const TCONAI_class conai_specie, const TString & sottoclass, - const TString& conai_codart) const +void TDichiarazione_CONAI::scrivi_csv_doc_rettifiche(const TDocumento& doc, TDichiarazione_CONAI_csv_recordset& csv, + const TCONAI_class conai_specie, const TString & sottoclass, + const TString& conai_codsp) const { //scopre se il doc e' una NAC const bool is_nac = doc.is_nota_credito(); @@ -333,83 +340,101 @@ void TDichiarazione_CONAI::scrivi_csv_doc_speciale(const TDocumento& doc, TDichi for (int j = 1; j <= FR_CMAX; j++) { TString4 sottocat = rdoc->get(conai_sottocat_name(j)); - const real peso = rdoc->get_real(conai_peso_name(j)); - if (sottocat == sottoclass && (peso != ZERO)) + if (sottocat == sottoclass) { - //puo' capitare che la sottocategoria sia stata troncata alla categoria - if (sottocat.len() == 2) - sottocat << "99"; + real peso; + real prezzo; + const TRectype& spp = cache().get("SPP", conai_codsp); + + if (rdoc->is_merce()) + { + prezzo = spp.get_real("R10"); - //creazione di un nuovo record da esportare - csv.new_rec(""); + peso = rdoc->get_real(conai_peso_name(j)); + } + else + if (rdoc->is_spese() && !rdoc->is_generata() && rdoc->get(RDOC_CODART) == conai_codsp) + { + peso = rdoc->get_real(RDOC_QTA); + prezzo = rdoc->get_real(RDOC_PREZZO); //va preso dalla riga stessa + } + if (sottocat == sottoclass && (peso != ZERO)) + { + //puo' capitare che la sottocategoria sia stata troncata alla categoria + if (sottocat.len() == 2) + sottocat << "99"; - //riempie i campi del record del csv - //codnum-anno-ndoc-datadoc-codcli-cofi-nriga-codagg1-sottocat-prezzo-um-conai(AB)-conai(B)-conai(A) - //parte chiave della riga - csv.set(0, rdoc->get(RDOC_CODNUM)); - csv.set(1, TVariant(rdoc->get(RDOC_ANNO))); - csv.set(2, TVariant(rdoc->get(RDOC_NDOC))); - csv.set(3, TVariant(datadoc)); - csv.set(4, TVariant(clifo.codice())); - csv.set(5, TVariant(clifo_paiv)); - csv.set(6, TVariant(rdoc->get(RDOC_CODART))); - csv.set(7, TVariant(rdoc->get(RDOC_NRIGA))); + //creazione di un nuovo record da esportare + csv.new_rec(""); - //codici conai - csv.set(8, TVariant(sottocat.left(2))); //codice materiale conai (es. carta, legno...) - csv.set(9, TVariant(sottocat)); //sottocodice materiale (es. carta imballo, busta...) + //riempie i campi del record del csv + //codnum-anno-ndoc-datadoc-codcli-cofi-nriga-codagg1-sottocat-prezzo-um-conai(AB)-conai(B)-conai(A) + //parte chiave della riga + csv.set(0, rdoc->get(RDOC_CODNUM)); + csv.set(1, TVariant(rdoc->get(RDOC_ANNO))); + csv.set(2, TVariant(rdoc->get(RDOC_NDOC))); + csv.set(3, TVariant(datadoc)); + csv.set(4, TVariant(clifo.codice())); + csv.set(5, TVariant(clifo_paiv)); + csv.set(6, TVariant(rdoc->get(RDOC_CODART))); + csv.set(7, TVariant(rdoc->get(RDOC_NRIGA))); - const TRectype& spp = cache().get("SPP", conai_codart); - //prezzo - const real prezzo = spp.get("R10"); // rdoc.get_real(RDOC_PREZZO); //va preso dalla riga stessa - csv.set(10, TVariant(prezzo)); + //codici conai + csv.set(8, TVariant(sottocat.left(2))); //codice materiale conai (es. carta, legno...) + csv.set(9, TVariant(sottocat)); //sottocodice materiale (es. carta imballo, busta...) - //um conai - const TString4 umqta = spp.get("S7"); //unita' di misura dalla tabella SPP - csv.set(11, TVariant(umqta)); + //prezzo + csv.set(10, TVariant(prezzo)); - //quantita' totale conai (A + B) sul report (le NAC hanno segno rovesciato) - real qta_tot_conai = rdoc->get_real(RDOC_QTA); + //um conai + const TString4 umqta = spp.get("S7"); //unita' di misura dalla tabella SPP + csv.set(11, TVariant(umqta)); - qta_tot_conai *= rdoc->get_real(conai_peso_name(j)); - if (is_nac) - qta_tot_conai = -qta_tot_conai; - csv.set(15, TVariant(qta_tot_conai)); + //quantita' totale conai (A + B) sul report (le NAC hanno segno rovesciato) + real qta_tot_conai = rdoc->get_real(RDOC_QTA); + const real qta_unitaria_conai = rdoc->get_real(conai_peso_name(j)); - //percentuale di esenzione conai al 100%? - const real rdoc_perc_conai = rdoc->get_real(conai_esenzione_name(conai_specie, LF_RIGHEDOC)); // ex QTAGG2 + if (qta_unitaria_conai != ZERO) + qta_tot_conai *= qta_unitaria_conai; + if (is_nac) + qta_tot_conai = -qta_tot_conai; + csv.set(15, TVariant(qta_tot_conai)); - //quantita' assoggettata (B) sul report (le NAC hanno segno rovesciato, ma avendolo gia' gia' rovesciato.. - //..in precedenza non deve fare nulla!) - real qta_assoggettata_conai = qta_tot_conai; + //percentuale di esenzione conai al 100%? + const real rdoc_perc_conai = rdoc->get_real(conai_esenzione_name(conai_specie, LF_RIGHEDOC)); // ex QTAGG2 - //segnalazione Sirio 1767: nelle righe fatte a mano, se la % di esenzione sul cliente è 100% -> la qta_assoggettata_conai.. - //..viene azzerata; questo perchè la rdoc_perc_conai può non essere modificabile a mano (ponendola = 100) se il verig non.. - //..è personalizzato - if (rdoc_perc_conai >= CENTO || cfven_perc_conai >= CENTO) // Guy: Mi pare strano gestire solo il caso 100% - qta_assoggettata_conai = ZERO; + //quantita' assoggettata (B) sul report (le NAC hanno segno rovesciato, ma avendolo gia' gia' rovesciato.. + //..in precedenza non deve fare nulla!) + real qta_assoggettata_conai = qta_tot_conai; - csv.set(13, TVariant(qta_assoggettata_conai)); + //segnalazione Sirio 1767: nelle righe fatte a mano, se la % di esenzione sul cliente è 100% -> la qta_assoggettata_conai.. + //..viene azzerata; questo perchè la rdoc_perc_conai può non essere modificabile a mano (ponendola = 100) se il verig non.. + //..è personalizzato + if (rdoc_perc_conai >= CENTO || cfven_perc_conai >= CENTO) // Guy: Mi pare strano gestire solo il caso 100% + qta_assoggettata_conai = ZERO; - //quantita' esente conai (A) sul report - const real qta_esente_conai = qta_tot_conai - qta_assoggettata_conai; //deve essere sempre ZERO! - csv.set(12, TVariant(qta_esente_conai)); + csv.set(13, TVariant(qta_assoggettata_conai)); - //valore totale contributo (BxC) sul report - const real totale_contrib_conai = qta_assoggettata_conai * prezzo; - csv.set(14, TVariant(totale_contrib_conai)); + //quantita' esente conai (A) sul report + const real qta_esente_conai = qta_tot_conai - qta_assoggettata_conai; //deve essere sempre ZERO! + csv.set(12, TVariant(qta_esente_conai)); - //percentuale di esenzione conai - csv.set(16, TVariant(rdoc_perc_conai)); + //valore totale contributo (BxC) sul report + const real totale_contrib_conai = qta_assoggettata_conai * prezzo; + csv.set(14, TVariant(totale_contrib_conai)); - //percentuale di esenzione conai in cfven - csv.set(17, TVariant(cfven_perc_conai)); - TString descr = cache().get("&VESCC", sottocat, "S2"); + //percentuale di esenzione conai + csv.set(16, TVariant(rdoc_perc_conai)); - if (descr.blank()) - descr = cache().get("&VESCC", sottocat, "S0"); - csv.set(18, descr); + //percentuale di esenzione conai in cfven + csv.set(17, TVariant(cfven_perc_conai)); + TString descr = cache().get("&VESCC", sottocat, "S2"); + + if (descr.blank()) + descr = cache().get("&VESCC", sottocat, "S0"); + csv.set(18, descr); + } } } } @@ -420,26 +445,27 @@ void TDichiarazione_CONAI::scrivi_csv_doc_speciale(const TDocumento& doc, TDichi //..il metodo adatto bool TDichiarazione_CONAI::scrivi_csv(const TRectype& prima_riga, TDichiarazione_CONAI_csv_recordset& csv, const TCONAI_class conai_specie, const TString & sottoclass, - const TString& conai_codart, TLog_report &log) const + const TString& conai_codsp, TLog_report &log) const { //crea la testata delle righedoc per poter fare vari calcoli (e intanto il tempo se ne va...) const int anno = prima_riga.get_int(RDOC_ANNO); const TString4 codnum = prima_riga.get(RDOC_CODNUM); const long numdoc = prima_riga.get_long(RDOC_NDOC); - //documento della prima riga e quindi anche di tutte le altre righe conai +#ifdef DBG + //check di debug + if (numdoc == 1451) + const int cazzone = 1; + if (numdoc == 5L) + int i = 1; +#endif + //documento della prima riga e quindi anche di tutte le altre righe conai TDocumento doc('D', anno, codnum, numdoc); //controlli sul cliente const TCli_for& clifo = doc.clifor(); const bool addconai = clifo.vendite().get_bool(CFV_ADDCONAI); -#ifdef DBG - //check di debug - if (numdoc == 1451) - const int cazzone = 1; -#endif - //se il cliente non c'entra con il conai e' inutile perdere tempo! if (!addconai) return false; @@ -449,13 +475,13 @@ bool TDichiarazione_CONAI::scrivi_csv(const TRectype& prima_riga, TDichiarazione int n_riga_generata = 0; bool has_conai_row = false; - + FOR_EACH_PHYSICAL_RDOC_BACK(doc, j, rdoc) { if (rdoc->is_generata() && rdoc->get(RDOC_GENTIPO) == "C") has_conai_row = true; - //c'è la riga generata con codart di tipo conai (sia automatica che manuale)? - if (rdoc->get(RDOC_CODART) == conai_codart && (rdoc->is_spese() || rdoc->is_generata())) + //c'è la riga generata con codsp di tipo conai (sia automatica che manuale)? + if (rdoc->get(RDOC_CODART) == conai_codsp && (rdoc->is_spese() && rdoc->is_generata())) { n_riga_generata = j; break; @@ -482,7 +508,7 @@ bool TDichiarazione_CONAI::scrivi_csv(const TRectype& prima_riga, TDichiarazione FOR_EACH_PHYSICAL_RDOC_BACK(doc, j, rdoc) { //c'è la riga generata con codart di tipo conai (sia automatica che manuale)? - if (rdoc->get(RDOC_CODART) == conai_codart && (rdoc->is_spese() || rdoc->is_generata())) + if (rdoc->get(RDOC_CODART) == conai_codsp && (rdoc->is_spese() || rdoc->is_generata())) { n_riga_generata = j; break; @@ -490,11 +516,24 @@ bool TDichiarazione_CONAI::scrivi_csv(const TRectype& prima_riga, TDichiarazione } } } - if (n_riga_generata > 0) - scrivi_csv_doc_con_riga_generata(doc, n_riga_generata, csv, conai_specie, sottoclass, log); - else - scrivi_csv_doc_speciale(doc, csv, conai_specie, sottoclass, conai_codart); - + if (n_riga_generata > 0) + scrivi_csv_doc_con_riga_generata(doc, n_riga_generata, csv, conai_specie, sottoclass, conai_codsp, log); + else + { + bool has_rettifica = false; + + FOR_EACH_PHYSICAL_RDOC(doc, j, rdoc) + { + //c'è la riga generata con codart di tipo conai (sia automatica che manuale)? + if (rdoc->get(RDOC_CODART) == conai_codsp && !rdoc->is_generata()) + { + has_rettifica = true; + break; + } + } + if (has_rettifica) + scrivi_csv_doc_rettifiche(doc, csv, conai_specie, sottoclass, conai_codsp); + } return true; } @@ -728,7 +767,7 @@ void TDichiarazione_CONAI::elabora(const TMask& mask) const for (bool ok_scc = scc.move_first(); ok_scc; ok_scc = scc.move_next()) { TString sottoclass(scc.get("CODTAB").as_string()); - TString codart(scc.get("S1").as_string()); + TString codsp(scc.get("S1").as_string()); TString msg(str); msg << " - Sottocategoria " << sottoclass << ')'; @@ -746,7 +785,7 @@ void TDichiarazione_CONAI::elabora(const TMask& mask) const const long ndoc = rdoc.get(RDOC_NDOC).as_int(); if (ndoc != last_ndoc) { - scrivi_csv(rdoc.cursor()->curr(), *csv, conai_specie, sottoclass, codart, log); + scrivi_csv(rdoc.cursor()->curr(), *csv, conai_specie, sottoclass, codsp, log); last_ndoc = ndoc; } } //for(bool ok = rdoc.move_first(.. diff --git a/src/utilities/fastrip.c b/src/utilities/fastrip.c deleted file mode 100644 index be1ef951e..000000000 --- a/src/utilities/fastrip.c +++ /dev/null @@ -1,73 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS - -#include -#include - - -void strip(FILE * i, FILE * o) -{ - char lin[513]; - - while (fgets(lin, 512, i) != NULL) - { - char instring = '\0'; - char wasspace = 0; - - char* c = lin; - for(; isspace(*c); c++); // salta spazi iniziali - - for (; *c; c++) - { - if (*c == '/' && *(c+1) == '/') - { - fputc('\n', o); - break; - } - - if (*c == '#') - { - fputc(*c, o); - while (isspace(*(++c))); - } - if (*c == '"' || *c == '\'') - { - if (instring == *c) - instring = '\0'; - else - { - if (instring == '\0') - instring = *c; - } - } - - if (isspace(*c)) - { - if (!instring) - { - if (wasspace && *c != '\n') - continue; - wasspace = 1; - } - } - else - wasspace = 0; - - fputc(*c, o); - } - } -} - - -int main(int argc, char ** argv) -{ -// cerr << "Strip 1.2 - White spaces filter by Guy 2012" << endl; - FILE* i = argc > 1 ? fopen(argv[1], "r") : stdin; - FILE* o = argc > 2 ? fopen(argv[2], "w") : stdout; - if (i && o) - strip(i, o); - if (o) - fclose(o); - if (i) - fclose(i); - return 0; -} diff --git a/src/utilities/fastrip.cpp b/src/utilities/fastrip.cpp new file mode 100644 index 000000000..32ff027b4 --- /dev/null +++ b/src/utilities/fastrip.cpp @@ -0,0 +1,77 @@ +#define _CRT_SECURE_NO_WARNINGS + +#include +#include +#include +#include +using namespace std; + +void strip(istream & i, ostream & o) +{ + unsigned char lin[2048]; + unsigned char* c; + + while (i.good()) + { + bool instring = false; + bool wasspace = false; + bool full = false; + + i.getline((char *)lin, 2048); + for (c = lin; isspace(*c); c++); // salta spazi iniziali + for (; *c; c++) + { + full = true; + if (*c == '/' && *(c+1) == '/') + { + o << '\n'; + break; + } + if (*c == '#') + { + o << *c; + while (isspace(*(++c))); + // c--; + } + else + if (*c == '"' || *c == '\'') + instring = !instring; + if (isspace(*c)) + { + if (!instring) + { + if (wasspace && *c != '\n') + continue; + wasspace = true; + } + } + else + wasspace = false; + o << *c; + } + if (full) + o << '\n'; + } +} + + +int main(int argc, char ** argv) +{ +// cerr << "Strip 1.2 - White spaces filter by Guy 2012" << endl; + if (argc == 1) + strip(cin, cout); + else + { + ifstream fin(argv[1]); + + if (argc == 2) + strip(fin, cout); + else + { + ofstream fout(argv[2]); + + strip(fin, fout); + } + } + return 0; +} diff --git a/src/utilities/patchdef.cpp b/src/utilities/patchdef.cpp index 1c2b15dd8..1fe95d431 100644 --- a/src/utilities/patchdef.cpp +++ b/src/utilities/patchdef.cpp @@ -1,51 +1,65 @@ #include #include -#include +#include +#include +using namespace std; - -void patch(istream& i, ostream& o) +void patch(istream & i, ostream & o) { - char lin[513]; + unsigned char lin[2048]; + unsigned char * c; while (i.good()) { - i.getline(lin, 512); - - for(char* c = lin; isspace(*c); c++); // salta spazi iniziali - - char instring = '\0'; - char wasspace = 0; - - for (char* cur = lin; *c; c++) + char instring = '\0'; + bool full = false; + + i.getline((char *) lin, 2048); + for(c = lin; isspace(*c); c++); // salta spazi iniziali + for (c ; *c; c++) { - if (*c == '!') + full = true; + if (*c == '!' && *(c + 1) == '!') { - if (*(c + 1) == '!') - { - c++; - *c = '#'; - } - } - if (*c == '#') - { - *cur++ = *c; - while isspace(*(++c)); - } - if (*c == ';') - *cur++ = '\n'; - else - *cur++ = *c; - } - *cur = '\0'; + o << '#'; + c++; - if (*lin) o << lin << endl; + } + else + if (*c == '#') + { + o << *c; + while (isspace(*(++c))); + c--; + } + else + if (*c == ';') + o << '\n'; + else + o << *c; + } + if (full) + o << '\n'; } } - -int main() +int main(int argc, char ** argv) { - patch(cin, cout); + if (argc == 1) + patch(cin, cout); + else + { + ifstream fin(argv[1]); + + if (argc == 2) + patch(fin, cout); + else + { + ofstream fout(argv[2]); + + patch(fin, fout); + } + } return 0; }  \ No newline at end of file diff --git a/src/ve/velib.h b/src/ve/velib.h index d7f7fcc38..772ee7d2b 100755 --- a/src/ve/velib.h +++ b/src/ve/velib.h @@ -24,13 +24,13 @@ class TViswin; #ifndef __CLIFOR_H #include "../ve/clifor.h" #endif - + #ifndef __VERIG_H #include "../ve/verig.h" #endif -#ifndef __CGLIB01_H -#include "../cg/cglib01.h" +#ifndef __CGLIB_H +#include "../cg/cglib.h" #endif diff --git a/src/ve/velib02.cpp b/src/ve/velib02.cpp index 62ecf7902..2886f6d63 100755 --- a/src/ve/velib02.cpp +++ b/src/ve/velib02.cpp @@ -177,17 +177,7 @@ TRiga_documento::TRiga_documento(const TRiga_documento & row) set_memo_fld("RG1"); copy(row); } - -/* Maialata inguardabile: guai a chi la riporta! -TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc, - const char * tipo) - : TAuto_variable_rectype(rec), _doc(doc) -{ - set_memo_fld("RG1"); - if (tipo) - set_tipo(tipo); -}*/ - + const TTipo_riga_documento& TRiga_documento::tipo(const char * tiporiga) { CHECK(tiporiga && *tiporiga, "Tipo riga documento nullo"); diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp index 36cfb9012..c374278fc 100755 --- a/src/ve/velib03.cpp +++ b/src/ve/velib03.cpp @@ -5,7 +5,8 @@ #include #include -#include "../cg/cg2103.h" +#include "velib.h" + #include "../db/dblib.h" #include "../pr/prlib.h" #include "../li/letint.h" @@ -17,7 +18,7 @@ #include #include "veini.h" -#include "velib.h" + #include "sconti.h" #include "vepriv.h" #include "veuml.h" @@ -251,7 +252,7 @@ void TDocumento::init() _codcf = new TRecfield(*this, DOC_CODCF); _cod_occas = new TRecfield(*this, DOC_OCFPI); - _sconto = _esenzione = _valfisc = NULL; + _sconto = _esenzione = _valfisc = nullptr; _stato_originale = ' '; _dirty_deny = false; @@ -301,13 +302,13 @@ TDocumento::TDocumento(const TRectype& rec) TDocumento::~TDocumento() { - delete _tipocf; - delete _codcf; - delete _cod_occas; + safe_delete(_tipocf); + safe_delete(_codcf); + safe_delete(_cod_occas); - if (_sconto != NULL) delete _sconto; - if (_esenzione != NULL) delete _esenzione; - if (_valfisc != NULL) delete _valfisc; + safe_delete(_sconto); + safe_delete(_esenzione); + safe_delete(_valfisc); } const TString& TDocumento::codiva_spese() const @@ -3123,7 +3124,6 @@ void TDocumento::update_conai() const TString4 cod_iva_cli = codesiva(); TConai conai; - FOR_EACH_ASSOC_OBJECT(_conaiqta, o, key, item) { const TString8 cod_sottocat = key; diff --git a/src/ve/velib04b.cpp b/src/ve/velib04b.cpp index c1972e999..6312255b1 100755 --- a/src/ve/velib04b.cpp +++ b/src/ve/velib04b.cpp @@ -1,7 +1,6 @@ #include "velib04.h" #include "../ca/calib01.h" -#include "../cg/cg2103.h" -#include "../cg/cglib02.h" +#include "../cg/cglib.h" #include "../cg/cgsaldac.h" #include "../in/inlib01.h" diff --git a/src/ve/velib04f.cpp b/src/ve/velib04f.cpp index bcde0a83f..e06b96b51 100755 --- a/src/ve/velib04f.cpp +++ b/src/ve/velib04f.cpp @@ -7,7 +7,7 @@ #include "../ca/rmovana.h" #include "../ca/rrip.h" #include "../cg/cg2101.h" -#include "../cg/cg2103.h" +#include "../cg/cglib.h" #include "../mg/anamag.h" /////////////////////////////////////////////////////////// diff --git a/src/ve/velib05.cpp b/src/ve/velib05.cpp index 84f616594..ae58797c1 100755 --- a/src/ve/velib05.cpp +++ b/src/ve/velib05.cpp @@ -3,7 +3,7 @@ #include #include -#include "../cg/cglib03.h" +#include "../cg/cglib.h" #include diff --git a/src/ve/velib06a.cpp b/src/ve/velib06a.cpp index a65f099d2..10a4e5393 100755 --- a/src/ve/velib06a.cpp +++ b/src/ve/velib06a.cpp @@ -21,8 +21,7 @@ #include "velib07.h" #include "ve0100n.h" -#include "../cg/cg2103.h" -#include "../cg/cglib03.h" +#include "../cg/cglib.h" #include "../db/dblib.h" #include "../mg/mglib.h" #include "../db/dblib.h" @@ -3080,9 +3079,10 @@ bool codcms_handler(TMask_field& f, KEY key) } //if (main_app().has_module(CTAUT) && (... //aggiornamento automatico del campo codice contabilita' separata nel caso di commessa che ce lo abbia - if (main_app().has_module(NPAUT) && (key == K_TAB && f.focusdirty())) + if (main_app().has_module(NPAUT) && f.running_check(key)) { const TString& contsep = cache().get(LF_COMMESSE, codcms, COMMESSE_CONTSEP); + mask.set(F_CONTSEP, contsep); } } diff --git a/src/ve/velib07.cpp b/src/ve/velib07.cpp index 2566714c8..b728c97ed 100755 --- a/src/ve/velib07.cpp +++ b/src/ve/velib07.cpp @@ -1,7 +1,7 @@ #include "velib07.h" #include "../cg/cgsaldac.h" -#include "../cg/cglib02.h" +#include "../cg/cglib.h" #include "../db/dblib.h" #include @@ -817,7 +817,7 @@ static real calcola_saldo_contabile(const char tipocf, const long codcf, const T const int indbil = row->get_int(2); TSaldo saldo; - real saldo_periodo = saldo.saldo_periodo(gruppo, conto, codcf, datainies, datacalc, indbil, false); + real saldo_periodo = saldo.saldo_periodo(Competenza, gruppo, conto, codcf, datainies, datacalc, indbil, false); saldone += saldo_periodo; } diff --git a/src/ve/verig.uml b/src/ve/verig.uml index 584d45493..a10a91d97 100755 --- a/src/ve/verig.uml +++ b/src/ve/verig.uml @@ -1,5 +1,4 @@ #include "veuml.h" -#ifdef FULL_SCREEN TOOLBAR "" 0 0 0 2 BUTTON DLG_OK 10 2 @@ -25,14 +24,13 @@ BEGIN END ENDPAGE -#endif #ifndef MASK_WIDTH -#define MASK_WIDTH 76 +#define MASK_WIDTH 0 #endif #ifndef MASK_HEIGHT -#define MASK_HEIGHT 21 +#define MASK_HEIGHT 0 #endif #ifndef MASK_TITLE1 @@ -158,7 +156,6 @@ END ENDIF ENDIF - IF(defined(FLD_CODART) || defined(FLD_CODALT)) IFDEF(FLD_CODART) @@ -1537,10 +1534,10 @@ ENDIF #include USR_PAGE_1 #endif -#ifdef PAGE_2 - ENDPAGE +#ifdef PAGE_2 + PAGE "Pag.2" -1 -1 MASK_WIDTH MASK_HEIGHT IFDEF(FLD_CODMAGC) @@ -2476,6 +2473,7 @@ ELSEIF FIELD CODAGG2 ENDIF END +ENDIF IFDEF(FLD_RIDPREZZO) CURRENCY FR_RIDPREZZO 18 @@ -2504,11 +2502,11 @@ ENDIF #include USR_PAGE_2 #endif -#endif - ENDPAGE -#ifdef IS_MERCE +#endif + +#ifdef HAS_CONAI PAGE "Conai" -1 -1 MASK_WIDTH MASK_HEIGHT @@ -2688,46 +2686,10 @@ BEGIN FIELD PCON(10) END -ENDIF - ENDPAGE #endif - -#ifndef FULL_SCREEN -ENDPAGE - -TOOLBAR "" 0 0 0 2 - -BUTTON DLG_OK 10 2 -BEGIN - PROMPT -14 -1 "" -END - -BUTTON DLG_CANCEL 10 2 -BEGIN - PROMPT -24 -1 "" -END - -#ifndef PAGE_1 -BUTTON DLG_DELREC 10 2 -BEGIN - PROMPT -34 -1 "Elimina" - MESSAGE EXIT,K_DEL -END - -BUTTON DLG_USER 10 2 -BEGIN - PROMPT -44 -1 "~Collega" - PICTURE BMP_LINK -END -#define PAGE_1 -#endif - -#endif - - PAGE "Contabilità analitica - Commesse" -1 -1 MASK_WIDTH MASK_HEIGHT GROUPBOX DLG_NULL 78 14 @@ -2811,4 +2773,6 @@ END ENDIF // Campi analitici +ENDPAGE + ENDMASK diff --git a/src/ve/verig00.uml b/src/ve/verig00.uml index 36f5012f1..e19ced7a1 100755 --- a/src/ve/verig00.uml +++ b/src/ve/verig00.uml @@ -2,7 +2,7 @@ #define FULL_SCREEN #define PAGE_2 -#define IS_MERCE +#define HAS_CONAI DEFINE_FIELD(CODMAG) DEFINE_FIELD(DESMAG) diff --git a/src/ve/verig02.uml b/src/ve/verig02.uml index ba4801727..c46953a65 100755 --- a/src/ve/verig02.uml +++ b/src/ve/verig02.uml @@ -3,8 +3,6 @@ #define FULL_SCREEN #define MASK_TITLE1 "Spese di tipo (Valore)" -#define PAGE_2 - DEFINE_FIELD(CODSPV) DEFINE_FIELD(DESCRSPV) diff --git a/src/ve/verig03.uml b/src/ve/verig03.uml index 7eda4180e..ec062d487 100755 --- a/src/ve/verig03.uml +++ b/src/ve/verig03.uml @@ -3,7 +3,7 @@ #define FULL_SCREEN #define MASK_TITLE1 "Spese di tipo (Quantita'/Prezzo)" -#define PAGE_2 +#define HAS_CONAI DEFINE_FIELD(CODSPQ) DEFINE_FIELD(DESCRSPQ) diff --git a/src/ve/verig04.uml b/src/ve/verig04.uml index 8ef9d3860..8969a9792 100755 --- a/src/ve/verig04.uml +++ b/src/ve/verig04.uml @@ -9,7 +9,6 @@ DEFINE_FIELD(DESCRSPP) DEFINE_FIELD(PERCSP) DEFINE_FIELD(CODIVA) DEFINE_FIELD(DESIVA) -#define PAGE_2 #include "verig.uml"