OracleEBS-SQL(PO-5):采购订单控制信息查询.sql select distinct
pla.po_header_id,
--pe_lookup_code,
pha.segment1 采购订单号,
appf.full_name 采购员,
pla.line_num 订单⾏,
msi.segment1 物料编码,
pla.item_description 物料说明,
case
when pha.Authorization_Status='APPROVED' then '已审批'
when pha.authorization_status='REQUIRES REAPPROVAL' then '要求重新审批'
when pha.authorization_status='IN PROCESS' then '处理中'
when pha.authorization_status='REJECTED' then '拒绝'
else '未完成'
end 审批状态,
-- decode(pha.approved_flag, case
-- 'Y', when pha.approved_flag='Y' then '已审批'
-- '已审批',
-- 'N', when pha.approved_flag='N' then '处理中'
-- '处理中',
-- 'R', when pha.approved_flag='R' then '要求重新审批'
-- '要求重新审批',
-
- 'F', when pha.approved_flag='F' then '拒绝'
-- '拒绝', else '未完成'
-- '未完成') 审批状态,
end 审批状态,
case
when pla.closed_code='CLOSED' then '已关闭'
when pla.closed_code='FINALLY CLOSED' then '最终关闭'
else '打开'
end 关闭状态,
case
when pLla.closed_code='CLOSED' then '已关闭'
when pLla.closed_code='CLOSED FOR RECEIVING' then '接收关闭'
when pLla.closed_code='CLOSED FOR INVOICE' then '发票关闭'
when pLla.closed_code='FINALLY CLOSED' then '最终关闭'
else '打开'
end 发运⾏状态,
--pla.closed_code 状态,
plla.quantity 数量,
--plla.QUANTITY_DUE 数量到期,
--(plla.quantity-plla.QUANTITY_RECEIVED) 数量到期,
plla.QUANTITY_RECEIVED 接收数量,
--plla.QUANTITY_ACCEPTED 验收数量,
plla.QUANTITY_REJECTED 拒收数量,
plla.QUANTITY_BILLED 开单数量,
plla.QUANTITY_CANCELLED 取消数量,
(plla.QUANTITY_RECEIVED-plla.QUANTITY_BILLED) 未开单数,
ppv.vendor_name 供应商,
/*case
when ppv.vendor_type_lookup_code='A_VENDOR' then '固定资产供应商'
when ppv.vendor_type_lookup_code='L_VENDOR' then '备品备件供应商'
when ppv.vendor_type_lookup_code='M_VENDOR' then '材料供应商'
when ppv.vendor_type_lookup_code='F_VENDOR' then '成品供应商'
when ppv.vendor_type_lookup_code='C_VENDOR' then '费⽤资⾦类供应商'
when ppv.vendor_type_lookup_code='VENDOR' then '供应商'
when ppv.vendor_type_lookup_code='PUBLIC SECTOR COMPANIES' then '公关部门公司' when ppv.vendor_type_lookup_code='TAX AUTHORITY' then '税务机关'
when ppv.vendor_type_lookup_code='EMPLOYEE' then '员⼯'
when ppv.vendor_type_lookup_code='S_VENDOR' then '安装维修类供应商'
when ppv.vendor_type_lookup_code='O_VENDOR' then '其它类供应商'
else ''
end 供应商类型,*/
pvs.vendor_site_code 供应商地点,
pla.unit_price 单价,
pla.last_update_date 修改⽇期,
plla.promised_date 承诺⽇期,
phaments 订单说明
from po.po_headers_all pha,
po.po_lines_all pla,
po.po_line_locations_all plla,
po.po_vendors ppv,
po.po_vendor_sites_all pvs,
apps.per_people_f appf
where pha.po_header_id=pla.po_header_id
and pla.item_id=msi.inventory_item_id
and plla.po_header_id=pha.po_header_id
anization_id=X
_id=Y
and plla.po_line_id=pla.po_line_id
and pha.vendor_id=ppv.vendor_id
and pha.agent_id=appf.person_id
and pvs.vendor_site_id=pha.vendor_site_id pe_lookup_code='STANDARD' --标准采购订单 --'BLANKET' --and decode(pla.closed_code,'','OPEN',pla.closed_code) = 'OPEN' --查未关闭订单⾏
--ation_date between to_date('20**-01-01','yyyy-mm-dd') and to_date('20**-01-31','yyyy-mm-dd')
ation_date > to_date('20**-01-15','yyyy-mm-dd')
and msi.item_type ='OP' and appf.full_name not like 'ERP⼯%'
and decode(pllA.cancel_flag,'','N',pllA.cancel_flag) = 'N'
--查未取消订单⾏ --ation_date < to_date('20**-02-01','yyyy-mm-dd')
--and (pla.quantity-plla.QUANTITY_RECEIVED)>0 --查有剩余数订单
distinct查询--and plla.quantity_received > 0 --and pla.unit_price=0
--and plla.quantity >1000000
order by pha.segment1,
pla.line_num
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论