Friday, March 12, 2010

Calculate Sales order details F4211 with Tax amount in JD Edwards

Calculate Sales order details F4211 with Tax amount in JD Edwards
 
alter view ABAddress as
select    aban8 ,abalph,rtrim(aladd1) address ,rtrim(alcty1) City, rtrim(aladds)State,rtrim(alctr)Country,aladdz from jde_production.proddta.f0101
left outer join jde_production.proddta.f0116 on aban8=alan8 and abeftb=aleftb
where aban8<>0
select  rpstam/100 rpstam,rpdoc into jde_rk.dbo.stxamt from proddta.f03b11
where rpdgj>=107060 and rpicut='IB' and rpdct='RI' and rpstam<>0

 

select  sddoc I#,sddoco O#,sdan8 Soldto,a.abalph Soldtoname,a.address Soldtoaddress,a.City SoTCity,a.state SoTsate,a.Country SoTCountry,
a.aladdz Soldtozip, sdshan Shipto,b.abalph Shiptonam, b.address ShiptoAdd,a.City ShTCity,b.state ShTsate,b.Country ShTCountry,
b.aladdz ShiptoZip,sdtxa1,
DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) Orddate,
sum(sdaexp/100) sdaexp,avg(tatxr1/1000) tatxr1  --,sum(rpstam) Taxamt
into jde_rk.dbo.dffdf_1 from proddta.f4211
left outer join ABAddress a on sdan8=a.aban8
left outer join ABAddress b on sdshan=b.aban8
left outer join proddta.f4008 on ltrim(tatxa1)=ltrim(sdtxa1) and sdtrdj between  taeftj  and taefdj
--left outer join jde_rk.dbo.stxamt  on sddoc=rpdoc
where sdtrdj>=107060 and  sdtrdj<=109366
and sddcto in('SO','SA','SF','SR') and sdnxtr=999 and sdlttr<>980 and sdlnty='S'  and sddoc<>0
group by sddoc,sddoco,sdan8,a.abalph,a.address,a.aladdz, sdshan,b.abalph,b.address,b.aladdz,SDTRDJ,
a.City,a.state,a.Country ,b.City,b.state,b.Country ,sdtxa1

--drop table jde_rk.dbo.dffdf_1

select a.*,rpstam from jde_rk.dbo.dffdf_1 a
left outer join jde_rk.dbo.stxamt  on i#=rpdoc

 


 

No comments: