Annotation: transactions.get_stock_account_statement

CREATE OR REPLACE FUNCTION transactions.get_stock_account_statement(_value_date_from date, _value_date_to date, _user_id integer, _item_code text, _store_id integer)
RETURNS TABLE(id integer, value_date date, tran_code text, statement_reference text, debit numeric, credit numeric, balance numeric, book text, item_id integer, item_code text, item_name text, posted_on timestamp with time zone, posted_by text, approved_by text, verification_status integer, flag_bg text, flag_fg text)

Information: transactions.get_stock_account_statement

Schema transactions
Function Name get_stock_account_statement
Arguments _value_date_from date, _value_date_to date, _user_id integer, _item_code text, _store_id integer
Owner postgres
Result Type TABLE(id integer, value_date date, tran_code text, statement_reference text, debit numeric, credit numeric, balance numeric, book text, item_id integer, item_code text, item_name text, posted_on timestamp with time zone, posted_by text, approved_by text, verification_status integer, flag_bg text, flag_fg text)
Description

Implementation: transactions.get_stock_account_statement

CREATE OR REPLACE FUNCTION transactions.get_stock_account_statement(_value_date_from date, _value_date_to date, _user_id integer, _item_code text, _store_id integer)
 RETURNS TABLE(id integer, value_date date, tran_code text, statement_reference text, debit numeric, credit numeric, balance numeric, book text, item_id integer, item_code text, item_name text, posted_on timestamp with time zone, posted_by text, approved_by text, verification_status integer, flag_bg text, flag_fg text)
 LANGUAGE plpgsql
AS $function$
    DECLARE _item_id        integer;
BEGIN

    SELECT core.items.item_id INTO _item_id
    FROM core.items
    WHERE core.items.item_code = _item_code;

    RETURN QUERY
    SELECT * FROM transactions.get_stock_account_statement(_value_date_from, _value_date_to, _user_id, _item_id, _store_id);
END
$function$