|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我现在正在开发销售毛利分析的报表,需要求一个单位成本的columns一般单位成本怎么取?
我参考了下单位里面其他人做的关于单位成本的计算方法:但看不懂,麻烦哪位帮我看一下谢谢:
xx_get_ord_conversion_rate
(h.transactional_curr_code,
sysdate,
h.conversion_type_code,
h.conversion_rate,
0
)
* DECODE
(inv_convert.inv_um_convert
(l.inventory_item_id,
6,
DECODE (SUM (NVL (mt.primary_quantity, 0)),
0, (SELECT MIN (cic.item_cost)
FROM cst_item_costs cic,
cst_cost_types cct,
mtl_parameters mp
WHERE cct.cost_type_id =
cic.cost_type_id
AND cct.costing_method_type =
mp.primary_cost_method
AND ( ( mp.primary_cost_method =
1
AND cct.frozen_standard_flag =
1
)
OR (mp.primary_cost_method <> 1
)
)
AND cic.inventory_item_id(+) =
l.inventory_item_id
AND l.ship_from_org_id = mp.organization_id(+)
AND l.ship_from_org_id = cic.organization_id(+)),
SUM (NVL ( mt.actual_cost
* mt.primary_quantity,
0
)
)
/ SUM (NVL (mt.primary_quantity, 0))
),
l.order_quantity_uom,
m.primary_uom_code,
NULL,
NULL
),
-99999, 0,
inv_convert.inv_um_convert
(l.inventory_item_id,
6,
DECODE (SUM (NVL (mt.primary_quantity, 0)),
0, (SELECT MIN (cic.item_cost)
FROM cst_item_costs cic,
cst_cost_types cct,
mtl_parameters mp
WHERE cct.cost_type_id =
cic.cost_type_id
AND cct.costing_method_type =
mp.primary_cost_method
AND ( ( mp.primary_cost_method =
1
AND cct.frozen_standard_flag =
1
)
OR (mp.primary_cost_method <> 1
)
)
AND cic.inventory_item_id(+) =
l.inventory_item_id
AND l.ship_from_org_id = mp.organization_id(+)
AND l.ship_from_org_id = cic.organization_id(+)),
SUM (NVL ( mt.actual_cost
* mt.primary_quantity,
0
)
)
/ SUM (NVL (mt.primary_quantity, 0))
),
l.order_quantity_uom,
m.primary_uom_code,
NULL,
NULL
)
) actual_cost
注:xx_get_ord_conversion_rate
为求汇率的包,哪位能讲讲思路吗?
mt为 (select *
from mtl_material_transactions
where TRANSACTION_TYPE_ID = 15
or TRANSACTION_TYPE_ID = 33) mt
l为oe_order_lines_all L
h为oe_order_headers_all h |
|