Annotation: core.get_cost_of_goods_sold_account_id

CREATE OR REPLACE FUNCTION core.get_cost_of_goods_sold_account_id(_item_id integer)
RETURNS integer

Information: core.get_cost_of_goods_sold_account_id

Schema core
Function Name get_cost_of_goods_sold_account_id
Arguments _item_id integer
Owner postgres
Result Type integer
Description

Implementation: core.get_cost_of_goods_sold_account_id

CREATE OR REPLACE FUNCTION core.get_cost_of_goods_sold_account_id(_item_id integer)
 RETURNS integer
 LANGUAGE plpgsql
 STABLE
AS $function$
BEGIN
    RETURN
        cost_of_goods_sold_account_id
    FROM core.item_groups
    INNER JOIN core.items
    ON core.item_groups.item_group_id = core.items.item_group_id
    WHERE core.items.item_id = $1;    
END
$function$