240 lines
8.0 KiB
Plaintext
240 lines
8.0 KiB
Plaintext
* test_init_env_auto_roaimob.prg
|
|
* Varianta ROAIMOB a test_init_env_auto.prg (COMUN\utile\Teste): acesta seteaza gcAppPath fix pe
|
|
* D:\ROA\ROACONT\ (harness scris pentru ROACONT), deci nu poate testa cod din COMUN\ asa cum e
|
|
* editat in checkout-ul ROAIMOB (fiecare aplicatie are propriul working copy SVN al COMUN\).
|
|
* Identic altfel, minus class libs/proceduri specifice ROACONT (contabilitate) care nu exista sub
|
|
* ROAIMOB\COMUN sau ROAIMOB\Clase, si cu adaugarea celor specifice ROAIMOB (oimobilizari.vcx,
|
|
* ofundal_imob, serii_numere, onom_imob, oproceduri_imob, oproceduri_operatii, ofunctii_imob,
|
|
* oproceduri_listari, proceduri_meniu, sitan).
|
|
*
|
|
* Utilizare: DO test_init_env_auto_roaimob WITH 'CENTRAL', 'MARIUSM_AUTO', 'parola'
|
|
* ATENTIE: mentine sincronizat cu test_init_env_auto.prg pentru partea comuna si cu
|
|
* Programe\roaimob.prg pentru wiring-ul specific aplicatiei (SET PATH/CLASSLIB/PROCEDURE).
|
|
|
|
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, gcNumeProgram, gcAppName, glLunaInchisa, ;
|
|
buton, gnButon, pnButon, gl406, gcAcces
|
|
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
|
|
gcNumeProgram = [ROAIMOB]
|
|
gcAppName = [ROAIMOB]
|
|
glLunaInchisa = .F.
|
|
glEMama = .F.
|
|
gl406 = .F.
|
|
PUBLIC nror(65000)
|
|
buton = 1
|
|
gnButon = 1
|
|
pnButon = 1
|
|
|
|
LOCAL lcPath
|
|
PUBLIC gcAppPath, DIRGEN, gcBasePath, gcTempPath, gcGeneralIniFile, gcSettingsFile
|
|
gcAppPath = [D:\ROA\ROAIMOB\]
|
|
Set Default To (gcAppPath)
|
|
lcPath = gcAppPath + 'Date;' + ;
|
|
gcAppPath + 'Include;' + ;
|
|
gcAppPath + 'FERESTRE;' + ;
|
|
gcAppPath + 'GRAFICE;' + ;
|
|
gcAppPath + 'CLASE;' + ;
|
|
gcAppPath + 'MENIURI;' + ;
|
|
gcAppPath + 'PROGRAME;' + ;
|
|
gcAppPath + 'RAPOARTE;' + ;
|
|
gcAppPath + 'COMUN;' + ;
|
|
gcAppPath + 'COMUN\CLASE;' + ;
|
|
gcAppPath + 'COMUN\FERESTRE;' + ;
|
|
gcAppPath + 'COMUN\PROGRAME;' + ;
|
|
gcAppPath + 'COMUN\GRAFICE;' + ;
|
|
gcAppPath + 'COMUN\RAPOARTE;' + ;
|
|
gcAppPath + 'COMUN\MENIURI;' + ;
|
|
gcAppPath + 'COMUN\UTILE\GRIDEXTRAS;' + ;
|
|
gcAppPath + 'COMUN\UTILE\CTL32;' + ;
|
|
gcAppPath + 'COMUN\UTILE\HPDF;' + ;
|
|
gcAppPath + 'COMUN\UTILE\HPDF\REPORTOUTPUT;' + ;
|
|
gcAppPath + 'COMUN\UTILE\WEB;' + ;
|
|
gcAppPath + 'COMUN\UTILE\EXCEL;' + ;
|
|
Addbs(Substr(gcAppPath,1,Rat([\],gcAppPath,2)))+[COMUNROA\]
|
|
SET PATH TO &lcPath ADDITIVE
|
|
|
|
Set Classlib To appwiz Additive
|
|
Set Classlib To CAUT Additive
|
|
Set Classlib To BAZA Additive
|
|
Set Classlib To comun Additive
|
|
Set Classlib To oimobilizari.vcx Additive
|
|
Set Classlib To registry Additive
|
|
Set Classlib To cauta_alfa_forms Additive
|
|
Set Classlib To caut_ora Additive
|
|
Set Classlib To ofundal_imob Additive
|
|
Set Classlib To serii_numere Additive
|
|
|
|
Set Procedure To proceduri_comune Additive
|
|
Set Procedure To sitan Additive
|
|
Set Procedure To quitapp Additive
|
|
Set Procedure To init_program Additive
|
|
Set Procedure To oproceduri_listari Additive
|
|
Set Procedure To proceduri_meniu Additive
|
|
Set Procedure To oserii_numere Additive
|
|
Set Procedure To regex Additive
|
|
|
|
Set Classlib To DECABAZA Additive
|
|
Set Classlib To onomenclatoare Additive
|
|
Set Classlib To ferestre_oracle Additive
|
|
Set Classlib To onom_imob Additive
|
|
Set Classlib To otoolbar Additive
|
|
Set Classlib To ocriterii Additive
|
|
|
|
Set Classlib To MESSAGEBOX Additive
|
|
SET CLASSLIB TO wwdialogs.vcx additive
|
|
SET CLASSLIB TO serii_numere.vcx additive
|
|
SET CLASSLIB TO accessibility.vcx additive
|
|
SET CLASSLIB TO locale additive
|
|
|
|
Set Procedure To gencursor.prg Additive
|
|
Set Procedure To oproceduri_comune.prg Additive
|
|
Set Procedure To oproceduri_imob.prg Additive
|
|
Set Procedure To oproceduri_operatii.prg Additive
|
|
Set Procedure To ofunctii_imob.prg Additive
|
|
Set Procedure To oinit_optiuni.prg Additive
|
|
Set Procedure To update_imob.prg Additive
|
|
Set Procedure To updateserver.prg Additive
|
|
Set Procedure To oproceduri_ams.prg Additive
|
|
Set Procedure To ocautare.prg Additive
|
|
Set Procedure To osecurity.prg Additive
|
|
Set Procedure To acces_meniu.prg Additive
|
|
Set Procedure To oheader.prg Additive
|
|
Set Procedure To oproceduri_comune_imob.prg Additive
|
|
Set Procedure To cauta_alfa.prg Additive
|
|
Set Procedure To oexport.prg Additive
|
|
Set Procedure To validare.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 wwcodeupdate.prg additive
|
|
Set Procedure To wwhttp.prg ADDITIVE
|
|
Set Procedure To wwxmlhttp.prg ADDITIVE
|
|
Set Procedure To ini.prg ADDITIVE
|
|
Set Procedure To wwconfig.prg ADDITIVE
|
|
Set Procedure To excelxml.prg ADDITIVE
|
|
Set Procedure To wwutils.PRG Additive
|
|
Set Procedure To wwapi.PRG Additive
|
|
|
|
Declare Integer GetPrivateProfileString In WIN32API ;
|
|
string, String, String, String @, Integer, String
|
|
Declare Integer WritePrivateProfileString In Win32Api ;
|
|
string, String, String, String
|
|
Declare Integer CopyFile In WIN32API ;
|
|
STRING lpExistingFileName, STRING lpNewFileName, INTEGER bFailIfExists
|
|
Declare Integer PathFileExists In shlwapi STRING pszPath
|
|
|
|
If Type('goApi') = 'U'
|
|
Public goApi
|
|
goApi = Newobject("wwAPI", "wwAPI.prg")
|
|
ENDIF
|
|
|
|
set procedure to oinit_optiuni.prg additive
|
|
set procedure to oproceduri_comune.prg additive
|
|
|
|
PUBLIC gnHandle, goExecutor, goConn, goFirma, goCalendar, poLog, goLog, goApp
|
|
DIRGEN = [D:\ROA\]
|
|
gcBasePath = dirgen
|
|
gcGeneralIniFile = DIRGEN + "settings.ini"
|
|
gcSettingsFile = m.gcGeneralIniFile
|
|
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_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.
|