Files
vfp_roaauto/COMUN/programe/update_comenzi.prg

202 lines
8.9 KiB
Plaintext

*!* 20.01.2026
*!* update_articole_politica, update_articole_politica_comenzi + codbare
***************************************************************************************************************
**** Proceduri
**** update_articole_politica ( tnIdPol )
**** update_articole_politica_utilizator - veche 26.01
**** update_articole_politica_comenzi
**** caut_politici_curente - veche 26.01
**** caut_politici_curente_utilizator
**** caut_lucrari_curente - veche 26.01
**** caut_lucrari_curente_gs
**** Functii
**** caut_nume_politica - mutata in proceduri_comune.prg ( v 2.0.11 )
***************************************************************************************************************
PROCEDURE extrage_optiuni_firma && adaugata v 2.0.15
gnIdGrupaArtSectie = Val(extrage_optiuni(gcGrupaArtSectie, gnId_sectie))
gnTipUzualComanda = Val(extrage_optiuni(gcTipUzualComanda, gnId_sectie))
gnComenziInitial = Val(extrage_optiuni(gcComenziInitial, gnId_sectie))
gnOre_inchidere = Val(extrage_optiuni(gcOre_inchidere, gnId_sectie))
gnOre_livrare = Val(extrage_optiuni(gcOre_livrare, gnId_sectie))
gnOre_executie = Val(extrage_optiuni(gcOre_executie, gnId_sectie))
gnCopiereCantitate = Val(extrage_optiuni(gcCopiereCantitate, gnId_sectie))
gnIdPoliticaPretC = Val(extrage_optiuni(gcIdPoliticaPretC, gnId_sectie))
gnIdPoliticaPret = Val(extrage_optiuni(gcIdPoliticaPret, gnId_sectie))
gnId_lista_preturi_PV = Val(extrage_optiuni(gcId_lista_preturi_PV, gnId_sectie))
gnSuprascriePretComanda = Val(extrage_optiuni(gcSuprascriePretComanda, gnId_sectie))
gnRF_ORDONARECOMENZI = Val(extrage_optiuni(gcRF_ORDONARECOMENZI, gnId_sectie))
ENDPROC
***************************************************************************************************************
Procedure update_articole_politica
Lparameters tnIdPol
If Used('v_articole')
Use In v_articole
Endif
TEXT TO lcSql TEXTMERGE NOSHOW
select p.id_articol,p.id_pol,p.pret,p.um,p.nume_articol,p.codmat,p.codbare,p.preturi_cu_tva as pret_cu_tva, s.stoc
from com_vpreturi_utilizator p
left join (select id_articol,
sum(cants + cant - cante) as stoc
from stoc
where an = <<m.gnAn>>
and luna = <<m.gnLuna>>
and id_gestiune in
(SELECT X
FROM table(charn2collection((select pack_comenzi.extrage_optiuni(varvalue, <<gnId_sectie>>) as id_pol from optiuni where varname = 'LISTA_GESTIUNI_STOC'),
',')))
group by id_articol) s
on p.id_articol = s.id_articol
where p.id_util = <<m.gnIdUtil>> and p.id_pol= <<m.tnIdPol>>
ENDTEXT
lcCursor = [v_articole]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()
Return lnSucces
Endproc && update_articole_politica
***************************************************************************************************************
*!* Procedure update_articole_politica_utilizator
*!* If Used('v_articole')
*!* Use In v_articole
*!* Endif
*!* lcSql = [select id_articol,id_pol,pret,um,nume_articol,codmat ] + ;
*!* [from ] + gcS + [.com_vpreturi_utilizator where id_util = ?gnIdUtil order by nume_articol]
*!* lcCursor = [v_articole]
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
*!* goExecutor.oReset()
*!* Return lnSucces
*!* Endproc && update_articole_politica_utilizator
***************************************************************************************************************
Procedure update_articole_politica_comenzi
Lparameters tcOptiune
PRIVATE pcOptiune
If Used('v_articole')
Use In v_articole
Endif
pcOptiune = NVL(tcOptiune,[])
TEXT TO lcSql TEXTMERGE NOSHOW
select p.id_articol,p.id_pol,p.pret,p.um,p.nume_articol,p.codmat,p.codbare,p.preturi_cu_tva as pret_cu_tva, s.stoc
from com_vpreturi_utilizator p
left join (select id_articol,
sum(cants + cant - cante) as stoc
from stoc
where an = <<m.gnAn>>
and luna = <<m.gnLuna>>
and id_gestiune in
(SELECT X
FROM table(charn2collection((select pack_comenzi.extrage_optiuni(varvalue, <<gnId_sectie>>) as id_pol from optiuni where varname = 'LISTA_GESTIUNI_STOC'),
',')))
group by id_articol) s
on p.id_articol = s.id_articol
where p.id_util = ?gnIdUtil and p.id_pol in
(select to_number(pack_comenzi.extrage_optiuni(varvalue,<<m.gnId_sectie>>)) as id_pol from optiuni where varname = '<<pcOptiune>>')
order by p.nume_articol
ENDTEXT
lcCursor = [v_articole]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()
RELEASE pcOptiune
Return lnSucces
Endproc && update_articole_politica_comenzi
***************************************************************************************************************
*!* Procedure caut_politici_curente
*!* Local locauta,llReturn
*!* Store "" To locauta
*!* Store .F. To llReturn
*!* lcSelect = ["select id_pol,nume,datai,datas from ] + gcS + [.crm_vpolitici_pret_curente"]
*!* lcFiltru = [1=2]
*!* lcSchema = ['']
*!* lcOrder = [2]
*!* lcColoane = [nume,datai,datas]
*!* lcTitlu = [ALEGETI POLITICA DE PRETURI]
*!* lcTitluColoane = [Nume,Data inceput,Data sfarsit]
*!* locauta = cauta_alfa(lcSelect,lcFiltru,lcSchema,lcOrder,lcColoane,lcTitlu,lcTitluColoane,"")
*!* Return locauta
*!* Endproc && caut_politici_curente
***************************************************************************************************************
PROCEDURE caut_politici_curente_utilizator
Local locauta,llReturn
Store "" To locauta
Store .F. To llReturn
lcSelect = [select id_pol,nume,datai,datas from ] + gcS + [.crm_vpolpretcurutil]
lcFiltru = []
lcFiltruOriginal = [id_util = ?gnIdUtil]
lcSchema = []
lcOrder = [2]
lcColoane = [nume,datai,datas]
lcTitlu = [ALEGETI POLITICA DE PRETURI]
lcTitluColoane = [Nume,Data inceput,Data sfarsit]
locauta = cauta_alfa(lcSelect,lcFiltru,lcSchema,lcOrder,lcColoane,lcTitlu,lcTitluColoane,"",.F.,lcFiltruOriginal)
Return locauta
Endproc && caut_politici_curente_utilizator
***************************************************************************************************************
*!* Procedure caut_lucrari_curente
*!* Local locauta,llReturn
*!* Store "" To locauta
*!* Store .F. To llReturn
*!* lcSelect = ["select id_lucrare,nrord,data_lucrare,termen_executie from ] + gcS + [.vlucrari_curente"]
*!* lcFiltru = [1=2]
*!* lcSchema = ['']
*!* lcOrder = [2]
*!* lcColoane = [nrord,data_lucrare,termen_executie]
*!* lcTitlu = [ALEGETI LUCRAREA]
*!* lcTitluColoane = [Numar lucrare,Data lucrare,Termen]
*!* locauta = cauta_alfa(lcSelect,lcFiltru,lcSchema,lcOrder,lcColoane,lcTitlu,lcTitluColoane,"")
*!* Return locauta
*!* Endproc
***************************************************************************************************************
Function caut_lucrari_curente_gs
Lparameters tlToateIreg, tlMaiMulteLucrari
Store "" To locauta
lcFiltru = [1=2]
lcSchema = [id_lucrare n(20),nrord c(30),data_lucrare t,termen_executie t]
lcOrder = [termen_executie]
lcColoane = [nrord,data_lucrare,termen_executie]
lcTitlu = [ALEGETI LUCRAREA]
lcTitluColoane = [Numar lucrare,Data lucrare,Termen]
llMaiMulteLucrari = tlMaiMulteLucrari
lcSelect = [select id_lucrare,nrord,data_lucrare,termen_executie from vlucrari_curente where]
lcFiltruOriginal = [2=2]
lcNumeProc = [nom_lucrari_detalii]
llToateIreg = tlToateIreg
lcPrimaColoana = [termen_executie]
lnPornire = 1
lnTipReturn = Iif(tlMaiMulteLucrari, 1, 0)
lcIdColumn = "id_lucrare"
locauta = cauta_alfa_gs(lcSelect, lcFiltru, lcSchema, lcOrder, lcColoane, lcTitlu, lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal, lcPrimaColoana, lnPornire, lnTipReturn , lcIdColumn, .F. , get_ora())
Return locauta
Endfunc && caut_lucrari_curente_gs
*****************************************************************************************************************
*!* Function caut_nume_politica
*!* Lparameters tnIdPol
*!* Local lcNume
*!* Store "" To lcNume
*!* If !Empty(Nvl(tnIdPol,0))
*!* If Used('crstemppol')
*!* Use In crstemppol
*!* Endif
*!* lcSql = [select nume from ] + gcS + [.crm_vpolitici_pret_curente where id_pol = ] + Alltrim(Str(tnIdPol))
*!* lnSucces = goExecutor.oExecute(lcSql,[crstemppol])
*!* If lnSucces < 0
*!* amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
*!* Else
*!* Select crstemppol
*!* lcNume = Alltrim(Upper(nume))
*!* Endif
*!* If Used('crstemppol')
*!* Use In crstemppol
*!* Endif
*!* Endif
*!* Return lcNume
*!* Endfunc && caut_nume_politica
***************************************************************************************************************