teste ANAF nomenclator: proba e2e pe formularul real + init mediu ROADEF
Proba end-to-end ruleaza formularul frm_firme_nou_desktopf peste nomenclatorul Oracle real; 997/1000 coduri fiscale reale potrivite corect. Testul sintetic acopera 42 de verificari, fara Oracle si fara ANAF. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015husoVS24ewJZr21ZoVR3v
This commit is contained in:
263
utile/Teste/test_init_env_auto_roadef.prg
Normal file
263
utile/Teste/test_init_env_auto_roadef.prg
Normal file
@@ -0,0 +1,263 @@
|
||||
* test_init_env_auto_roadef.prg
|
||||
* Varianta ROADEF a test_init_env_auto.prg (acel fisier e specializat pe ROACONT -
|
||||
* gcAppPath/clase/proceduri hardcodate D:\ROA\ROACONT\ - nu poate initializa mediul ROADEF).
|
||||
* Initializare completa de mediu FARA interactiune, pentru vfp9.exe -A -T.
|
||||
*
|
||||
* MOTIVUL EXISTENTEI: D:\ROA\ROACONT\COMUN si D:\ROA\ROADEF\COMUN sunt doua working copy-uri
|
||||
* SEPARATE ale aceluiasi COMUN din SVN, nu junctions. Un test pornit cu test_init_env_auto.prg
|
||||
* incarca D:\ROA\ROACONT\COMUN\programe\*.prg, deci NU vede modificarile necomise din
|
||||
* D:\ROA\ROADEF\COMUN si da rezultate false (verificat: AnafNomenclator lipseste acolo).
|
||||
* Testele pe cod ROADEF necomis folosesc acest fisier.
|
||||
*
|
||||
* Utilizare:
|
||||
* DO test_init_env_auto_roadef WITH 'CENTRAL', 'MARIUSM_AUTO', 'parola'
|
||||
* IF gnHandle <= 0 ... eroare conectare
|
||||
* Mediu de test standard: server CENTRAL, schema MARIUSM_AUTO.
|
||||
*
|
||||
* Dupa apel sunt disponibile: goConn/goExecutor/goApp/goLog/goApi, goFirma/goCalendar,
|
||||
* gnAn/gnLuna/gcS/gnIdFirma/gnScrieRegistru etc., SET PATH/CLASSLIB/PROCEDURE ca in roadef.prg.
|
||||
* ATENTIE: mentine lista de SET CLASSLIB/PROCEDURE sincronizata cu Programe\roadef.prg.
|
||||
|
||||
LPARAMETERS tcHost, tcSchema, tcPassword, tnAn, tnLuna
|
||||
|
||||
tcHost = IIF(EMPTY(tcHost), 'CENTRAL', tcHost)
|
||||
tcSchema = IIF(EMPTY(tcSchema), 'MARIUSM_AUTO', tcSchema)
|
||||
tcPassword = IIF(EMPTY(tcPassword), 'ROMFASTSOFT', tcPassword)
|
||||
|
||||
SET DELETED ON
|
||||
SET ANSI ON
|
||||
SET EXACT ON
|
||||
SET SAFETY OFF
|
||||
CLOSE DATABASES
|
||||
SET CENTURY ON
|
||||
SET DATE DMY
|
||||
SET NULLDISPLAY TO ''
|
||||
|
||||
PUBLIC CT_SUCCES, CT_INSUCCES, crlf, gnAn, gnLuna, gnIdUtil, glEMama, gnIdFirma, gcCondSucursala, ;
|
||||
gnIdSucursala, gcS, gcFirma, gcUserName, gcUserNameApp, gcNumeProgram, gcAppName, glLunaInchisa, ;
|
||||
buton, gnButon, pnButon, gl406, gcAcces, gnid_prg_owner, gnScrieRegistru, ;
|
||||
pcTitlu, pl_verificat, a4, gcUtilizatoriPath, gcPasswordApp, gcCaleServerDate, ;
|
||||
gnNivelUtilizator, gnGrupUtilizator
|
||||
CT_SUCCES = 1
|
||||
CT_INSUCCES = -1
|
||||
crlf = CHR(13) + CHR(10)
|
||||
gnAn = IIF(EMPTY(tnAn), YEAR(DATE()), tnAn)
|
||||
gnLuna = IIF(EMPTY(tnLuna), MONTH(DATE()), tnLuna)
|
||||
gnIdUtil = -3
|
||||
gnIdFirma = 110
|
||||
gcCondSucursala = []
|
||||
gnIdSucursala = m.gnIdFirma
|
||||
gcS = UPPER(ALLTRIM(tcSchema))
|
||||
gcFirma = m.gcS
|
||||
gcUserName = m.gcS
|
||||
gcUserNameApp = [MARIUS M]
|
||||
gcPasswordApp = []
|
||||
gcNumeProgram = [ROADEF]
|
||||
gcAppName = [ROADEF]
|
||||
glLunaInchisa = .F.
|
||||
glEMama = .F.
|
||||
gl406 = .F.
|
||||
gnid_prg_owner = 0
|
||||
pcTitlu = []
|
||||
pl_verificat = .F.
|
||||
a4 = .T.
|
||||
gnNivelUtilizator = 0
|
||||
gnGrupUtilizator = 0
|
||||
gcCaleServerDate = []
|
||||
* gnScrieRegistru: optiune de firma (registrul electronic al salariatilor). frm_firme_nou.Init
|
||||
* o citeste NEPROTEJAT (ofirma.vc2, "IF gnScrieRegistru = 0"), deci trebuie sa existe INAINTE de
|
||||
* optiuni_firma; daca optiunile o redefinesc mai jos, valoarea lor castiga.
|
||||
gnScrieRegistru = 0
|
||||
* PUBLIC, nu Declare: nrcrt() (oproceduri_comune.prg) citeste NROR din ControlSource-uri
|
||||
* de grid mult dupa ce acest program s-a terminat (Declare ar muri la RETURN)
|
||||
PUBLIC nror(65000)
|
||||
buton = 1
|
||||
gnButon = 1
|
||||
pnButon = 1
|
||||
|
||||
LOCAL lcPath
|
||||
PUBLIC gcAppPath, DIRGEN, gcDirMare, gcBasePath, gcTempPath, gcGeneralIniFile, gcSettingsFile, ;
|
||||
gcSecurityPath, gcSecurityFile
|
||||
gcAppPath = [D:\ROA\ROADEF\]
|
||||
Set Default To (gcAppPath)
|
||||
lcPath = gcAppPath + 'Date;' + ;
|
||||
gcAppPath + 'Include;' + ;
|
||||
gcAppPath + 'FERESTRE;' + ;
|
||||
gcAppPath + 'GRAFICE;' + ;
|
||||
gcAppPath + 'CLASE;' + ;
|
||||
gcAppPath + 'MENIURI;' + ;
|
||||
gcAppPath + 'PROGRAME;' + ;
|
||||
gcAppPath + 'RAPOARTE;' + ;
|
||||
gcAppPath + 'COMUN\CLASE;' + ;
|
||||
gcAppPath + 'COMUN\FERESTRE;' + ;
|
||||
gcAppPath + 'COMUN\PROGRAME;' + ;
|
||||
gcAppPath + 'COMUN\GRAFICE;' + ;
|
||||
gcAppPath + 'COMUN\RAPOARTE;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\CTL32;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\HPDF;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\HPDF\REPORTOUTPUT;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\WEB;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\NFJSON;' + ;
|
||||
Addbs(Substr(gcAppPath,1,Rat([\],gcAppPath,2)))+[COMUNROA\]
|
||||
SET PATH TO &lcPath ADDITIVE
|
||||
|
||||
Local lcMainClassLib
|
||||
lcMainClassLib = gcAppPath + "clase\ofundal_sal"
|
||||
SET CLASSLIB TO (lcMainClassLib) ADDITIVE
|
||||
SET CLASSLIB TO CAUT ADDITIVE
|
||||
SET CLASSLIB TO ooptiuni ADDITIVE
|
||||
SET CLASSLIB TO ferestre_cere_date ADDITIVE
|
||||
SET CLASSLIB TO oblocare ADDITIVE
|
||||
SET CLASSLIB TO registry ADDITIVE
|
||||
SET CLASSLIB TO decabaza ADDITIVE
|
||||
SET CLASSLIB TO onomenclatoare ADDITIVE
|
||||
SET CLASSLIB TO onom_sal ADDITIVE
|
||||
SET CLASSLIB TO cauta_alfa_forms ADDITIVE
|
||||
SET CLASSLIB TO ferestre_oracle ADDITIVE
|
||||
SET CLASSLIB TO caut_ora ADDITIVE
|
||||
SET CLASSLIB TO otoolbar ADDITIVE
|
||||
SET CLASSLIB TO Messagebox ADDITIVE
|
||||
SET CLASSLIB TO opersonal ADDITIVE
|
||||
SET CLASSLIB TO oasociere ADDITIVE
|
||||
SET CLASSLIB TO ofirma ADDITIVE
|
||||
SET CLASSLIB TO ferestre_roadef ADDITIVE
|
||||
SET CLASSLIB TO oconfigurare_seturi.vcx ADDITIVE
|
||||
SET CLASSLIB TO wwdialogs.vcx ADDITIVE
|
||||
SET CLASSLIB TO overificari.vcx ADDITIVE
|
||||
SET CLASSLIB TO appwiz.vcx ADDITIVE
|
||||
SET CLASSLIB TO accessibility.vcx ADDITIVE
|
||||
|
||||
SET PROCEDURE TO acces_meniu ADDITIVE
|
||||
SET PROCEDURE TO ooperatii_comune ADDITIVE
|
||||
SET PROCEDURE TO quitapp ADDITIVE
|
||||
SET PROCEDURE TO init_program ADDITIVE
|
||||
SET PROCEDURE TO proceduri_comune ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_comune ADDITIVE
|
||||
SET PROCEDURE TO gencursor.prg ADDITIVE
|
||||
SET PROCEDURE TO updateserver.prg ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_maintenance.prg ADDITIVE
|
||||
SET PROCEDURE TO onomenclatoare ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_ams ADDITIVE
|
||||
SET PROCEDURE TO ocautare ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_roadef_sal ADDITIVE
|
||||
SET PROCEDURE TO oinit_optiuni ADDITIVE
|
||||
SET PROCEDURE TO osecurity ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_roadef ADDITIVE
|
||||
SET PROCEDURE TO wwcodeupdate.prg ADDITIVE
|
||||
SET PROCEDURE TO wwxmlhttp.prg ADDITIVE
|
||||
SET PROCEDURE TO ini.prg ADDITIVE
|
||||
SET PROCEDURE TO osalarii_comun.prg ADDITIVE
|
||||
SET PROCEDURE TO wwutils.prg ADDITIVE
|
||||
SET PROCEDURE TO proceduri_Excel.prg ADDITIVE
|
||||
SET PROCEDURE TO cauta_alfa.prg ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_app.prg ADDITIVE
|
||||
SET PROCEDURE TO iniacces.prg ADDITIVE
|
||||
SET PROCEDURE TO oupdate.prg ADDITIVE
|
||||
SET PROCEDURE TO procese.prg ADDITIVE
|
||||
SET PROCEDURE TO version.prg ADDITIVE
|
||||
SET PROCEDURE TO xmlaccess.prg ADDITIVE
|
||||
SET PROCEDURE TO xmlparser.prg ADDITIVE
|
||||
SET PROCEDURE TO filebringer.prg ADDITIVE
|
||||
SET PROCEDURE TO wwhttp.prg ADDITIVE
|
||||
SET PROCEDURE TO wwApi.prg ADDITIVE
|
||||
SET PROCEDURE TO validare.prg ADDITIVE
|
||||
SET PROCEDURE TO nfjsonread.prg ADDITIVE
|
||||
SET PROCEDURE TO nfjsoncreate.prg ADDITIVE
|
||||
|
||||
Declare Integer GetPrivateProfileString In Kernel32 ;
|
||||
string, String, String, String @, Integer, String
|
||||
Declare Integer WritePrivateProfileString In Kernel32 ;
|
||||
string, String, String, String
|
||||
Declare Integer CopyFile In kernel32 ;
|
||||
STRING lpExistingFileName, STRING lpNewFileName, INTEGER bFailIfExists
|
||||
Declare Integer URLDownloadToFile In urlmon.Dll ;
|
||||
INTEGER pCaller, String szURL, String szFileName, INTEGER dwReserved, Integer lpfnCB
|
||||
Declare Integer PathFileExists In shlwapi STRING pszPath
|
||||
|
||||
If Type('goApi') = 'U'
|
||||
Public goApi
|
||||
goApi = Newobject("wwAPI", "wwAPI.prg")
|
||||
ENDIF
|
||||
|
||||
PUBLIC gnHandle, goExecutor, goConn, goFirma, goCalendar, poLog, goLog, goApp
|
||||
DIRGEN = [D:\ROA\]
|
||||
gcDirMare = DIRGEN
|
||||
gcBasePath = DIRGEN
|
||||
gcSecurityPath = DIRGEN + 'Security\'
|
||||
gcSecurityFile = gcSecurityPath + 'ROA_SECURITY.TXT'
|
||||
gcGeneralIniFile = DIRGEN + "settings.ini"
|
||||
gcSettingsFile = m.gcGeneralIniFile
|
||||
gcUtilizatoriPath = gcAppPath + "UTILIZATORI\"
|
||||
gcTempPath = Addbs(Shortpath(goApi.GetTempPath())) + gcS + [\]
|
||||
If !Directory(gcTempPath)
|
||||
Md (gcTempPath)
|
||||
Endif
|
||||
gcAcces = [1;2;3;4;5;6;7;8;]
|
||||
|
||||
poLog = Newobject("Log_Mesaje", "Log_Mesaje.prg")
|
||||
goLog = poLog
|
||||
goApp = Createobject("wzApplication")
|
||||
gnHandle = 0
|
||||
goExecutor = Createobject("oExecutor")
|
||||
goConn = Createobject("oConn")
|
||||
goConn.Connect(m.tcHost, m.tcSchema, m.tcPassword)
|
||||
IF m.gnHandle <= 0
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
LOCAL llSucces, lcSql
|
||||
goFirma = null
|
||||
llSucces = goExecutor.oExecuta("select * from syn_v_nom_firme where schema = ?gcS", "cFirma")
|
||||
IF m.llSucces
|
||||
SELECT cFirma
|
||||
gnIdFirma = id_firma
|
||||
gnIdSucursala = null
|
||||
gcFirma = ALLTRIM(firma)
|
||||
SCATTER NAME goFirma
|
||||
IF TYPE('goFirma.codfiscalfro') = 'U'
|
||||
ADDPROPERTY(goFirma, 'codfiscalfro', ALLTRIM(STRTRAN(ALLTRIM(NVL(goFirma.cod_fiscal, '')), 'RO', '')))
|
||||
ENDIF
|
||||
ELSE
|
||||
goFirma = CREATEOBJECT('custom')
|
||||
goFirma.addproperty('cod_fiscal', '')
|
||||
goFirma.addproperty('schema', m.gcS)
|
||||
goFirma.addproperty('firma', m.gcS)
|
||||
goFirma.addproperty('codfiscalfro', '')
|
||||
ENDIF
|
||||
USE IN (SELECT('cFirma'))
|
||||
|
||||
goCalendar = null
|
||||
llSucces = goExecutor.oExecuta('SELECT anul, luna, tva_incasare FROM calendar WHERE an*12+luna = (select MAX(an*12+luna) FROM calendar)', 'cCalendar')
|
||||
IF m.llSucces
|
||||
SELECT cCalendar
|
||||
GO TOP
|
||||
IF EMPTY(m.tnAn)
|
||||
gnAn = anul
|
||||
gnLuna = luna
|
||||
ENDIF
|
||||
SCATTER NAME goCalendar
|
||||
ENDIF
|
||||
USE IN (SELECT('cCalendar'))
|
||||
|
||||
CREATE CURSOR dual (dummy c(10))
|
||||
INSERT INTO dual (dummy) VALUES ("")
|
||||
|
||||
actualizeaza_optiuni()
|
||||
Do optiuni_firma IN oinit_optiuni.prg
|
||||
|
||||
lcSql = [begin pack_sesiune.set_Id_Util(?gnIdUtil); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
lcSql = [begin pack_sesiune.setluna(?gnLuna); pack_sesiune.setan(?gnAn); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
lcSql = [begin pack_sesiune.setlunabal(?gnLuna); pack_sesiune.setanbal(?gnAn); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
lcSql = [begin pack_contafin.SET_DATA_RON(?gcS); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
lcSql = [begin pack_sesiune.set_data_ron(?gcS); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
lcSql = [begin pack_contafin.set_id_sucursala(?gnIdSucursala); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
lcSql = [begin pack_contafin.set_id_firma(?gnIdFirma); end;]
|
||||
llSucces = goExecutor.oExecuta(lcSql)
|
||||
|
||||
RETURN .T.
|
||||
Reference in New Issue
Block a user