Initial: flux text FoxBin2Prg (git urmareste .??2 in-arbore, binarele VFP git-ignored)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
156
Programe/sitan.prg
Normal file
156
Programe/sitan.prg
Normal file
@@ -0,0 +1,156 @@
|
||||
********
|
||||
Procedure sitan
|
||||
LPARAMETERS tnFiscala
|
||||
|
||||
Local lcCursor, lcCursorTemp, lcFiltru, lcSchema, lcSel, llExperimental, llSucces, lnLuna
|
||||
PRIVATE pcCond, pdDataF, pdDataI, pdData, pnFiscala
|
||||
pdDataI = Date(gnAn, 1, 1)
|
||||
pdDataF = Date(gnAn, gnLuna, 1)
|
||||
pcCond = [1=1]
|
||||
IF EMPTY(m.tnFiscala) OR TYPE('tnFiscala') <> 'N'
|
||||
pnFiscala = 0
|
||||
ELSE
|
||||
pnFiscala = m.tnFiscala
|
||||
ENDIF
|
||||
lcSchema = [''] &&['ceck n(1),totdebit n(16,gnPa),totcredit n(16,gnPa),id_fact n(10),id_part n(10),nume c(50),dataact D,dataireg D,nract n(14),datascad D,cont c(4),acont c(4)']
|
||||
lcCursor = 'crslista'
|
||||
|
||||
llExperimental = .T. && 25.11.2021 llExperimental = (goApp.nExperimental = 1)
|
||||
If m.llExperimental
|
||||
* EXPERIMENTAL SELECTIE DIN IMOB_VSITUATIE_LUNARA IN LOC DE PACK_IMOB.CALCUL_SITUATIE_LUNARA()
|
||||
* Setez luna pentru view
|
||||
lcFiltru = [id_tip_imobilizare in (1,2)] + m.gcCondSucursala
|
||||
|
||||
For lnLuna = 1 To m.gnLuna
|
||||
pdData = DATE(m.gnAn, m.lnLuna, 1)
|
||||
WAIT WINDOW 'Luna ' + PADL(m.lnLuna,2,'0') + '/' + ALLTRIM(STR(m.gnAn)) NOWAIT
|
||||
llSucces = goExecutor.oExecuta('begin pack_imob.setlunacurenta(?pdData); end;')
|
||||
If m.llSucces
|
||||
lcSel = [SELECT * FROM ] + Iif(m.pnFiscala = 0, [imob_vsituatie_lunara], [imobf_vsituatie_lunara]) + [ WHERE ] + m.lcFiltru
|
||||
lcCursorTemp = Sys(2015)
|
||||
llSucces = goExecutor.oExecuta(m.lcSel, m.lcCursorTemp)
|
||||
If !Used(m.lcCursor)
|
||||
Select * From (m.lcCursorTemp) Into Cursor (m.lcCursor) Readwrite
|
||||
Else
|
||||
Select (m.lcCursor)
|
||||
Append From Dbf(m.lcCursorTemp)
|
||||
Endif
|
||||
Use In (Select(m.lcCursorTemp))
|
||||
Endif
|
||||
Endfor
|
||||
Else
|
||||
lcSel = [{call pack_imob.CALCUL_SITUATIE_LUNARA(?pdDataI,?pdDataF,?pcCond,?pnFiscala,?gnIdSucursala)}]
|
||||
llSucces = goExecutor.oExecuta(lcSel, lcCursor)
|
||||
Endif
|
||||
|
||||
If !m.llSucces
|
||||
Return
|
||||
Endif
|
||||
|
||||
Select Sum(rata) As amortizare_lunara, Sum(rata + amort_prec) As amortizare_totala, data_test As ddata, Cont ;
|
||||
FROM &lcCursor ;
|
||||
WITH (Buffering = .T.) ;
|
||||
WHERE Inlist(id_tip_imobilizare, 1, 2) ;
|
||||
INTO Cursor sitmf ;
|
||||
GROUP By ddata, Cont
|
||||
|
||||
Use In (SELECT(m.lcCursor))
|
||||
|
||||
Return [sitmf]
|
||||
Endproc && sitan
|
||||
|
||||
*---------------------------------------------------------------------------
|
||||
Procedure rulaje
|
||||
Parameters tcCamp, tcAlias
|
||||
|
||||
|
||||
datain = Ctod('01/' + Alltrim(Str(v_luni.nrluna)) + '/' + Alltrim(v_luni.an))
|
||||
|
||||
lcCamp = Alltrim(tcCamp)
|
||||
|
||||
If Empty(tcAlias)
|
||||
lcAlias = [sitmf]
|
||||
Else
|
||||
lcAlias = Alltrim(tcAlias)
|
||||
Endif
|
||||
|
||||
Select Distinct Cont From (lcAlias) Into Cursor conturi
|
||||
*!* SELECT distinct ddata as luna FROM (lcAlias) INTO CURSOR luni
|
||||
|
||||
Select Distinct ddata As luna From (lcAlias) Into Cursor crsluni
|
||||
Create Cursor luni (luna c(8))
|
||||
|
||||
Select crsluni
|
||||
Scan
|
||||
Scatter Name aaa
|
||||
Select luni
|
||||
Append Blank
|
||||
Replace luna With Alltrim(Str(Month(aaa.luna))) + "/" + Alltrim(Str(Year(aaa.luna)))
|
||||
Select crsluni
|
||||
Endscan
|
||||
|
||||
|
||||
*!* tt='create cursor rulaje (total c(6),luna d(8)'
|
||||
tt = 'create cursor rulaje ( _ c(6),luna c(8)'
|
||||
Select conturi
|
||||
Scan
|
||||
* SCAT MEMV
|
||||
tt = tt + ',c' + Alltrim(Nvl(Cont, '')) + ' n(14,gnpa)'
|
||||
* SELECT conturi
|
||||
Endscan
|
||||
|
||||
|
||||
tt = tt + ')'
|
||||
&tt
|
||||
Select rulaje
|
||||
Append From Dbf('luni')
|
||||
Use In luni
|
||||
|
||||
|
||||
*sume---
|
||||
Select (lcAlias)
|
||||
Scan
|
||||
Scatter Memv
|
||||
Select rulaje
|
||||
Locate For Alltrim(luna) = Alltrim(Str(Month(m.ddata))) + "/" + Alltrim(Str(Year(m.ddata)))
|
||||
*!* LOCATE FOR luna=m.ddata
|
||||
tt = 'REPLACE c' + Alltrim(Nvl(m.cont, '')) + ' with ' + lcCamp
|
||||
&tt
|
||||
Select (lcAlias)
|
||||
Endscan
|
||||
|
||||
*totaluri---
|
||||
If Lower(Alltrim(tcCamp)) = [amortizare_lunara]
|
||||
Local m.c
|
||||
m.c = 0
|
||||
Select rulaje
|
||||
Append Blank
|
||||
Replace _ With 'TOTAL'
|
||||
Select conturi
|
||||
Scan
|
||||
Scatter Memv
|
||||
Select rulaje
|
||||
tt = 'sum c' + Alltrim(Nvl(m.cont, '')) + ' to m.c FOR ddata<=datain'
|
||||
&tt
|
||||
|
||||
Select rulaje
|
||||
Go Bott
|
||||
tt = 'REPLACE c' + Alltrim(Nvl(Cont, '')) + ' with m.c'
|
||||
&tt
|
||||
Select conturi
|
||||
Endscan
|
||||
Endif
|
||||
|
||||
|
||||
If Used('conturi')
|
||||
Use In conturi
|
||||
Endif
|
||||
If Used('luni')
|
||||
Use In conturi
|
||||
Endif
|
||||
|
||||
|
||||
If Used(lcAlias)
|
||||
Use In (lcAlias)
|
||||
Endif
|
||||
*------------------------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user