qweewq123qwe 发表于 2015-9-23 13:28:36

Oracle EBS-SQL (PO-14):检查报价单与成本对比.sql

  select distinct
         msi.segment1                                             项目
      ,msi.description                                             描述
      ,msi.primary_unit_of_measure                        单位
      ,decode(pla.line_type_id,'1','物货','1000','估价') 类型
      ,pla.unit_price                                       报价单价格
      ,cot.item_cost                                                成本
      ,(pla.unit_price - cot.item_cost)                     差异
      ,Trunc((pla.unit_price - cot.item_cost)/cot.item_cost,4)*100||'%'差异百分比
    -- ,pla.creation_date                            报价单新建日期
    -- ,pla.last_update_date                     报价单更新日期
   --,cot.creation_date                               成本新建日期
    -- ,cot.last_update_date                        成本更新日期
from po.po_headers_all            pha
       ,po.po_lines_all               pla
       ,bom.cst_item_costs          cot
       ,inv.mtl_system_items_bmsi
where
      pha.po_header_id = pla.po_header_id
and msi.inventory_item_id = pla.item_id(+)
and pha.type_lookup_code ='QUOTATION'
and msi.inventory_item_id = cot.inventory_item_id(+)
and msi.organization_id = cot.organization_id(+)
and cot.cost_type_id = 1
and cot.item_cost <> 0
and nvl(trunc(pla.unit_price,4),-1) <> nvl(Trunc(cot.item_cost, 4),-1)
and pla.item_id = cot.inventory_item_id
and msi.organization_id in(X,Y)
and abs((Trunc((pla.unit_price - cot.item_cost)/cot.item_cost,4)*100)) >= 20
order by msi.segment1
页: [1]
查看完整版本: Oracle EBS-SQL (PO-14):检查报价单与成本对比.sql