查詢物料PAC單位成本


select  cpp.period_name       期間名稱,
 ccga.organization_id  組織ID,
 ood.ORGANIZATION_CODE 組織代碼,
 OOD.ORGANIZATION_NAME 組織名稱,
 msib.inventory_item_id 物料ID,
 msib.segment1 物料編碼,
 msib.description 物料名稱,
 msib.primary_uom_code 單位,
 cppb.txn_category 類型,
 cppb.txn_category_qty 數量,
 round(decode(cppb.txn_category_qty, 0, 0,cppb.txn_category_value / cppb.txn_category_qty),5) 單位成本,
 round(cppb.txn_category_value,2) 金額,
 cppb.period_quantity 期間數量,
 cppb.periodic_cost 期間成本,
 round(cppb.period_balance,2) 期間金額,
 round(cppb.variance_amount,2) 差異
  from cst_pac_period_balances      cppb,
       mtl_system_items_b           msib,
       cst_pac_periods              cpp,
       cst_cost_groups              ccg,
       cst_cost_group_assignments   ccga,
       org_organization_definitions ood
 where cppb.inventory_item_id = msib.inventory_item_id
   and msib.organization_id = ccga.organization_id
   and cpp.period_name = '&period_name'
  and ood.ORGANIZATION_CODE=nvl('&organization_code',ood.ORGANIZATION_CODE)
  and msib.segment1='&item_code'
  and ood.OPERATING_UNIT=nvl('&ou_id',ood.OPERATING_UNIT)
   and cpp.pac_period_id = cppb.pac_period_id
   and ccg.cost_group_id = cppb.cost_group_id
   and ccg.cost_group_id = ccga.cost_group_id
   and ood.ORGANIZATION_ID = ccga.organization_id;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM