|
|

楼主 |
发表于 2013/4/12 10:53:30
|
显示全部楼层
tianpan 发表于 2013/4/11 20:25 
RT记录的是接收的历史事务记录,MMT是库存的历史事务。
记录的东西不一样,你说的能查出来,只不过是因为M ...
--采购接收进仓
select pv.segment1
,sum(decode(rt.currency_code,
'CNY',
nvl(RT.PO_UNIT_PRICE, 0) * (ATC.TAX_RATE + 100) / 100,
nvl(RT.PO_UNIT_PRICE, 0)
)*mmt.transaction_quantity
) 接收进仓金额
from inv.mtl_material_transactions mmt
,po.rcv_transactions rt
,po.po_line_locations_all plla
,po.po_vendors pv
,ap.ap_tax_codes_all atc
where mmt.organization_id=4 and rt.organization_id = 4
and mmt.rcv_transaction_id=rt.transaction_id
and mmt.transaction_source_type_id=1 and mmt.transaction_type_id=18
and plla.tax_name = atc.name
and rt.vendor_id=pv.vendor_id
and rt.po_line_location_id= plla.line_location_id
and mmt.transaction_date >= to_date('&b_date', 'yymmdd')
and mmt.transaction_date<to_date('&e_date', 'yymmdd') +1
group by pv.segment1
--供应商交货金额
select pv.vendor_name
,sum(decode(pha.currency_code,
'CNY',
nvl(RT.PO_UNIT_PRICE, 0) * (ATC.TAX_RATE + 100) / 100,
nvl(RT.PO_UNIT_PRICE, 0)
)*rt.quantity
) 供应商交货金额
from po.rcv_transactions rt
,po.po_headers_all pha
,po.po_lines_all pla
,po.po_line_locations_all plla
,po.po_vendors pv
,po.po_vendor_sites_all pvs
,ap.ap_tax_codes_all atc
,ap.ap_terms at
where rt.organization_id = 4
and pha.po_header_id = pla.po_header_id and pla.po_line_id=plla.po_line_id
and pha.vendor_id =pv.vendor_id and pv.enabled_flag='Y'
and pvs.vendor_id = pv.vendor_id
and plla.tax_name = atc.name
and at.term_id=pv.terms_id
and rt.po_header_id=pha.po_header_id
and rt.po_line_location_id= plla.line_location_id
and rt.vendor_site_id=pvs.vendor_site_id
and rt.transaction_type = 'RECEIVE'
and rt.transaction_date >= to_date('&b_date', 'yymmdd')
and rt.transaction_date < to_date('&e_date', 'yymmdd') + 1
group by pv.vendor_name
这两种情况下金额是一样的,请问我要表示采购入库时,到底是用mmt还是用rt,
按我掌握的资料理解,采购接收入库时,会先rt表插入数据,之后才在mmt表插入数据的
|
|