Import initial din SVN ROAAUTO/Trunk @HEAD

This commit is contained in:
2026-04-11 17:11:32 +03:00
commit 656d98697f
1856 changed files with 163525 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
COMUN/datemenu/menu1.cdx Normal file

Binary file not shown.

BIN
COMUN/datemenu/menu1.dbf Normal file

Binary file not shown.

BIN
COMUN/datemenu/menu1.fpt Normal file

Binary file not shown.

BIN
COMUN/datemenu/mila1.dbf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,30 @@
Trebuie adaugate in update_nomenclator.prg :
goExecutor.oExecute([select id_set, nr_set, nume_set, fix as fixTemp, lista_note, explicatia, model, ] + ;
[formgest, nu_sterg as nu_stergTemp, param1, listare, param2, frm_date, discount as discountTemp, adaos as adaosTemp, factura as facturaTemp,id_selst,] + ;
[id_seldr, tip_doc, tip_ctr, expl_fixa,aleg_cont as aleg_contTemp, frm_plata,valuta as valutatemp, compens,] + ;
[id_tip_rul, id_jnetax, id_jtax, tipjurnal, id_jtaxn, productie as productieTemp, formproduc, cursval as cursvaltemp ] + ;
[from xsets], [XSetsTemp]) && are valuta si aleg_cont cu valori 1,0 care vor fi transf in .t., .f.
Select *,Iif(valutaTemp = 1, .T., .F.) As valuta,;
IIF(aleg_contTemp = 1,.T.,.F.) As aleg_cont,;
IIF(cursvalTemp = 1,.T.,.F.) as cursval,;
IIF(productieTemp = 1,.T.,.F.) as productie,;
IIF(discountTemp = 1,.T.,.F.) as discount,;
IIF(fixTemp = 1,.T.,.F.) as fix,;
IIF(nu_stergTemp = 1,.T.,.F.) as nu_sterg,;
IIF(adaosTemp = 1,.T., .F.) as adaos,;
IIF(facturaTemp = 1,.T.,.F.) as factura ;
From XSetsTemp Into Cursor xSets Readwrite
goExecutor.oExecute([select * from xrequest], [XRequest])
goExecutor.oExecute([select * from xnote], [XNote])
goExecutor.oExecute([select * from xact], [XAct])
goExecutor.oExecute([select * from xitems], [XItems])
nvl2Default("xrequest", "id_tipdoc")
nvl2Default("xnote")
nvl2Default("xact")
nvl2Default("xsets")
nvl2Default("XItems")

BIN
COMUN/datemenu/refaceri.CDX Normal file

Binary file not shown.

BIN
COMUN/datemenu/refaceri.dbf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,336 @@
#Define crlf Chr(13) + Chr(10)
**** de verificat programul , incomplet
Set Ansi On
Set Exact On
Set Deleted On
***** sequence anulat
Public gnConnHandle
Local tcHost, tcUser, tcPassword, lcTablePath, laEroare,lnSucces
On Error
lnSucces = 0
lcTablePath = []
tcHost = [jcsserver]
tcUser = [test_alex]
tcPassword = [123]
gnConnHandle = conecteaza(tcHost, tcUser, tcPassword)
SQLSetprop(gnConnHandle,"Transactions",2)
If gnConnHandle > 0
gcAppDir = Addbs(Justpath(Sys(16,0)))
lcTablePath = gcAppDir + [xact]
SQLSetprop(gnConnHandle,"Transactions",2) && tranzactie manuala
* lnSucces = makeTable(lcTablePath) && creaza tabela cu sau fara sequence
* If lnSucces > 0
importTable(lcTablePath,.T.)
* Endif
Else
Aerror(laEroare)
Messagebox(laEroare(2))
Endif
SQLSetprop(gnConnHandle,"Transactions",1) && tranzactie automata
deconecteaza()
****************************** inceput importTable ******************************************
Procedure importTable
Lparameters tcTableName, llDel
Local i,lnNr, lcSql, lcInsert, lnSucces, tacColName, lcCols, lcVals, nr
lnSucces = 0
lcNumeTabela = []
lcSir = []
lcCols = []
lcVals = []
lcInsert = []
lcNumeTabela = Substr(tcTableName,Rat("\",tcTableName))
nr = Len(lcNumeTabela)
lcNumeTabela = Right(lcNumeTabela,nr-1)
If !Used(tcTableName)
Use (tcTableName)
Endif
If llDel
executaSql([delete from ] + Alltrim(lcNumeTabela))
Endif
lnNr = Afields(taColName)
lcSql = [insert into ] + Alltrim(lcNumeTabela)
For i = 1 To lnNr
lcCols = lcCols + taColName(i,1) + [,]
Endfor
lcCols = Left(lcCols,Len(lcCols)-1)
Scan
lcVals = []
lcInsert = []
For i = 1 To lnNr && se adauga valorile din tabela , convertite
If taColName(i,2) = "I" Or taColName(i,2) = "N"
lcVals = lcVals + Alltrim(Str(&taColName(i,1))) + [,]
Endif
If taColName(i,2) = "D" Or taColName(i,2) = "T"
lcVals = lcVals + [to_date('] + Alltrim(Dtos(&taColName(i,1))) + [','yyyymmdd'),]
Endif
If taColName(i,2) = "L"
lcVals = lcVals + Iif(&taColName(i,1),[1,],[0,])
Endif
If taColName(i,2) = "C"
lcVals = lcVals + ['] + Alltrim(&taColName(i,1)) + [',]
Endif
Endfor
lcVals = Left(lcVals,Len(lcVals) - 1)
lcInsert = lcSql + [(] + lcCols + [)] + [ values(] + lcVals + [)]
lnSucces = executaSql(lcInsert,'',.T.)
If lnSucces < 0
Strtofile(lcInsert,[d:\afis.txt])
Exit
Endif
Endscan
If lnSucces < 0
Sqlrollback(gnConnHandle)
Messagebox([ eroare la insert] + crlf + [sql-ul se gaseste in d:\afis.txt], 48)
Else
Sqlcommit(gnConnHandle)
Messagebox('sa facut importu')
Endif
SQLSetprop(gnConnHandle,"Transactions",1)
Endproc
****************************** inceput makeTable *********************************************
Function makeTable
Lparameters tcTableName, llTrg
Local i,lnNr, lnSucces, lcSql, lcSeq, lcTrig, lcPk, lcTable, lcTipData, lcLen, lcCol, lcNumeTabela, lcSir
lnSucces = 0
lcNumeTabela = []
lcSir = []
lcSeq = []
lcTrig = []
lcPk = []
lcTipData = []
lcLen = []
lcCol = []
lnNr = []
lcSql = []
lcNumeTabela = Substr(tcTableName,Rat("\",tcTableName))
lnNr = Len(lcNumeTabela)
lcNumeTabela = Right(lcNumeTabela,lnNr-1)
* Use (lcNumeTabela)
If !Used(tcTableName)
Use (tcTableName)
Endif
lnNr = Afields(taColName) && get table data
lcTable = [create table ] + lcNumeTabela +[(]
For i = 1 To lnNr && creare tabela
lcTipData = Iif(taColName(i,2)="I" Or taColName(i,2)="N", [number],lcTipData )
lcTipData = Iif(taColName(i,2)="D" Or taColName(i,2)="T",[date],lcTipData )
lcTipData = Iif(taColName(i,2)="L",[number],lcTipData )
lcTipData = Iif(taColName(i,2)="F" ,[binary_float],lcTipData )
lcTipData = Iif(taColName(i,2)="B",[binary_double],lcTipData )
lcTipData = Iif(taColName(i,2)="C" Or taColName(i,2)="M" Or taColName(i,2)="V",[varchar2],lcTipData )
lcLen = Iif(lcTipData=[number] And taColName(i,2)<>"L", ;
[(]+ Alltrim(Str(taColName(i,3))) +[)],lcLen )
lcLen = Iif(lcTipData=[number] And taColName(i,2)="L",[(1)],lcLen )
lcLen = Iif(lcTipData=[varchar2] And (taColName(i,2)="C" Or taColName(i,2)="V" Or taColName(i,2)="M"), ;
[(]+Alltrim(Str(taColName(i,3)))+[)],lcLen )
* lcCol = lcCol + [ ?taColName(i,1) ?lcTipData ?lcLen] + Iif(taColName(i,5),[ not null ],[]) + [,]
lcCol = lcCol + taColName(i,1)+ [ ] + lcTipData + lcLen + Iif(taColName(i,5),[ not null ],[]) + [,]
lcTipData = []
lcLen = []
Endfor
lcTable = lcTable + Left(lcCol,Len(lcCol)-1) + [);]
lnSucces = executaSql(lcTable,'',.T.)
*!* If lnSucces > 0
*!* lcPk = [alter table ]+ lcNumeTabela + ; &&primary key
*!* [ add constraint PK_]+lcNumeTabela +[ primary KEY(]+taColName(1,1) +[); ]
*!* lnSucces = executaSql(lcPk)
*!* If lnSucces > 0 &&trigger
*!* If llTrg
*!* lcSeq = [create sequence SEQ_] + lcNumeTabela + ;
*!* [ minvalue 1 ] + ;
*!* [ maxvalue 99999999999999 ]+ ;
*!* [ start with 1 ] + ;
*!* [ increment by 1 ] + ;
*!* [ nocache; ]
*!* lnSucces = executaSql(lcSeq,'',.t.)
*!* Endif
*!* If lnSucces > 0
*!* lcTrig = [create or replace trigger TRG_]+lcNumeTabela + ;
*!* CHR(13)+Chr(10) + [ before insert on ] + lcNumeTabela + ;
*!* CHR(13)+Chr(10) + [ referencing old as old new as new] + ;
*!* CHR(13)+Chr(10) + [ for each row] + ;
*!* [ begin ] + ;
*!* CHR(13)+Chr(10) + [ if :new.] + taColName(1,1)+ [ is null then ] + ;
*!* CHR(13)+Chr(10) + [ select SEQ_] + lcNumeTabela + ;
*!* [.NEXTVAL into :new.] + taColName(1,1)+ [ from dual; ] + ;
*!* CHR(13)+Chr(10) + [ end if; ] + ;
*!* CHR(13)+Chr(10) + [ end; ]
*!* lnSucces = executaSql(lcTrig,'',.t.)
*!* Endif
*!* Endif
*!* ENDIF
If lnSucces < 0
Sqlrollback(gnConnHandle)
Else
Strtofile(lcTable,[D:\roa\ROACASA\COMUN\script.sql],1)
Sqlcommit(gnConnHandle)
Endif
Return lnSucces
Endfunc
************************ inceput conecteaza ***************************
Procedure conecteaza
Lparameters tcHost, tcUser, tcPassword
gnConnHandle = SQLConnect(tcHost, tcUser, tcPassword)
If gnConnHandle < 1
Aerror(laEroare)
Messagebox(laEroare(2))
Endif
Return gnConnHandle
Endproc
**************************** inceput executaSql ***************************
Function executaSql
Lparameters cmdSql, crsName, tlShowErr
Local lnSucces
lnSucces = -1
If Pcount() < 2 And !m.tlShowErr
crsName=""
Endif
If gnConnHandle > 0
lnSucces = SQLExec(gnConnHandle,cmdSql,crsName)
If lnSucces < 0 And m.tlShowErr
Aerror(laEroare)
eroaresql(@laEroare,cmdSql)
Endif
Endif
Return lnSucces
Endfunc
************************* inceput deconecteaza ************************
Function deconecteaza
*Lparameters lnConn
Local lnSucces
lnSucces = -1
If gnConnHandle > 0
lnSucces = SQLDisconnect(gnConnHandle)
Endif
On Error
Return lnSucces
Endfunc
******************************* inceput eroareSql **********************************
Procedure eroaresql
Lparameters laErr, lcSql
External Array laErr
Local lcMesaj
lcMesaj = [Eroare # : ] + Alltrim(Str(laErr(1))) + crlf + ;
[Mesajul : ] + laErr(2) + ;
IIF(!Empty(laErr(3)), [Eroare OLE : ] + laErr(3) ,[]) + ;
[Aplicatie : ] + laErr(4) + ;
IIF(Pcount() = 2, crlf + lcSql, [])
Messagebox(lcMesaj,0+16)
Endproc
*!* Procedure importTable
*!* Lparameters tcTableName, llDel
*!* Local i,lnNr, lcSql, lnSucces, lcSql,tacColName, nr
*!* lnSucces = 0
*!* lcNumeTabela = []
*!* lcSir = []
*!* lcNumeTabela = Substr(tcTableName,Rat("\",tcTableName))
*!* nr = Len(lcNumeTabela)
*!* lcNumeTabela = Right(lcNumeTabela,nr-1)
*!* * Use (lcNumeTabela)
*!* If !Used(tcTableName)
*!* Use (tcTableName)
*!* Endif
*!* lnNr = Afields(taColName)
*!* lcSql = [insert into ] + Alltrim(lcNumeTabela)
*!* For i = 1 To lnNr
*!* lcSir = lcSir + taColName(i,1) + [,]
*!* Endfor
*!* lcSir = Left(lcSir,Len(lcSir)-1)
*!* lcSql = lcSql + "("+ lcSir + ") values("
*!* lcSir = []
*!* For i = 2 To lnNr
*!* lcSir = lcSir + "?" + taColName(i,1) + ","
*!* Endfor
*!* lcSir = Left(lcSir,Len(lcSir)-1)
*!* lcSql = lcSql + lcSir +")"
*!* If llDel
*!* executaSql([delete from ]+Alltrim(lcNumeTabela))
*!* ENDIF
*!* Scan
*!* lnsucces = executaSql(lcSql,'',.t.)
*!* IF lnsucces < 0
*!* EXIT
*!* endif
*!* ENDSCAN
*!*
*!*
*!*
*!* IF lnsucces < 0
*!* SQLROLLBACK(gnconnhandle)
*!* ELSE
*!* SQLCOMMIT(gnconnhandle)
*!* endif
*!* SQLSETPROP(gnconnhandle,"Transactions",1)
*!* deconecteaza()
*!* Endproc
****************************** inceput makeTable *********************************************

View File

@@ -0,0 +1,83 @@
#Define crlf Chr(13) + Chr(10)
Local lcColoane, lcVals, lcAdresa, lcTabela, lcTable, nr, i, lnSucces, lcSql
External Array lacols
lcColoane = []
lcVals = []
lnSucces = 0
gnconn = SQLConnect([jcsserver],[test_alex],[123])
If gnconn < 0
Return
Endif
lcAdresa = Addbs(Justpath(Sys(16,0)))
lcTabela = [xitems]
lcTable = lcAdresa + lcTabela
Use (lcTable)
Select 1
nr = Afields(lacols,lcTabela)
For i = 1 To nr
lcColoane = lcColoane + lacols(i,1) + [,]
lcVals = lcVals + [?] + lacols(i,1) + [,]
Endfor
lcColoane = Left(lcColoane,Len(Alltrim(lcColoane)) - 1)
lcVals = Left(lcVals,Len(lcVals) - 1)
lcSql = [insert into ] + lcTabela + [(] + lcColoane + [)] + [ values(] + lcVals + [)]
SQLSetprop(gnconn,"Transactions",2)
Scan
lnSucces = executaSql(lcSql,'',.T.)
If lnSucces < 0
Exit
Endif
Endscan
If lnSucces > 0
Sqlcommit(gnconn)
Messagebox([sa facut importu])
Else
Sqlrollback(gnconn)
Endif
SQLSetprop(gnconn,"Transactions",1)
SQLDisconnect(gnconn)
**********************************************************
Function executaSql
Lparameters cmdSql, crsName, tlShowErr
Local lnSucces
lnSucces = -1
If Pcount() < 2 And !m.tlShowErr
crsName=""
Endif
If gnconn > 0
lnSucces = SQLExec(gnconn,cmdSql,crsName)
If lnSucces < 0 And m.tlShowErr
Aerror(laEroare)
eroaresql(@laEroare,cmdSql)
Endif
Endif
Return lnSucces
Endfunc
**********************************************************
Procedure eroaresql
Lparameters laErr, lcSql
External Array laErr
Local lcMesaj
lcMesaj = [Eroare # : ] + Alltrim(Str(laErr(1))) + crlf + ;
[Mesajul : ] + laErr(2) + ;
IIF(!Empty(laErr(3)), [Eroare OLE : ] + laErr(3) ,[]) + ;
[Aplicatie : ] + laErr(4) + ;
IIF(Pcount() = 2, crlf + lcSql, [])
Messagebox(lcMesaj,0+16)
Endproc

View File

@@ -0,0 +1,562 @@
*!* Parameters tnScrie_Sterge, tlModificare, tlRul
*!* #Define crlf Chr(13) + Chr(10)
*!* Local lnSucces
*!* ON ERROR deconecteaza()
*!* lnSucces = -1
*!* If Reccount('actactan') = 0
*!* Messagebox('Nu s-a inregistrat nota contabila.')
*!* Return lnSucces
*!* Endif
*!* If Empty(tnScrie_Sterge) Or Isnull(tnScrie_Sterge)
*!* tnScrie_Sterge = 0
*!* Endif
*!* If !Used('ACTACTAN')
*!* Messagebox('Nu exista fisierul <actactan>.')
*!* Return lnSucces
*!* Endif
*!* If tnScrie_Sterge = 2
*!* Select actactan
*!* Locate
*!* lnCod = cod
*!* Endif
*!* *!* modificare 18.09.2007
*!* If tnScrie_Sterge = 2 And !tlModificare And Used('rul_temp') And Reccount('rul_temp') > 0
*!* Private pcMesaj
*!* Store '' To pcMesaj
*!* lcSql = [begin ] + gcS +[.verifica_stoc(] + Alltrim(Str(lnCod)) + [,?@pcMesaj); end;]
*!* lnSucces = executaSql(lcSql,"",.t.)
*!* If lnSucces < 0
*!* * Messagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
*!* Return lnSucces
*!* Endif
*!* If !Isnull(pcMesaj)
*!* Messagebox(pcMesaj,48,"Atentie")
*!* Release pcMesaj
*!* Return -5
*!* Endif
*!* Release pcMesaj
*!* Endif
*!* *!* modificare 18.09.2007 ^
*!* && RESETARE VARIABILE
*!* lcSql = [begin pack_contafin.reset_variables(); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* If lnSucces < 0
*!* * Messagebox('Resetare variabile ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* Return lnSucces
*!* Endif
*!* &&------------------------------------------------------------------------------------
*!* llManualTransactions = Iif(SQLGetprop(gnhandle,"Transactions")=2,.T.,.F.)
*!* If lnSucces > 0
*!* If !tlModificare And !llManualTransactions
*!* lnSucces = SQLSetprop(gnhandle,"Transactions",2)
*!* Endif
*!* Endif
*!* && SETARE VARIABILE
*!* If lnSucces > 0
*!* lcSql = [begin pack_contafin.set_idutil(?gnIdUtil); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* If lnSucces < 0
*!* * Messagebox('Setare ID utilizator ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* Endif
*!* Endif
*!* If lnSucces > 0
*!* pddata = {}
*!* lcSql = [begin pack_contafin.set_dataora(?pddata); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('Setare DataOra ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* lcSql = [begin pack_contafin.set_an(?gnAn); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('Setare An ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* lcSql = [begin pack_contafin.set_luna(?gnLuna); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('Setare Luna ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0 And tnScrie_Sterge <> 2
*!* && genereaza un cod de operatie
*!* lcSql = [begin pack_contafin.SET_COD('] + gcS +['); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox(goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* &&------------------------------------------------------------------------------------
*!* If lnSucces > 0
*!* && seteaza id_sucursala
*!* lcSql = [begin pack_contafin.SET_ID_SUCURSALA(?gnIdSucursala); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox(goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* lnSucces = sql_temp_insert('actactan','ACT_TEMP')
*!* If lnSucces > 0 And tlRul
*!* If Used('rul_temp') And Reccount('rul_temp')>0
*!* lnSucces = sql_temp_insert('rul_temp','RUL_TEMP')
*!* Endif
*!* If Used('RUL_TEMP_OBINV') And Reccount('RUL_TEMP_OBINV')>0
*!* lnSucces = sql_temp_insert('rul_temp_obinv','RUL_TEMP_OBINV')
*!* Endif
*!* Endif
*!* Endif
*!* If lnSucces > 0
*!* && SCRIE IN ACT
*!* If tnScrie_Sterge <> 2
*!* If lnSucces > 0
*!* lcSql = [begin pack_contafin.SCRIE_IN_ACT('] + gcS +['); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE_IN_ACT ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* Else
*!* If tlModificare
*!* lnSterge = 0
*!* Else
*!* lnSterge = 1
*!* Endif
*!* lcSql = [begin pack_contafin.STERGE_DIN_ACT('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(lnCod)) + [,] + Alltrim(Str(gnIdUtil)) + [,] + Alltrim(Str(lnSterge))+ [); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('STERGE_DIN_ACT ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* Endif
*!* If lnSucces > 0 And tlRul
*!* && SCRIE IN RUL
*!* If tnScrie_Sterge <> 2
*!* lcSql = [begin pack_contafin.SCRIE_IN_RUL(?gcS); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE IN RUL ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Else
*!* lcSql = [begin pack_contafin.STERGE_DIN_RUL('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(lnCod)) + [,] + Alltrim(Str(gnIdUtil)) + [); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('STERGE DIN RUL ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* Endif
*!* If lnSucces > 0 And tlRul And Used('RUL_TEMP_OBINV') And Reccount('RUL_TEMP_OBINV')>0
*!* && SCRIE IN RUL_OBINV
*!* If tnScrie_Sterge <> 2
*!* lcSql = [begin pack_contafin.SCRIE_IN_RUL_OBINV(?gcS); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE IN RUL_OBINV ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Else
*!* lcSql = [begin pack_contafin.STERGE_DIN_RUL_OBINV('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(lnCod)) + [,] + Alltrim(Str(gnIdUtil)) + [); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('STERGE DIN RUL_OBINV ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* Endif
*!* If lnSucces > 0
*!* && SCRIE IN BALANTA
*!* lcSql = [begin pack_contafin.SCRIE_IN_BALANTA('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(tnScrie_Sterge)) + [); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE_IN_BALANTA ' +goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* && SCRIE IN BALANTA_PARTENERI
*!* lcSql = [begin pack_contafin.SCRIE_IN_BALANTA_PARTENERI('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna)) + [,'',] + Alltrim(Str(tnScrie_Sterge)) + [); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE_IN_BALANTA_PARTENERI '+goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* && SCRIE IN IREG_PARTENERI
*!* * lcSql = [begin pack_contafin.SCRIE_IN_IREG_PARTENERI('] + gcS +[',] + ALLTRIM(STR(gnAn)) + [,] + ALLTRIM(STR(gnLuna)) + [,'',] + ALLTRIM(STR(tnScrie_Sterge)) + [,1); end;]
*!* lcSql = [begin pack_contafin.EXECUTA_SCRIE_IN_IREG('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna)) + [,'',] + Alltrim(Str(tnScrie_Sterge)) + [,0); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('Executa_SCRIE_IN_INREGISTRARI_PARTENERI '+goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* && SCRIE IN CUMP
*!* Select infisiere
*!* Locate For Cont = '4426'
*!* lcCorespD = Alltrim(coresp_d)
*!* lcCorespC = Alltrim(coresp_c)
*!* lcCorespDtva = Alltrim(coresp_d) + [,4428,4427]
*!* lcCorespCtva = Alltrim(coresp_c)
*!* lcExceptii = [-1]
*!* lcSql = [select distinct cont_c as exceptie from ] + gcS + [.exceptii_ireg where cont in (] + ;
*!* lcCorespD + [) and invers = 1]
*!* lnSucces = executaSql(lcSql,'cont_exceptii',.t.)
*!* If lnSucces > 0
*!* Select cont_exceptii
*!* Scan
*!* lcExceptii = lcExceptii + ',' + Alltrim(exceptie)
*!* Endscan
*!* Use In cont_exceptii
*!* Endif
*!* If gnAn >= 2007
*!* lcSql = [begin PACK_CONTAFIN.SCRIE_JV_2007(?gnAn, ?gnLuna, ] + ;
*!* Iif(tnScrie_Sterge <> 2, 'pack_contafin.nScriere', 'pack_contafin.nStergere') + [); end;]
*!* Else
*!* lcSql = [begin pack_contafin.EXECUTA_SCRIE_TVA('] + gcS +[', 'cump', 1.19, 1.09, '] + ;
*!* lcCorespDtva +[', '] + lcCorespD +[', '] + lcCorespCtva +[', '] + lcCorespC + ;
*!* [','4426', '] + lcExceptii +[',] + pcan + [, ] + pcnl + [,] + Alltrim(Str(tnScrie_Sterge)) + [ ); end;]
*!* Endif
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE_IN_CUMP ' +goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* && SCRIE IN VANZ
*!* Select infisiere
*!* Locate For Cont = '4427'
*!* lcCorespD = Alltrim(coresp_d)
*!* lcCorespC = Alltrim(coresp_c)+ [,5121,5311]
*!* lcCorespDtva = Alltrim(coresp_d)
*!* lcCorespCtva = Alltrim(coresp_c) + [,4428,4426]
*!* * lcExceptii = [667,622,419]
*!* lcExceptii = [419]
*!* lcSql = [select distinct cont_c as exceptie from ] + gcS + [.exceptii_ireg where cont in (] + lcCorespC + [) and invers = 1]
*!* lnSucces = executaSql(lcSql,'cont_exceptii',.t.)
*!* If lnSucces > 0
*!* Select cont_exceptii
*!* Scan
*!* lcExceptii = lcExceptii + ',' + Alltrim(exceptie)
*!* Endscan
*!* Use In cont_exceptii
*!* Endif
*!* If gnAn >= 2007
*!* lcSql = [begin PACK_CONTAFIN.SCRIE_JC_2007(?gnAn, ?gnLuna, ] + ;
*!* Iif(tnScrie_Sterge <> 2, 'pack_contafin.nScriere', 'pack_contafin.nStergere') + [); end;]
*!* Else
*!* lcSql = [begin pack_contafin.EXECUTA_SCRIE_TVA('] + gcS +[', 'vanz', 1.19, 1.09, '] + ;
*!* lcCorespDtva +[', '] + lcCorespD +[', '] + lcCorespCtva +[', '] + lcCorespC +[','4427', '] + ;
*!* lcExceptii +[',] + pcan + [, ] + pcnl + [,] + Alltrim(Str(tnScrie_Sterge)) + [ ); end;]
*!* Endif
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE_IN_VANZ '+goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* *!* lcSql = [SELECT * FROM ] + gcS + [.ACT_TEMP]
*!* *!* lcCursor = [crsACT_TEMP]
*!* *!* lnSucces = executaSql(lcSql,lcCursor)
*!* *!* SELECT crsACT_TEMP
*!* *!* BROWSE
*!* *!* USE IN CRSACT_TEMP
*!* If lnSucces > 0 And tlRul
*!* Private pcTabel
*!* pcTabel = [STOC]
*!* pcIdTabel = [ID_STOC]
*!* pcConditie = [2=2]
*!* lcSql = [begin pack_contafin.SCRIE_IN_Stoc(?gcS,?gnAn,?gnLuna,0,?pcTabel,?pcIdTabel,?pcConditie); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE IN STOC ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0 And tlRul And Used('RUL_TEMP_OBINV') And Reccount('RUL_TEMP_OBINV')>0
*!* Private pcTabel
*!* pcTabel = [STOC_OBINV]
*!* pcIdTabel = [ID_STOC]
*!* pcConditie = [2=2]
*!* lcSql = [begin pack_contafin.SCRIE_IN_Stoc_OBINV(?gcS,?gnAn,?gnLuna,0,?pcTabel,?pcIdTabel,?pcConditie); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox('SCRIE IN STOC_OBINV ' + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* Endif
*!* If lnSucces > 0
*!* Private pcMesajRefacereNota
*!* pcMesajRefacereNota = ""
*!* lcSql = [begin pack_refacere_nota.refacere_nota(?gnAn,?gnLuna,?@pcMesajRefacereNota); end;]
*!* lnSucces = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces < 0
*!* *!* Messagebox(goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* If !Empty(Nvl(pcMesajRefacereNota,''))
*!* Messagebox(pcMesajRefacereNota,0+48,'Atentie')
*!* Endif
*!* Release pcMesajRefacereNota
*!* Endif
*!* If !tlModificare And !llManualTransactions
*!* If lnSucces < 0
*!* lcSql = "ROLLBACK"
*!* Else
*!* lcSql = "COMMIT"
*!* Endif
*!* lnSucces2 = executaSql(lcSql,'',.t.)
*!* *!* If lnSucces2 < 0
*!* *!* Messagebox(lcSql + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
*!* *!* Endif
*!* lnSucces2 = SQLSetprop(gnhandle,"Transactions",1)
*!* If lnSucces2 < 0
*!* Messagebox([Programul nu a reusit sa treaca pe tranzactie automata. ] + ;
*!* [Iesiti din program si intrati din nou!],0+48,'Atentie!')
*!* Endif
*!* Endif
*!* *!* IF USED('CRS_ACT')
*!* *!* USE IN CRS_ACT
*!* *!* ENDIF
*!* *!* IF USED('rul_temp')
*!* *!* USE IN rul_temp
*!* *!* ENDIF
*!* *!* IF USED('rul_temp_obinv')
*!* *!* USE IN rul_temp_obinv
*!* *!* ENDIF
*!* Return lnSucces
#Define crlf Chr(13) + Chr(10)
Public gcdatapath, gcapppath, gnhandle
gnhandle = conecteaza([jcsserver],[mariusm_auto],[123])
gcapppath = Justpath(Sys(16,0))
*!* gcapppath = Addbs(Justpath(Sys(16,0)))
*!* gcapppath = Left(gcapppath,Rat("\",gcapppath,2))
*!* gcdatapath = ADDBS(gcapppath) + [datemenu]
*!* SET PATH TO (gcdatapath)
Set Path To (gcapppath)
sql_temp_insert([xnote],[xnote])
&& ------------------------------------------------------------------------------------
Procedure sql_temp_insert
Lparameters tcAlias,tcTableName
If !Used(Addbs(gcapppath) + tcAlias)
Use (Addbs(gcapppath) + tcAlias)
Endif
Local lcAlias,lcCursor,lnSucces
Private poIreg
Local lcVariable
If Empty(tcAlias)
lcAlias = 'ACTACTAN'
Else
lcAlias = Upper(Alltrim(tcAlias))
Endif
If Empty(tcTableName)
lcTableName = 'ACT_TEMP'
Else
lcTableName = Upper(Alltrim(tcTableName))
Endif
lcCursor = 'crs_Coloane'
lcSql = [SELECT COLUMN_NAME AS COLOANA from user_tab_columns WHERE table_name = ?lcTableName]
lnSucces = executaSql(lcSql,lcCursor,.T.)
*!* If lnSucces < 0
*!* Messagebox('Eroare la selectare coloane din ' + lcTableName + Chr(13) + goExecutor.cEroare,0+16,'Eroare')
*!* Endif
If lnSucces > 0
***
Select (lcAlias)
lnCount = Fcount()
Select (lcAlias)
lcFields = []
lcValues = []
lcInsert = []
Scatter Name poIreg
For i = 1 To lnCount
?i
Select (lcAlias)
lcFieldName = Upper(Alltrim(Field(i)))
lcFieldType = Type(lcFieldName)
lcFieldValue = Evaluate(lcFieldName)
Do Case
Case lcFieldType = "C"
lcVariable = '?ALLTRIM(poIreg.' + lcFieldName + ')'
* CASE lcfieldtype = "L"
* lcvariable = IIF(&poIreg.lcFieldName,[1,],[0,]
Otherw
lcVariable = '?poIreg.' + lcFieldName
Endcase
Select CRS_COLOANE
Locate For Upper(Alltrim(COLOANA)) == lcFieldName
If !Found()
Loop
Endif
lcFields = lcFields + [,] + lcFieldName
lcNumber = '0'
lcDate = ''
lcString = ''
&& FAC NULL ID-URILE CU VALOARE 0
If Inlist(lcFieldName, 'ID_SUCURSALA')
If poIreg.id_sucursala = 0
poIreg.id_sucursala = Null
Endif
Endif
lcValues = lcValues + [,] + lcVariable
Endfor
lcFields = Substr(lcFields,2)
lcValues = Substr(lcValues,2)
&& INSERT INTO ACT_TEMP
lcInsert = [INSERT INTO ] + lcTableName + [ (] + lcFields + [) VALUES (] + lcValues + [)]
Scan
lnSucces = executaSql(lcInsert,'',.T.)
If lnSucces < 0
Messagebox([eroare])
Exit
Endif
Endscan
Endif
If Used('crs_coloane')
Use In CRS_COLOANE
Endif
USE IN (SELECT(Addbs(gcapppath) + tcAlias))
Return lnSucces
Endproc && sql_temp_insert
************************ inceput conecteaza ***************************
Procedure conecteaza
Lparameters tcHost, tcUser, tcPassword
gnhandle = SQLConnect(tcHost, tcUser, tcPassword)
If gnhandle < 1
Aerror(laEroare)
Messagebox(laEroare(2))
Endif
Return gnhandle
Endproc
**************************** inceput executaSql ***************************
Function executaSql
Lparameters cmdSql, crsName, tlShowErr
Local lnSucces
lnSucces = -1
If Pcount() < 2 And !m.tlShowErr
crsName=""
Endif
If gnhandle > 0
lnSucces=SQLExec(gnhandle,cmdSql,crsName)
If lnSucces < 0 And m.tlShowErr
Aerror(laEroare)
eroaresql(@laEroare,cmdSql)
Endif
Endif
Return lnSucces
Endfunc
************************* inceput deconecteaza ************************
Function deconecteaza
*Lparameters lnConn
Local lnSucces
lnSucces = -1
If lnConn > 0
lnSucces = SQLDisconnect(gnhandle)
Endif
On Error
Return lnSucces
Endfunc
******************************* inceput eroareSql **********************************
Procedure eroaresql
Lparameters laErr, lcSql
External Array laErr
Local lcMesaj
lcMesaj = [Eroare # : ] + Alltrim(Str(laErr(1))) + crlf + ;
[Mesajul : ] + laErr(2) + ;
IIF(!Empty(laErr(3)), [Eroare OLE : ] + laErr(3) ,[]) + ;
[Aplicatie : ] + laErr(4) + ;
IIF(Pcount() = 2, crlf + lcSql, [])
Messagebox(lcMesaj,0+16)
Endproc

View File

@@ -0,0 +1,62 @@
#Define crlf Chr(13) + Chr(10)
Local lcColoane, lcVals, lcAdresa, lcTabela, lcTable, nr, i, lnSucces, lcSql
External Array lacols
lcColoane = []
lcVals = []
lnSucces = 0
lctabela = UPPER([xitems])
gnconn = SQLConnect([jcsserver],[test_alex],[123])
If gnconn < 0
Return
Endif
lcsql = [select * from user_tab_columns where table_name = '] + lctabela + [']
executasql(lcsql,'crsColoane',.t.)
lcsql = []
SELECT crscoloane
SCAN
lcsql =lcsql + ALLTRIM(column_name) + [= TRIM(] + ALLTRIM(column_name) + [),]
ENDSCAN
lcsql = [update ] + lctabela + [ set ] + LEFT(lcsql,LEN(lcsql) - 1)
executasql(lcsql,'',.t.)
**********************************************************
Function executaSql
Lparameters cmdSql, crsName, tlShowErr
Local lnSucces
lnSucces = -1
If Pcount() < 2 And !m.tlShowErr
crsName=""
Endif
If gnconn > 0
lnSucces = SQLExec(gnconn,cmdSql,crsName)
If lnSucces < 0 And m.tlShowErr
Aerror(laEroare)
eroaresql(@laEroare,cmdSql)
Endif
Endif
Return lnSucces
Endfunc
**********************************************************
Procedure eroaresql
Lparameters laErr, lcSql
External Array laErr
Local lcMesaj
lcMesaj = [Eroare # : ] + Alltrim(Str(laErr(1))) + crlf + ;
[Mesajul : ] + laErr(2) + ;
IIF(!Empty(laErr(3)), [Eroare OLE : ] + laErr(3) ,[]) + ;
[Aplicatie : ] + laErr(4) + ;
IIF(Pcount() = 2, crlf + lcSql, [])
Messagebox(lcMesaj,0+16)
Endproc

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,31 @@
*!* Am adaugat coloana X34 in xact cu valoarea "id_jtva_coloana" si coloana X34 in XNOTE.
Set Deleted On
Set Century On
Set Date Dmy
Set Ansi On
Set Exact On
Set Date Dmy
Set Safety Off
Set Exclusive Off
Close Databases
lcDir = [D:\ROA_Branch\ROACONT\COMUN\datemenu\]
lcXnote = lcDir + [xnote.dbf]
Use (lcXnote) In 0 Shared
Select Distinct x21,x34 From xnote Into Cursor crsrezumat
Select crsrezumat
Browse
Select xnote
Replace x34 With [id_jnetax] For x21 = [neimpozab]
Replace x34 With [id_jtax] For Inlist(x21,[pnBazaFactura],[pnBazaNir],[pnBazaVanz],[pnDiscount],[totftva])
Replace x34 With [id_jtva] For Inlist(x21,[pnTvaDiscount],[pnTvaFactura],[pnTvaNir],[pnTvaVanzIn],[pnTvaVanzOut],[tottva])
Select Distinct x21,x34 From xnote Into Cursor crsrezumat
Select crsrezumat
Browse
Use In xnote
Use In crsrezumat

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,91 @@
SET DELETED ON
SET CENTURY ON
SET DATE DMY
SET ANSI ON
SET EXACT ON
SET DATE DMY
SET SAFETY OFF
SET EXCLUSIVE OFF
CLOSE DATABASES
lcDir = [d:\roa_rb\roacont\comun\datemenu\]
lcXsets = lcDir + [xsets.dbf]
lcXnote = lcDir + [xnote.dbf]
USE (lcXsets) IN 0 SHARED
USE (lcXnote) IN 0 SHARED
lnIdSetVzNetax = 8
lnIdSetVzTax19 = 1
lnIdSetCmNetax = 113
lnIdSetCmCapital19 = 101
lnIdSetCmMarfa19 = 103
lnIdSetCmBunuri19 = 105
lnIdSetCmTxInv = 141 && taxare inversa 19% bunuri firma
lnIdSetVzTxInv = 5
SELECT DISTINCT ID_SET ;
FROM XNOTE ;
WHERE INLIST(ALLTRIM(XSCD), '4111','461', '418') OR INLIST(ALLTRIM(XSCC), '419') ;
INTO CURSOR crsIdSetVz
SELECT DISTINCT ID_SET ;
FROM XNOTE ;
WHERE INLIST(ALLTRIM(XSCC), '404') ;
INTO CURSOR crsIdSetCmCapital
SELECT DISTINCT ID_SET ;
FROM XNOTE;
WHERE INLIST(ALLTRIM(XSCD), '371') AND INLIST(ALLTRIM(XSCC), '401','462', '408');
UNION ;
SELECT DISTINCT S.ID_SET ;
FROM XSETS S JOIN (SELECT ID_SET FROM XNOTE WHERE INLIST(ALLTRIM(XSCC), '401','462', '408')) N ;
ON S.ID_SET = N.ID_SET ;
WHERE 'MARFA'$UPPER(S.NUME_SET);
INTO CURSOR crsIdSetCmMarfa
SELECT DISTINCT ID_SET ;
FROM XNOTE ;
WHERE (INLIST(ALLTRIM(XSCC), '401','462', '408') OR INLIST(ALLTRIM(XSCD), '409')) AND !INLIST(ALLTRIM(XSCD), '371');
INTO CURSOR crsIdSetCmBunuri
SELECT DISTINCT ID_SET ;
FROM XSETS ;
WHERE 'INVERS'$UPPER(NUME_SET) AND '411'$UPPER(LISTA_NOTE) ;
INTO CURSOR crsIdSetVzTxInv
SELECT DISTINCT ID_SET ;
FROM XSETS ;
WHERE 'INVERS'$UPPER(NUME_SET) AND '401'$UPPER(LISTA_NOTE) ;
INTO CURSOR crsIdSetCmTxInv
DO CLEAN_SETS
DO UPDATE_SETS WITH "crsIdSetVz", lnIdSetVzNetax, lnIdSetVzTax19, "JV"
DO UPDATE_SETS WITH "crsIdSetCmCapital", lnIdSetCmNetax, lnIdSetCmCapital19, "JC"
DO UPDATE_SETS WITH "crsIdSetCmMarfa", lnIdSetCmNetax, lnIdSetCmMarfa19, "JC"
DO UPDATE_SETS WITH "crsIdSetCmBunuri", lnIdSetCmNetax, lnIdSetCmBunuri19, "JC"
DO UPDATE_SETS WITH "crsIdSetVzTxInv", lnIdSetVzNetax, lnIdSetVzTxInv, "JV"
DO UPDATE_SETS WITH "crsIdSetCmTxInv", lnIdSetCmNetax, lnIdSetCmTxInv, "JC"
PROCEDURE CLEAN_SETS
UPDATE XSETS SET ID_JNETAX = 0, ID_JTAX = 0, TIPJURNAL = ''
ENDPROC
*!*
PROCEDURE UPDATE_SETS
LPARAMETERS tcCursorIdSet, tnIdSetNetax, tnIdSetTax, tcTipJurnal
SELECT (tcCursorIdSet)
SCAN
IF SEEK(ID_SET,"xsets","id_set")
IF EMPTY(XSETS.ID_JNETAX) AND EMPTY(XSETS.ID_JTAX) AND EMPTY(XSETS.TIPJURNAL)
REPLACE ID_JNETAX WITH tnIdSetNetax, ID_JTAX WITH tnIdSetTax, TIPJURNAL WITH tcTipJurnal IN XSETS
ENDIF
ENDIF
ENDSCAN
ENDPROC