sync SVN r18058
This commit is contained in:
130
Programe/onom_preturi.prg
Normal file
130
Programe/onom_preturi.prg
Normal file
@@ -0,0 +1,130 @@
|
||||
Procedure viz_politici
|
||||
Private popolitici,popoliticiart,pcschema1,pcselect1
|
||||
Local llAfiseaza
|
||||
Store .F. To llAfiseaza
|
||||
Store '' To popolitici,popoliticiart
|
||||
If Used('crspoliticipret')
|
||||
Use In crspoliticipret
|
||||
Endif
|
||||
If Used('crspoliticiart')
|
||||
Use In crspoliticiart
|
||||
Endif
|
||||
|
||||
|
||||
pcschema1=['id_pol n(10), nume_lista_preturi c(100), datai d, datas d, id_valuta n(10), nume_val c(10), id_nota N(10), notaContab C(30), preturi_cu_tva N(1), utilizator c(100),dataora t, id_sucursala n(5), sucursala c(50), moneda_nationala n(1)']
|
||||
pcselect1=['select id_pol, nume_lista_preturi ,datai, datas, id_valuta, nume_val, id_nota, notaContab, preturi_cu_tva, utilizator, dataora,id_sucursala,sucursala,moneda_nationala from vcrm_politici_preturi where 1=2']
|
||||
pcorder1=[nume_lista_preturi ]
|
||||
pcfiltru1 = [2 = 2] + gcCondSucursala
|
||||
llAfiseaza = .F.
|
||||
gencursor('popolitici','crspoliticipret',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
||||
popolitici.ca_baza1.afisare()
|
||||
|
||||
pcschema1=['id_articol n(10), id_pol_art n(10), nume_articol c(100), um c(16), pret n(20,4), pretftva n(20,4), pretctva n(20,4),proc_tvav n(6,2), nume_val c(16),utilizator c(50),'+]+;
|
||||
['dataora t,codmat c(30),art_compus N(1),procent n(1),explicatie c(50),id_venchelt n(10),explicatie_venchelt c(50),um2 c(16),cant_bax n(20,4),reteta_principala n(10)']
|
||||
pcselect1=['select id_articol, id_pol_art, nume_articol,um,pret,pretftva, pretctva, proc_tvav,nume_val,utilizator,dataora,codmat,art_compus,procent,'+]+;
|
||||
["(case procent when 1 then '%' else nume_val end) as explicatie,id_venchelt,explicatie_venchelt,um2,cant_bax,reteta_principala "+]+;
|
||||
['from vcrm_politici_pret_art where 2=2']
|
||||
pcorder1=[nume_articol]
|
||||
pcfiltru1 = [1 = 2]
|
||||
llAfiseaza = .F.
|
||||
gencursor('popoliticiart','crspoliticiart',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
||||
popoliticiart.ca_baza1.afisare()
|
||||
|
||||
ofrmpolitici=Createobject('frm_politici_pret')
|
||||
ofrmpolitici.Show(1)
|
||||
Release ofrmpolitici,popolitici,popoliticiart
|
||||
Endproc && viz_politici
|
||||
|
||||
******************************************************************************************************************
|
||||
Procedure viz_note_vanzari
|
||||
Private poNote, poNoteIreg, pcschema1, pcselect1, pcschema2, pcselect2
|
||||
Local llAfiseaza
|
||||
Store .F. To llAfiseaza
|
||||
Store '' To poNote, poNoteIreg
|
||||
If Used('crsNote')
|
||||
Use In crsNote
|
||||
Endif
|
||||
If Used('crsNoteIreg')
|
||||
Use In crsNoteIreg
|
||||
Endif
|
||||
|
||||
pcschema1=['']
|
||||
pcselect1=['select * from vcrm_note_vanzari where 2=2']
|
||||
pcorder1=[denumire]
|
||||
pcfiltru1 = [1 = 2]
|
||||
llAfiseaza = .F.
|
||||
gencursor('poNote','crsNote',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
||||
poNote.ca_baza1.afisare()
|
||||
|
||||
pcselect2 = ['select * from note_contabile where 2=2']
|
||||
pcorder2 = [ordine]
|
||||
pcfiltru2 = [1 = 2]
|
||||
llAfiseaza = .F.
|
||||
gencursor('poNoteIreg','crsNoteIreg',pcselect2,pcfiltru2,pcschema1,pcorder2,llAfiseaza)
|
||||
poNoteIreg.ca_baza1.afisare()
|
||||
|
||||
Select crsNote
|
||||
ofrmNote = Createobject('frm_note_vanzari')
|
||||
ofrmNote.Show(1)
|
||||
Release poNote
|
||||
Release poNoteIreg
|
||||
Endproc && viz_note_vanzari
|
||||
***------------------------------------------------------------------------------------------------------------------------------
|
||||
Procedure viz_categ_articole
|
||||
|
||||
Private poCateg, pcschema1, pcselect1
|
||||
Local llAfiseaza
|
||||
Store .F. To llAfiseaza
|
||||
Store '' To poCateg
|
||||
If Used('crsCateg')
|
||||
Use In crsCateg
|
||||
Endif
|
||||
|
||||
pcschema1=['id_categ N(5), denumire C(30), grup_sup C(100), id_tata N(5), tata C(100), id_nota N(10), den_nota C(30), scd C(4), ascd C(4), scc C(4), ascc C(4)']
|
||||
pcselect1=['select id_categ, denumire, TRIM(SUBSTR(tata,1,INSTR(tata,CHR(92),1,nivel)-1)) as grup_sup, id_tata, tata, id_nota, den_nota, scd, ascd, scc, ascc from ]+gcS+[.vcrm_categ_note where 2=2']
|
||||
pcorder1=[denumire]
|
||||
pcfiltru1 = [1 = 2]
|
||||
llAfiseaza = .F.
|
||||
gencursor('poCateg','crsCateg',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
||||
poCateg.ca_baza1.afisare()
|
||||
|
||||
Select crsCateg
|
||||
ofrmCatArt = Createobject('frm_categ_articole')
|
||||
ofrmCatArt.Show(1)
|
||||
Release poCateg
|
||||
|
||||
Endproc && viz_categ_articole
|
||||
***------------------------------------------------------------------------------------------------------------------------------
|
||||
Function verifica_politica
|
||||
Lparameters tnIdPol,tnTipOperatie
|
||||
** tnTipOperatie = 1 - modificare
|
||||
** = 2 - stergere
|
||||
Local llReturn
|
||||
Store .T. To llReturn
|
||||
lcCursor = [crstestpol]
|
||||
lcSql = [select to_number(varvalue) as id_pol from optiuni where varname = 'ID_POL_PRET_STOC']
|
||||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||||
If lnSucces < 0
|
||||
amessagebox(goExecutor.cEroare,16,"Eroare")
|
||||
Else
|
||||
If Reccount(lcCursor)>0
|
||||
Select (lcCursor)
|
||||
lnIdPol = id_pol
|
||||
If lnIdPol = tnIdPol
|
||||
llReturn = .F.
|
||||
If tnTipOperatie = 1
|
||||
lcMesaj = Chr(9) + Chr(9) + Chr(9) + Chr(9) + [Nu puteti modifica articolele de pe aceasta politica,] + Chr(13) + Chr(10) + ;
|
||||
[deoarece este setata ca fiind politica de preturi pentru facturarea din stoc ( in ROAFACTURARE ) !]
|
||||
Else
|
||||
lcMesaj = Chr(9) + Chr(9) + Chr(9) + Chr(9) + [Nu puteti sterge aceasta politica,] + Chr(13) + Chr(10) + ;
|
||||
[deoarece este setata ca fiind politica de preturi pentru facturarea din stoc ( in ROAFACTURARE ) !]
|
||||
Endif
|
||||
amessagebox(lcMesaj,48,"Atentie")
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
If Used(lcCursor)
|
||||
Use In (lcCursor)
|
||||
Endif
|
||||
Return llReturn
|
||||
Endfunc && verifica_politica
|
||||
12
Programe/ovariabile_globale.prg
Normal file
12
Programe/ovariabile_globale.prg
Normal file
@@ -0,0 +1,12 @@
|
||||
PUBLIC gcCondLuna
|
||||
*!* gcCondLuna = [((((extract(month from datafact) =]+Alltrim(Str(gnLuna))+;
|
||||
*!* [ and extract(year from datafact) =]+Alltrim(Str(gnAn))+[) or (datafact is null ));
|
||||
*!* and ]+;
|
||||
*!* [ (extract (month from datai)<=]+Alltrim(Str(gnLuna)) + [ and extract(year from datai)<= ]+Alltrim(Str(gnAn))+[))]+;
|
||||
*!* [ or ((extract (month from dataoravalid)>= ]+Alltrim(Str(gnLuna))+[ and extract(year from dataoravalid)>=]+Alltrim(Str(gnAn)) +[)]+;
|
||||
*!* [ and id_tip > 1)]+ [)]
|
||||
|
||||
*!* lcDataFact= [ (a.facturat=1 and (extract(month from a.datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from a.datafact) =]+Alltrim(Str(gnAn))+[))]
|
||||
*!* lcDataValid = [ (a.validat=1 and (extract (month from a.dataoravalid)>= ]+Alltrim(Str(gnLuna))+[ and extract(year from a.dataoravalid)>=]+Alltrim(Str(gnAn)) +[)) ]
|
||||
*!* gcCondLuna = [ ((extract (month from a.datai)=]+Alltrim(Str(gnLuna)) + [ and extract(year from a.datai)= ]+Alltrim(Str(gnAn))+[) or ]+;
|
||||
*!* [ (a.id_tip=1 and (a.facturat=0 or ] + lcDataFact + [) ) or (a.id_tip>1 and (a.validat=0 or ] + lcDataValid + [))) ]
|
||||
1040
Programe/roapreturi.prg
Normal file
1040
Programe/roapreturi.prg
Normal file
File diff suppressed because it is too large
Load Diff
569
Programe/roapreturi_.prg
Normal file
569
Programe/roapreturi_.prg
Normal file
@@ -0,0 +1,569 @@
|
||||
Parameters tparam
|
||||
&&& roapreturi
|
||||
Local lchost, lcUserName, lcPassword, lnIdUtil, lnIdProgram, lcUserNameApp,lcPasswordApp
|
||||
Store '' To lchost, lcUserName, lcPassword, lcUserNameApp,lcPasswordApp
|
||||
Store 0 To lnIdUtil, lnIdProgram
|
||||
_Screen.Icon = ''
|
||||
|
||||
Private gcNumeProgram
|
||||
Local lcStem
|
||||
lcStem = Upper(Juststem(Sys(16,0)))
|
||||
gcNumeProgram=[ROAPRETURI]
|
||||
If gcNumeProgram != lcStem
|
||||
Messagebox("Nu puteti porni acest program!",0+16,"Atentie")
|
||||
Return
|
||||
Endif
|
||||
|
||||
Set Century On
|
||||
Set Deleted On
|
||||
Set Date To Dmy
|
||||
Set Mark To '/'
|
||||
Set Exclusive Off
|
||||
Set Cpdialog Off
|
||||
Set Talk Off
|
||||
Set Safety Off
|
||||
Set Escape Off
|
||||
Set Exact On
|
||||
Set Ansi On
|
||||
Set Console Off
|
||||
Set Notify Off
|
||||
Set Seconds Off
|
||||
Set NullDisplay To ''
|
||||
Set Decimals To 4
|
||||
|
||||
_Screen.Visible=.F.
|
||||
|
||||
|
||||
*VARIABILE_______
|
||||
Local lcMainClassLib
|
||||
Local lcLastSetTalk,lcLastSetPath,lcLastSetClassLib,lcOnShutdown
|
||||
|
||||
*VARIABILE__________________________________________________________________________
|
||||
Public CRLF
|
||||
Store Chr(13) + Chr(10) To CRLF
|
||||
|
||||
Public pcTitlu,pl_verificat
|
||||
Store "" To pcTitlu
|
||||
Store .F. To pl_verificat
|
||||
|
||||
Public buton,primadata,dirgen,col_menu
|
||||
Store 1 To buton,col_menu
|
||||
Store .T. To primadata &&,luna_neplatita
|
||||
|
||||
*-- Save and configure environment.***********************
|
||||
lcLastSetTalk=Set("TALK")
|
||||
Set Talk Off
|
||||
lcLastSetPath=Set("PATH")
|
||||
|
||||
Set Path To ;Date;Include;FERESTRE;GRAFICE;Help;CLASE;MENIURI;PROGRAME;RAPOARTE;PROGS;LIBS;
|
||||
PUSH Menu _Msysmenu
|
||||
lcLastSetClassLib=Set("CLASSLIB")
|
||||
lcMainClassLib="clase\opreturi"
|
||||
*CLASE__________________________________________________________
|
||||
Set Classlib To (lcMainClassLib) Additive
|
||||
Set Classlib To registry Additive
|
||||
Set Classlib To cauta_alfa_forms Additive
|
||||
|
||||
*PROCEDURI______________________________________________________
|
||||
Set Procedure To proceduri_comune Additive
|
||||
Set Procedure To quitapp Additive
|
||||
Set Procedure To init_program Additive
|
||||
|
||||
&& CLASE ORACLE
|
||||
Set Classlib To DECABAZA Additive
|
||||
Set Classlib To ferestre_oracle Additive
|
||||
Set Classlib To ofundal_preturi Additive
|
||||
Set Classlib To onom_preturi ADDITIVE
|
||||
SET CLASSLIB TO onote_contabile ADDITIVE
|
||||
|
||||
************************************************************************************************
|
||||
&& PROCEDURI ORACLE
|
||||
Set Procedure To GENCURSOR.PRG Additive
|
||||
Set Procedure To OPROCEDURI_COMUNE.PRG Additive
|
||||
Set Procedure To OPROCEDURI_aMS.PRG Additive
|
||||
Set Procedure To osecurity Additive
|
||||
Set Procedure To acces_meniu2 Additive
|
||||
Set Procedure To onom_preturi Additive
|
||||
* Set Procedure To update_preturi Additive
|
||||
Set Procedure To ocautare Additive
|
||||
Set Procedure To updateserver Additive
|
||||
Set Procedure To oheader Additive
|
||||
SET PROCEDURE TO omeniu_initializari ADDITIVE
|
||||
************************************************************************************************
|
||||
|
||||
If Pcount() = 1 And Type('tparam') = 'C'
|
||||
glParametri = .T.
|
||||
Private laParametri
|
||||
Declare laParametri[1]
|
||||
lcParam = Alltrim(tparam)
|
||||
lnNr = lista2array(lcParam,@laParametri,";")
|
||||
If lnNr < 5
|
||||
Messagebox('Numar incorect de parametri',0+16,'Eroare')
|
||||
Return
|
||||
Endif
|
||||
lchost = laParametri[1]
|
||||
lcUserName = laParametri[2]
|
||||
lcPassword = laParametri[3]
|
||||
lnIdUtil = Round(Val(laParametri[4]),0)
|
||||
lnIdProgram = Round(Val(laParametri[5]),0)
|
||||
Else
|
||||
glParametri = .F.
|
||||
lchost = 'JCSSERVER'
|
||||
lcUserName = 'CONTAFIN_ORACLE'
|
||||
lcPassword = ''
|
||||
lnIdUtil = 0
|
||||
lnIdProgram = 0
|
||||
|
||||
Endif
|
||||
|
||||
Public glVerificTabel && daca se verifica structura tabelelor in totv.prg
|
||||
glVerificTabel=.T.
|
||||
|
||||
Public glQuit
|
||||
glQuit = .F.
|
||||
|
||||
Public gnIdIstoric
|
||||
gnIdIstoric = 0
|
||||
|
||||
Public gcAppPath,gcAppName,gcAppDataPath, gcTempPath, gcCaleServerDate, gcUserNameApp, gcPasswordApp, gnId_Prg_Owner
|
||||
Store '' To gcUserNameApp, gcPasswordApp, gnNivelUtilizator, gnGrupUtilizator, gcAcces
|
||||
Public gcSchemaPath
|
||||
Store '' To gcSchemaPath
|
||||
Store 0 To gnId_Prg_Owner
|
||||
|
||||
gcAppPath=Addbs(Justpath(Sys(16,0))) && d:\roa\roapreturi\
|
||||
gcAppName=Allt(Uppe(Juststem(Sys(16,0)))) && "roapreturi"
|
||||
|
||||
gcAppDataPath=gcAppPath+"Date_"+gcAppName+"\"
|
||||
gcUtilizatoriPath = gcAppPath + "UTILIZATORI\"
|
||||
|
||||
Store "" To gcTempPath, gcCaleServerDate
|
||||
If !Directory(gcAppDataPath)
|
||||
Md (gcAppDataPath)
|
||||
Endif
|
||||
|
||||
*** DIRGEN
|
||||
liat = Rat("\",gcAppPath,2)
|
||||
dirgen = Addbs(Left(gcAppPath,liat-1))
|
||||
|
||||
gcSecurityPath = dirgen + 'Security\'
|
||||
gcSecurityFile = gcSecurityPath + 'ROA_SECURITY.TXT'
|
||||
|
||||
Cd &dirgen
|
||||
|
||||
Private poLog,goLog && obiect pt logarea mesajelor sistemului
|
||||
poLog = Newobject("Log_Mesaje","Log_Mesaje.prg")
|
||||
goLog = poLog
|
||||
|
||||
If verificari()
|
||||
_Screen.Visible=.T.
|
||||
Messagebox("Se fac verificari programului!"+CRLF+"Va rugam reveniti!",64,"ROA Preturi")
|
||||
glQuit= .T.
|
||||
Quit
|
||||
Endif
|
||||
|
||||
If !Debug_Start()
|
||||
lcParam=tparam
|
||||
If Empty(tparam) Or (Type('tParam')='C' And !verific_start(tparam,dirgen,gcAppName))
|
||||
_Screen.Visible=.T.
|
||||
Messagebox("Programul trebuie pornit doar din START!",64,"ROA Preturi")
|
||||
Quit
|
||||
Endif
|
||||
Endif
|
||||
|
||||
***************************** VARIABILE ORACLE
|
||||
Private gnHandle,gnidutil,GCCODFISCAL,GCADRESA,GCNUMEFIRMA,GNDIFZILE, gcUserNameApp, gcPasswordApp
|
||||
Private gnButon && variabila pentru renunt si terminat
|
||||
Store 2 To gnButon
|
||||
Store '' To GCCODFISCAL,GCADRESA,GCNUMEFIRMA,GCMONEDA, gcUserNameApp, gcPasswordApp, gcAcces
|
||||
gnHandle = -1
|
||||
gnidutil = 0
|
||||
|
||||
Private gcHost, gcUserName, gcPassword, gofundal, gnIdProgram
|
||||
gnIdProgram = 0
|
||||
gofundal=''
|
||||
|
||||
Private goFirma,gnId_Firma,gnIdFirma,gcFirma,gnAn,gnLuna && ,gnPA,gnPC
|
||||
Store Null To goFirma
|
||||
Store 0 To gnId_Firma, gnIdFirma, gnAn, gnLuna
|
||||
Store '' To gcFirma
|
||||
|
||||
Private glUltimaLuna,glPrimaLuna, glLunaBuna,glLuna_neplatita,glLunaInchisa
|
||||
Store .F. To glUltimaLuna,glPrimaLuna, glLunaBuna,glLuna_neplatita,glLunaInchisa
|
||||
|
||||
Private gcS && schema firmei
|
||||
Store 'CONTAFIN' To gcS
|
||||
|
||||
&& obiect global wrap pt sqlexec cu text eroare si succes
|
||||
Private goExecutor, goConn
|
||||
goExecutor = Createobject("oExecutor")
|
||||
goConn = Createobject("oConn")
|
||||
|
||||
&& obiect global pt luna aleasa din calendar
|
||||
Private goCalendar
|
||||
Store Null To goCalendar
|
||||
|
||||
gcHost = lchost
|
||||
gcUserName = lcUserName
|
||||
gcPassword = lcPassword
|
||||
gcUserNameApp = lcUserNameApp
|
||||
gcPasswordApp = lcPasswordApp
|
||||
gnidutil = lnIdUtil
|
||||
gnIdProgram = lnIdProgram
|
||||
|
||||
If !glParametri
|
||||
lnValid = getcrsSecurity(gcSecurityFile)
|
||||
If lnValid > 0
|
||||
If Used('crsHost')
|
||||
Select crsHost
|
||||
Go Top
|
||||
gcHost = Alltrim(Host)
|
||||
gcUserName = Alltrim(schema)
|
||||
gcPassword = Alltrim(pwd)
|
||||
Use In crsHost
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
***************************** VARIABILE ORACLE
|
||||
Public NUMEPROGRAM,FUNDALPROGRAM, antet
|
||||
NUMEPROGRAM='ROA Politici de preturi'
|
||||
MENIUPROGRAM="MENIU\roapreturi.mpr"
|
||||
|
||||
PRIVATE gcCopyRight
|
||||
gcCopyRight = '<27> ROA Romfast SRL'
|
||||
|
||||
*!* FUNDALPROGRAM=gcAppPath+"FERESTRE\FUNDAL.scx"
|
||||
|
||||
*-- Configure application object.*****************************
|
||||
* _Screen.WindowState=2
|
||||
_Screen.AutoCenter=.T.
|
||||
|
||||
lcOnShutdown="ShutDown()"
|
||||
On Shutdown &lcOnShutdown
|
||||
On Error ErrorHandler(Error(),Program(),Lineno())
|
||||
*!* _Shell="DO Cleanup IN progs\cont2003"
|
||||
|
||||
*-- Instantiate application object.***************************
|
||||
Release goApp
|
||||
Public goApp
|
||||
goApp=Createobject("cApplication")
|
||||
|
||||
Local laVersion
|
||||
Dimension laVersion(12)
|
||||
If Agetfileversion(laVersion, Sys(16,0)) > 0
|
||||
NUMEPROGRAM = laVersion(10)
|
||||
Endif
|
||||
Release laVersion
|
||||
|
||||
goApp.SetCaption(NUMEPROGRAM)
|
||||
goApp.cStartupMenu=MENIUPROGRAM
|
||||
goApp.cStartupForm = gcAppPath + 'ferestre\frm_login.scx'
|
||||
|
||||
* _Screen.WindowState=2
|
||||
|
||||
|
||||
*-- Show application.
|
||||
goApp.Show
|
||||
|
||||
*-- Release application.
|
||||
Release goApp
|
||||
|
||||
*-- Restore default menu.
|
||||
Pop Menu _Msysmenu
|
||||
|
||||
*-- Restore environment.
|
||||
On Error
|
||||
On Shutdown
|
||||
If Not lcLastSetClassLib==Set("classlib")
|
||||
Release Classlib (lcMainClassLib)
|
||||
Endif
|
||||
If Empty(lcLastSetPath)
|
||||
Set Path To
|
||||
Else
|
||||
Set Path To &lcLastSetPath
|
||||
Endif
|
||||
If lcLastSetTalk=="ON"
|
||||
Set Talk On
|
||||
Else
|
||||
Set Talk Off
|
||||
Endif
|
||||
|
||||
Return
|
||||
************************************************************************************************
|
||||
* FUNCTII______________________________________________________________________
|
||||
Function ErrorHandler(nError,cMethod,nLine)
|
||||
Local lcErrorMsg,lcCodeLineMsg
|
||||
|
||||
Wait Clear
|
||||
lcErrorMsg=Message()+Chr(13)+Chr(13)
|
||||
lcErrorMsg=lcErrorMsg+"Method: "+cMethod
|
||||
lcCodeLineMsg=Message(1)
|
||||
If Between(nLine,1,10000) And Not lcCodeLineMsg="..."
|
||||
lcErrorMsg=lcErrorMsg+Chr(13)+"Line: "+Alltrim(Str(nLine))
|
||||
If Not Empty(lcCodeLineMsg)
|
||||
lcErrorMsg=lcErrorMsg+Chr(13)+Chr(13)+lcCodeLineMsg
|
||||
Endif
|
||||
Endif
|
||||
If Messagebox(lcErrorMsg,17,_Screen.Caption)#1
|
||||
On Error
|
||||
Return .F.
|
||||
Endif
|
||||
Endfunc
|
||||
************************************************************************************************
|
||||
Function Shutdown
|
||||
If Start_Nou()
|
||||
=End_Istoric(gnIdIstoric, Addbs(dirgen)+"DATERETEA\", "START_ISTORIC")
|
||||
Endif
|
||||
If Type("goApp")=="O" And Not Isnull(goApp)
|
||||
Return goApp.OnShutDown()
|
||||
Endif
|
||||
Cleanup()
|
||||
Quit
|
||||
Endfunc
|
||||
************************************************************************************************
|
||||
Function Cleanup
|
||||
If Cntbar("_msysmenu")=7
|
||||
Return
|
||||
Endif
|
||||
On Error
|
||||
On Shutdown
|
||||
Set Classlib To
|
||||
Set Path To
|
||||
Clear All
|
||||
Close All
|
||||
Pop Menu _Msysmenu
|
||||
Return
|
||||
************************************************************************************************
|
||||
Function decodare1
|
||||
Parameters lstring,CHEIE
|
||||
Local lens,poz1,poz2,POZ3,lret,LRET2,lcstring,val1,lret1
|
||||
lret=''
|
||||
lret1=''
|
||||
LRET2=''
|
||||
lcstring=Alltrim(Upper(lstring))
|
||||
lens=Len(lcstring)
|
||||
For i=1 To 4
|
||||
poz1=Substr(lcstring,i,1)
|
||||
val1=Asc(poz1)
|
||||
POZ3=Substr(CHEIE,i,1)
|
||||
Do Case
|
||||
Case val1>=48 And val1<=57
|
||||
If ((val1-47)+Int(Val(POZ3)))<=10
|
||||
poz2=Chr(val1+Int(Val(POZ3)))
|
||||
Else
|
||||
poz2=Chr(val1+Int(Val(POZ3))-10)
|
||||
Endif
|
||||
Case val1>=65 And val1<=90
|
||||
If ((val1-64)+2*Int(Val(POZ3)))<=26
|
||||
poz2=Chr(val1+2*Int(Val(POZ3)))
|
||||
Else
|
||||
poz2=Chr(val1+2*Int(Val(POZ3))-26)
|
||||
Endif
|
||||
Endcase
|
||||
LRET2=LRET2+poz2
|
||||
Endfor
|
||||
For i=1 To lens
|
||||
poz1=Substr(LRET2,i,1)
|
||||
val1=Asc(poz1)
|
||||
Do Case
|
||||
Case val1>=48 And val1<=57
|
||||
If ((val1-47)+i)<=10
|
||||
poz2=Chr(val1+i)
|
||||
Else
|
||||
poz2=Chr(val1+i-10)
|
||||
Endif
|
||||
Case val1>=65 And val1<=90
|
||||
If ((val1-64)+2*i)<=26
|
||||
poz2=Chr(val1+2*i)
|
||||
Else
|
||||
poz2=Chr(val1+2*i-26)
|
||||
Endif
|
||||
Endcase
|
||||
lret=lret+poz2
|
||||
Endfor
|
||||
lens=Len(lret)
|
||||
For i=1 To lens
|
||||
poz1=Substr(lret,i,1)
|
||||
val1=Asc(poz1)
|
||||
Do Case
|
||||
Case val1>=48 And val1<=57
|
||||
poz2=Chr(val1+17)&& din 0-9 in A-J
|
||||
Case val1>=65 And val1<=74
|
||||
poz2=Chr(val1-17)&& din A-J in 0-9
|
||||
Case val1>=75 And val1<=82
|
||||
poz2=Chr(val1+8)&&din K-R in S-Z
|
||||
Case val1>=83 And val1<=90
|
||||
poz2=Chr(val1-8)&&din S-Z in K-R
|
||||
Endcase
|
||||
lret1=lret1+poz2
|
||||
Endfor
|
||||
Return lret1
|
||||
************************************************************************************************
|
||||
&&transformarea in decimal a unui caracter hexa
|
||||
Function HEXDEC
|
||||
Lparameters LC
|
||||
Local LV
|
||||
Do Case
|
||||
Case LC=='0'
|
||||
LV='0'
|
||||
Case LC=='1'
|
||||
LV='1'
|
||||
Case LC=='2'
|
||||
LV='2'
|
||||
Case LC=='3'
|
||||
LV='3'
|
||||
Case LC=='4'
|
||||
LV='4'
|
||||
Case LC=='5'
|
||||
LV='5'
|
||||
Case LC=='6'
|
||||
LV='6'
|
||||
Case LC=='7'
|
||||
LV='7'
|
||||
Case LC=='8'
|
||||
LV='8'
|
||||
Case LC=='9'
|
||||
LV='9'
|
||||
Case LC=='A'
|
||||
LV='10'
|
||||
Case LC=='B'
|
||||
LV='11'
|
||||
Case LC=='C'
|
||||
LV='12'
|
||||
Case LC=='D'
|
||||
LV='13'
|
||||
Case LC=='E'
|
||||
LV='14'
|
||||
Case LC=='F'
|
||||
LV='15'
|
||||
Endcase
|
||||
Return LV
|
||||
************************************************************************************************
|
||||
&&codarea binara din hexa pe patru biti
|
||||
Function DECTOBIN
|
||||
Parameters sc
|
||||
Local lretf
|
||||
Do Case
|
||||
Case sc=='0'
|
||||
lretf='0000'
|
||||
Case sc=='1'
|
||||
lretf='0001'
|
||||
Case sc=='2'
|
||||
lretf='0010'
|
||||
Case sc=='3'
|
||||
lretf='0011'
|
||||
Case sc=='4'
|
||||
lretf='0100'
|
||||
Case sc=='5'
|
||||
lretf='0101'
|
||||
Case sc=='6'
|
||||
lretf='0110'
|
||||
Case sc=='7'
|
||||
lretf='0111'
|
||||
Case sc=='8'
|
||||
lretf='1000'
|
||||
Case sc=='9'
|
||||
lretf='1001'
|
||||
Case sc=='10'
|
||||
lretf='1010'
|
||||
Case sc=='11'
|
||||
lretf='1011'
|
||||
Case sc=='12'
|
||||
lretf='1100'
|
||||
Case sc=='13'
|
||||
lretf='1101'
|
||||
Case sc=='14'
|
||||
lretf='1110'
|
||||
Case sc=='15'
|
||||
lretf='1111'
|
||||
Endcase
|
||||
Return lretf
|
||||
************************************************************************************************
|
||||
Function ECARACTER
|
||||
Parameters strg1
|
||||
Private pz,ch,lcstring,vret,lg1
|
||||
Store 0 To pz,lg1
|
||||
Store '' To ch,lcstring
|
||||
Store .T. To vret
|
||||
lcstring=Upper(strg1)
|
||||
lg1=Len(lcstring)
|
||||
For ind1=1 To lg1
|
||||
ch=Substr(lcstring,ind1,1)
|
||||
If (Not Between(Asc(ch),48,57)) And (Not Between(Asc(ch),65,90))
|
||||
vret=.F.
|
||||
Exit
|
||||
Endif
|
||||
Endfor
|
||||
Return vret
|
||||
************************************************************************************************
|
||||
Function sircaracter
|
||||
Parameters strg1
|
||||
Private pz,ch,lcstring,vret,lg1,lciesire
|
||||
Store 0 To pz,lg1
|
||||
Store '' To ch,lcstring,lciesire
|
||||
Store .T. To vret
|
||||
strg1=Strtran(strg1,Alltrim(Chr(39)),'')&&caracterul '
|
||||
strg1=Strtran(strg1,Alltrim(Chr(39)),'')&&caracterul "
|
||||
lcstring=Upper(Alltrim(strg1))
|
||||
lg1=Len(lcstring)
|
||||
For ind1=1 To lg1
|
||||
ch=Substr(lcstring,ind1,1)
|
||||
If Between(Asc(ch),48,57) Or Between(Asc(ch),65,90)
|
||||
lciesire=lciesire+ch
|
||||
Endif
|
||||
Endfor
|
||||
Return lciesire
|
||||
************************************************************************************************
|
||||
Procedure _DEBUG
|
||||
Private lcret,lcfisier,lcPath,lccalewin
|
||||
Declare Integer SHGetFolderPath In SHFOLDER.Dll ;
|
||||
INTEGER hwndOwner, ;
|
||||
INTEGER nFolder, ;
|
||||
INTEGER hToken, ;
|
||||
INTEGER dwFlags, ;
|
||||
STRING @ pszPath
|
||||
Declare Integer GetActiveWindow In WIN32API
|
||||
#Define CSIDL_WINDOWS 36
|
||||
|
||||
lcPath = Repl(Chr(0),261)
|
||||
=SHGetFolderPath(GetActiveWindow(),CSIDL_WINDOWS,0,0,@lcPath)
|
||||
lccalewin=Left(lcPath,At(Chr(0),lcPath)-1)
|
||||
|
||||
lcret=.F.
|
||||
lcfisier=Addbs(lccalewin)+[DEBUG.TXT]
|
||||
|
||||
If File(lcfisier)
|
||||
LCVAL=Filetostr(lcfisier)
|
||||
|
||||
LNVAL1=Mod(Val(Right(LCVAL,1)),2) && restul 1 sau 0; daca e impar e 1
|
||||
lnval2=Val(Left(LCVAL,Len(LCVAL)-1))
|
||||
If LNVAL1=1 Or Year(Date())-Month(Date())=lnval2
|
||||
lcret=.T.
|
||||
Endif
|
||||
Endif
|
||||
Return lcret
|
||||
|
||||
Endproc
|
||||
************************************************************************************************
|
||||
Function Start_Nou
|
||||
Return Exista_Branch(,,dirgen)
|
||||
Endfunc && start_nou
|
||||
************************************************************************************************
|
||||
Procedure Debug_Start
|
||||
lcFile = gcAppPath + "debug.txt"
|
||||
If File(lcFile) Or !Start_Nou()
|
||||
Return .T.
|
||||
Endif
|
||||
Return .F.
|
||||
Endproc && Debug_Start
|
||||
************************************************************************************************
|
||||
Procedure verificari
|
||||
Parameters tcFisierVerif
|
||||
|
||||
lcverificari = Addbs(gcAppPath)+gcAppName+".txt"
|
||||
If File(lcverificari)
|
||||
Return .T.
|
||||
Endif
|
||||
Return .F.
|
||||
Endproc && verificari
|
||||
************************************************************************************************
|
||||
3
Programe/shutdown.prg
Normal file
3
Programe/shutdown.prg
Normal file
@@ -0,0 +1,3 @@
|
||||
IF TYPE("goApp")=="O" AND NOT ISNULL(goApp)
|
||||
RETURN goApp.OnShutDown()
|
||||
ENDIF
|
||||
4
Programe/update_nomenclator.prg
Normal file
4
Programe/update_nomenclator.prg
Normal file
@@ -0,0 +1,4 @@
|
||||
**********************************************************
|
||||
PROCEDURE update_nomenclator
|
||||
|
||||
ENDPROC && update_nomenclator
|
||||
224
Programe/update_preturi.prg
Normal file
224
Programe/update_preturi.prg
Normal file
@@ -0,0 +1,224 @@
|
||||
*****************************************************************************
|
||||
Procedure update_elemente_doc
|
||||
Lparameters tnTipModelDoc,tnIdModelDoc
|
||||
If Used('v_elemente_doc')
|
||||
Use In v_elemente_doc
|
||||
Endif
|
||||
lcFiltru=[where a.id_tip_model_doc=]+Alltrim(Str(tnTipModelDoc))+[ and ]+;
|
||||
[(b.id_model_doc=]+ALLTRIM(STR(tnIdModelDoc))+[ or b.id_model_doc is null)]
|
||||
lcSql=[select a.id_coloana_doc,a.descriere,NVL(b.id_tip_tag_doc,0) as id_tip_tag_doc,]+;
|
||||
[b.tip_tag,b.pozitie ]+;
|
||||
[from ]+gcS+[.crm_vcoloane_documente a ]+;
|
||||
[left join ]+gcS+[.crm_velemente_document b ]+;
|
||||
[on a.id_coloana_doc = b.id_coloana_doc ] + ;
|
||||
lcFiltru
|
||||
lnSucces=goExecutor.oExecute(lcSql,'v_elemente_doc')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Else
|
||||
If Used('crselementedoc')
|
||||
Use In crselementedoc
|
||||
Endif
|
||||
Create Cursor crselementedoc(id_coloana_doc N(10),descriere C(100),id_tip_tag_doc N(10),;
|
||||
tip_tag C(100),pozitie C(100))
|
||||
Insert Into crselementedoc (id_coloana_doc,descriere,id_tip_tag_doc,tip_tag,pozitie) ;
|
||||
SELECT id_coloana_doc,descriere,id_tip_tag_doc,NVL(tip_tag,[]) as tip_tag,;
|
||||
NVL(pozitie,[]) as pozitie From v_elemente_doc
|
||||
GO top
|
||||
Use In v_elemente_doc
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
Endproc && update_elemente_doc
|
||||
*****************************************************************************
|
||||
Procedure update_coloane_doc
|
||||
Lparameters tnTipModelDoc
|
||||
If Used('v_coloane_doc')
|
||||
Use In v_coloane_doc
|
||||
Endif
|
||||
If !Empty(tnTipModelDoc)
|
||||
lcFiltru=[where id_tip_model_doc=]+Alltrim(Str(tnTipModelDoc))
|
||||
Else
|
||||
lcFiltru=[]
|
||||
Endif
|
||||
lcSql=[select id_coloana_doc,descriere from ] + gcS + [.crm_vcoloane_documente ]+;
|
||||
lcFiltru
|
||||
lnSucces=goExecutor.oExecute(lcSql,'v_coloane_doc')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Else
|
||||
If Used('crselementedoc')
|
||||
Use In crselementedoc
|
||||
Endif
|
||||
Create Cursor crselementedoc(id_coloana_doc N(10),descriere C(100),id_tip_tag_doc N(10),;
|
||||
tip_tag C(100),pozitie C(100))
|
||||
Insert Into crselementedoc (id_coloana_doc,descriere,id_tip_tag_doc) ;
|
||||
SELECT id_coloana_doc,descriere,0 As id_tip_tag_doc From v_coloane_doc
|
||||
GO top
|
||||
Use In v_coloane_doc
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
Endproc && update_coloane_doc
|
||||
*****************************************************************************
|
||||
Procedure update_tip_tag_document
|
||||
If Used('v_tip_tag')
|
||||
Use In v_tip_tag
|
||||
Endif
|
||||
lcSql=[select id_tip_tag_doc,tip_tag from ] + gcS + [.crm_vtip_tag_document where inactiv=0]
|
||||
lnSucces=goExecutor.oExecute(lcSql,'v_tip_tag')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
Endproc && update_tip_tag_document
|
||||
*****************************************************************************
|
||||
Procedure update_articole
|
||||
If Used('v_articole')
|
||||
Use In v_articole
|
||||
Endif
|
||||
lcSql=[select id_articol, codmat, denumire as nume_articol, um from ] + gcS + [.vnom_articole_crm order by denumire ]
|
||||
lnSucces=goExecutor.oExecute(lcSql,'v_articole')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
|
||||
Endproc && update_articole
|
||||
*****************************************************************************
|
||||
Procedure update_zone
|
||||
If Used('v_zone')
|
||||
Use In v_zone
|
||||
Endif
|
||||
lcSql=[select id_zona,zona from ] + gcS + [.crm_vzone where inactiv=0]
|
||||
lnSucces=goExecutor.oExecute(lcSql,'v_zone')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
|
||||
Endproc && update_zone
|
||||
*****************************************************************************
|
||||
Procedure update_agenti
|
||||
If Used('v_agenti')
|
||||
Use In v_agenti
|
||||
Endif
|
||||
lcSql=[select id_responsabil,nume_agent from ] + gcS + [.vnom_agenti ]+;
|
||||
[order by 2]
|
||||
lnSucces=goExecutor.oExecute(lcSql,'v_agenti')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
|
||||
Endproc && update_agenti
|
||||
*****************************************************************************
|
||||
Procedure update_articole_politica_pret
|
||||
Lparameters tnIdPol
|
||||
If Used('crsarticole')
|
||||
Use In crsarticole
|
||||
Endif
|
||||
lcSql=[select id_art as id_articol,nume_art as nume_articol,um,pret,nume_val,id_valuta from ] + gcS + [.vcrm_politici_pret_art ]+;
|
||||
[where id_pol=]+Alltrim(Str(tnIdPol))+[ order by 2]
|
||||
lnSucces=goExecutor.oExecute(lcSql,'crsarticole')
|
||||
If lnSucces < 0
|
||||
Messagebox(goExecutor.cEroare,0+16,'Eroare')
|
||||
Endif
|
||||
goExecutor.oReset()
|
||||
Return lnSucces
|
||||
|
||||
Endproc && update_articole_politica_pret
|
||||
*****************************************************************************
|
||||
** Functii cautare
|
||||
*****************************************************************************
|
||||
Function cauta_agent
|
||||
Lparameters tcIdAgent,tcNumeAgent
|
||||
Local locauta,llReturn
|
||||
Store "" To locauta
|
||||
Store .F. To llReturn
|
||||
pcselect = ["select id_responsabil,nume_agent,functie from ] + gcS + [.vnom_agenti "]
|
||||
pcfiltru = [1=2]
|
||||
pcschema = ['']
|
||||
pcorder = [2]
|
||||
pccoloane = [nume_agent,functie]
|
||||
pcTitlu = [Agent]
|
||||
pcTitluColoane = [Nume,Functie]
|
||||
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
|
||||
If !Empty(locauta.id_responsabil)
|
||||
tcIdAgent=locauta.id_responsabil
|
||||
tcNumeAgent=Alltrim(locauta.nume_agent)
|
||||
llReturn=.T.
|
||||
Endif
|
||||
Return llReturn
|
||||
Endfunc && cauta_agent
|
||||
*****************************************************************************
|
||||
Function cauta_valuta
|
||||
Lparameters tnIdValuta,tcNumeValuta
|
||||
Local locauta,llReturn
|
||||
Store "" To locauta
|
||||
Store .F. To llReturn
|
||||
pcselect = ["select id_valuta,nume_val from ] + gcS + [.vnom_valute "]
|
||||
pcfiltru = [1=2]
|
||||
pcschema = ['']
|
||||
pcorder = [2]
|
||||
pccoloane = [Nume_val]
|
||||
pcTitlu = [Valuta]
|
||||
pcTitluColoane = [Valuta]
|
||||
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
|
||||
|
||||
If !Empty(locauta.id_valuta)
|
||||
tnIdValuta=locauta.id_valuta
|
||||
tcNumeValuta=Alltrim(locauta.nume_val)
|
||||
llReturn=.T.
|
||||
Endif
|
||||
Return llReturn
|
||||
Endfunc && cauta_valuta
|
||||
*****************************************************************************
|
||||
Function cauta_zona
|
||||
Lparameters tnIdZona,tcNumeZona
|
||||
Local locauta,llReturn
|
||||
Store "" To locauta
|
||||
Store .F. To llReturn
|
||||
pcselect = ["select id_zona,zona from ] + gcS + [.crm_vzone where inactiv=0"]
|
||||
pcfiltru = [1=2]
|
||||
pcschema = ['']
|
||||
pcorder = [2]
|
||||
pccoloane = [Zona]
|
||||
pcTitlu = [Zona]
|
||||
pcTitluColoane = [Zona]
|
||||
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
|
||||
If !Empty(locauta.id_zona)
|
||||
tnIdZona=locauta.id_zona
|
||||
tcNumeZona=Alltrim(locauta.zona)
|
||||
llReturn=.T.
|
||||
Endif
|
||||
Return llReturn
|
||||
Endfunc && cauta_zona
|
||||
*****************************************************************************
|
||||
Function cauta_politica_preturi
|
||||
Lparameters tnIdPol,tcNumePolitica,tnIdValuta,tcNumeValuta
|
||||
Local locauta,llReturn
|
||||
Store "" To locauta
|
||||
Store .F. To llReturn
|
||||
pcselect = ["select id_pol,nume,datai,datas,id_valuta,nume_val from ] + gcS + [.crm_vpolitici_pret_curente"]
|
||||
pcfiltru = [1=2]
|
||||
pcschema = ['']
|
||||
pcorder = [2]
|
||||
pccoloane = [nume,datai,datas,nume_val]
|
||||
pcTitlu = [Politici de preturi actuale]
|
||||
pcTitluColoane = [Nume,Data inceput,Data sfarsit,Valuta]
|
||||
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
|
||||
If !Empty(locauta.id_pol)
|
||||
tnIdPol=locauta.id_pol
|
||||
tcNumePolitica=Alltrim(locauta.nume)
|
||||
tnIdValuta=locauta.id_valuta
|
||||
tcNumeValuta=Alltrim(locauta.nume_val)
|
||||
llReturn=.T.
|
||||
Endif
|
||||
Return llReturn
|
||||
Endfunc && cauta_politica_preturi
|
||||
*****************************************************************************
|
||||
Reference in New Issue
Block a user