30 lines
963 B
Plaintext
30 lines
963 B
Plaintext
CD "D:\STANDARDE\CN_A.C.N\DATEAN"
|
|
|
|
Sele r.id as rgd_id, r.fact_id, sum(C.VALVAL) as valval, MAX(c.numevaluta) as numevaluta ;
|
|
From ips_DOCDETALIU d Join ips_CHELTDETALIU C On d.Id = C.DCD_ID;
|
|
join ips_regdoc r on d.rgd_id = r.id join ips_facturare f on r.fact_id = f.id where YEAR(f.datafact) <= 2019 and !EMPTY(NVL(r.fact_id,0)) ;
|
|
group by 1,2 ;
|
|
Order By 1 ;
|
|
Into Cursor TRECAP
|
|
|
|
set textmerge on to memvar lcText noshow
|
|
sele trecap
|
|
scan
|
|
scat name loRec
|
|
\update ips_Regdoc set pret = <<loRec.Valval>>, valval = <<loRec.Valval>> where id = <<loRec.rgd_id>> and id_vanzare = <<loRec.fact_id>>;
|
|
if MOD(RECNO(),1000) = 0
|
|
\commit;
|
|
endif
|
|
endscan
|
|
\
|
|
\update ips_regdoc r
|
|
\ set valftva = round(curs * valval, 2)
|
|
\ where exists (select id
|
|
\ from vanzari v
|
|
\ where v.id_vanzare = r.id_vanzare and v.tip_factura = 1
|
|
\ and extract(year from v.data_act) <=2019);
|
|
set textmerge to
|
|
|
|
strtofile(m.lcText, 'd:\cheiaje.sql')
|
|
|